px4-firmware/cmake/nuttx
Carlo Wood c6a2641507 Fix some pthread related linker stuff. (#5504)
The px4_os_add_flags defined in cmake/posix/px4_impl_posix.cmake did
add (threading) libraries to added_exe_linker_flags, which subsequently
end up in CMAKE_EXE_LINKER_FLAGS and then have no effect because those
flags are passed to the linker before any of the object files and static
libraries.

Those libraries are already added correctly in the corresponding
src/firmware/*/CMakeLists.txt files (for qurt, nuttx AND posix).

I left in the non-library linker flag '-pthread' for the bebop board,
although it seems very weird to me that this is needed (is it?).
If that is needed then it seems weird to link manually (that is,
src/firmware/*/CMakeLists.txt) with -lpthread.

For linux/g++ -pthread is added to the CXXFLAGS as it should be:
this causes the compiler to define _REENTRANT which is needed
for (the interface of) certain libraries to become thread-safe.
Offically one also can just pass -pthread to the linker, which then
causes the right libraries to be linked, but just linking with
-lpthread -lm -lrt works too.

I ran into this while adding support for libcwd, which explicitly
complains that _REENTRANT isn't defined when trying to link with
the thread-safe version of libcwd (-lcwd_r) and then tells you
to use -pthread.
2016-09-26 22:53:41 +02:00
..
bin_to_obj.py bin_to_obj.py fix windows regex size match 2015-10-14 01:56:18 -04:00
builtin_commands.c.in Clean up location of nuttx specific template 2015-09-08 14:08:50 -07:00
px4_impl_nuttx.cmake Fix some pthread related linker stuff. (#5504) 2016-09-26 22:53:41 +02:00