Add development-friendly Cflags and -lpthread to CMakeLists.txt

Issue #5 resolved
Chelsea created an issue

On both of my current ArchLinux systems, when trying to link ibex with no flags specified, I get this error:

#!


Linking CXX executable ibex
/usr/bin/ld: CMakeFiles/ibex.dir/iphone_orientation_plugin/iphone_orientation_listener.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /usr/lib/libpthread.so.0 so try adding it to the linker command line
/usr/lib/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [ibex] Error 1
make[1]: *** [CMakeFiles/ibex.dir/all] Error 2
make: *** [all] Error 2

This is easily fixed by adding the following to CMakeLists.txt, directly under project:

set(CMAKE_C_FLAGS "-lpthread")

set(CMAKE_CXX_FLAGS "-lpthread")

But, while we're at it, why not add all the dev-friendly flags? Warnings especially can save quite a lot of long-term headache.

set(CMAKE_C_FLAGS "-Wall -Og -g -ggdb -lpthread") set(CMAKE_CXX_FLAGS "-Wall -Og -g -ggdb -lpthread")

Comments (2)

  1. Hesham Wahba repo owner

    Thanks very much feilen!

    Latest version should work now. Please check the README.md for details on updated packages needed. Ubuntu 13.04 is what I'm using, also you should have the OculusSDK extracted in the Downloads folder or a level above the ibex folder.

    I didn't add the gdb related flags, but I'll look to add it later possibly.

  2. Log in to comment