androidandroid-ndkcross-platformlibm

Cannot find symbol 'floor' at runtime


I cross-compiled the http Mongoose server for Android using Linux as BUILD system, android-ndk from Google as toolchain and a custom script that finally executes next command:

arm-linux-androideabi-gcc -DANDROID -march=armv7-a -mfpu=neon \
  -mfloat-abi=softfp -mvectorize-with-neon-quad \
  -I /opt/android-ndk-r9d/platforms/android-19/arch-arm/usr/include \
  -I ~/Package_sources/BUILD_arm-linux-androideabi/include \
  -DMONGOOSE_USE_LUA -DMONGOOSE_USE_LUA_SQLITE3 \ 
  -L/opt/android-ndk-r9d/platforms/android-19/arch-arm/usr/lib \
  -L~/Package_sources/BUILD_arm-linux-androideabi/lib \
  -L~/Package_sources/BUILD_arm-linux-androideabi/lib -lluasqlite3 \
  server.c mongoose.c -o server -llua51 -lm

The scripts works fine with no errors and a final 'server' elf executable is created. The problem I have now is when trying to launch it on Android. It complains that math symbols (defined in libm) like "floor" can not be found. I don't really understand why they can be found at compile time but not at run time, but I have some doubts about cross-compiling for Android and compilation setup that I describe next:

Thanks in advance for any help, hint or link!


Solution

  • Finally it looks the source of problems was a missing compilation flag in the LUA libraries (-DLUA_USE_DLOPEN). This caused the software to compile properly, but at runtime it failed to load so symbols defined "anywhere else".