Newest android.toolchain.cmake uses gcc for shared library linking, does not link with math library (Bug #2426)
Description
First of all, I am not sure wether this is really a bug or a problem with users assuming too much by thinking that the math library will be automatically linked (-lm) when linking a C++ shared library.
I recently switched from the android cmake toolchain in the android-cmake project to the toolchain in the opencv repository (more up-to-date and to avoid code replication). The latest changes allow the use of variants of the stl lib (stlport, gnustl etc.).
However it seems that the new toolchain links shared libraries (even written in C++) using arm-linux-androideabi-gcc whereas the version from the android-cmake project uses g++. Any program using math functions (sqrt, floor etc.) and not explicitely linking with the math library using -lm now produces "undefined reference" errors on compilation (see attached test program and logs for comparison).
I will now link explicitely with -lm but it would be good if newer versions used g++ to link with or added -lm to the linker flags.
Associated revisions
android.toolchain.cmake: restore implicit link with math library for C++ objects
Ticket #2426
History
Updated by Andrey Kamaev over 12 years ago
- Target version deleted ()
- Assignee changed from Andrey Pavlenko to Andrey Kamaev
Updated by Andrey Kamaev over 12 years ago
Thanks for the report.
Fix is pushed to master.
- Status changed from Open to Done
Updated by Andrey Kamaev about 12 years ago
- Target version set to 2.4.3