I'm trying to build poco and cegui libs with crystax ndk(version 10.3.2) using cmake
export ANDROID_NDK=/.../crystax-ndk-10.3.2
cmake -DPOCO_STATIC=ON -DCMAKE_TOOLCHAIN_FILE="../../AndroidBuildToolchain/android.toolchain.cmake" -DANDROID_ABI=x86 -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_TOOLCHAIN_NAME=x86-4.9 ../..
and build my own app with android.mk and I got the same error(using ndk-build):
crystax-ndk-10.3.2/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld: error: cannot find -lcrystax
And other link errors from, like these
error: undefined reference to 'sinf'
error: undefined reference to 'cosf'
error: undefined reference to '__getCurrentRuneLocale'
But when i'm trying to build the poco and my project with google NDK it works good. But I have reasons to use crystax. So, can anybody help me to find out the reason of these errors?
I've tried -lm flag for math(sin,cos) lib, but I had the same errors.
Related
I tried How to build and integrate OpenSSL into your Android NDK project – Scottyab's blog, but had problems with it:
Error message
openssl/x86_64/lib/libcrypto.a(eng_openssl.o):eng_openssl.c:function test_rc4_init_key: error: undefined reference to 'stderr'
openssl/x86_64/lib/libcrypto.a(ui_openssl.o):ui_openssl.c:function close_console: error: undefined reference to 'stdin'
openssl/x86_64/lib/libcrypto.a(ui_openssl.o):ui_openssl.c:function close_console: error: undefined reference to 'stderr'
openssl/x86_64/lib/libcrypto.a(ui_openssl.o):ui_openssl.c:function open_console: error: undefined reference to 'stdin'
openssl/x86_64/lib/libcrypto.a(ui_openssl.o):ui_openssl.c:function open_console: error: undefined reference to 'stderr'
I tried Compilation fails with android ndk r15b · Issue #3826 · openssl/openssl's comment, and it did remove one of the errors, but the others were left.
Compilation fails with android ndk r15b · Issue #3826 · openssl/openssl's comment has suggests using --deprecated-headers, didn't work either.
NDK: Unified Headers issue · Issue #445 · android-ndk/ndk's comment says it's resolved. I tried setting the CFLAGS=-D__ANDROID_API__=$API but it didn't help.
I also tried using clang as the compiler using and got
clang: error: unknown argument: '-mandroid'
Android Studio: clang error: unknown argument: '-mandroid''s answer has a good explanation for it.
Actually faisal00813/openssl_for_ios_and_android: OpenSSL Library for iOS and Android fork uses clang as the compiler and the -mandroid bug is resolved, but still getting the undefined reference to 'stdin'
I finally used willyliu/build-openssl-android: Builds openssl 1.1.0h with android ndk r17., and it worked great. My fork david-hoze/build-openssl-android: Builds openssl 1.1.0h with android ndk r17. has some minor fixes
Did anyone implemeted Cricket audio engine (http://www.crickettechnology.com/blog/) for Android Studio using gradle and Cmake (Android NDK) ?
I have imported the lib in my Cmake like this:
target_link_libraries(test
${CMAKE_CURRENT_SOURCE_DIR}/../../test/cricketaudio/lib/libck.a)
And the compiler sees it alright but when I try to run it, the linker gives me this error:
Error while executing process
[1/1] Linking CXX shared library
..\..\..\..\build\intermediates\cmake\development\debug\obj\armeabi-
v7a\libtest.so
FAILED: cmd.exe -soname,libtest.so -o
..\..\..\..\build\intermediates\cmake\development\debug\obj\armeabi-
v7a\libtest.so #CMakeFiles/test.rsp && cd ."
core/system_android.cpp:174: error: undefined reference to
'android_getCpuFamily'
core/system_android.cpp:187: error: undefined reference to
'android_getCpuFeatures'
core/system_android.cpp:210: error: undefined reference to
'android_getCpuCount'
clang++.exe: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.
I am aware that libck (cricket audio) has a dependency lib the Android NDK cpufeauters lib which is located in the Android NDK bundle (Android\Sdk\ndk-bundle\sources\android\cpufeatures).
I don`t know how to make this cpufeatures lib visible to the Linker of my project ???
Any help or pointers would be appreciated.
I have simply included the cpu-features.c and header file to my cmakelist and now it works :).
I have troubles to run the GStreamer tutorials. I followed all tutorial steps, and run into an error.
My System:
android-ndk-r11c, gstreamer-sdk-android-arm-debug-2013.6
My System: Windows 10 - 64 bit
The Error:
C:\gstreamer-sdk-android-arm-debug-2013.6\share\gst-sdk\tutorials\android-tutorial-1>ndk-build
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
GStreamer : [LINK] => gst-build/libgstreamer_android.so
lex.priv_gst_parse_yy.c:1598: error: undefined reference to '__srget'
gutils.c:2406: error: undefined reference to 'issetugid'
localcharset.c:158: error: undefined reference to '__srget'
localcharset.c:167: error: undefined reference to '__srget'
./localcharset.c:195: error: undefined reference to '__srget'
/home/slomo/Projects/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed/stdio.h:376: error: undefined reference to '__swbuf'
collect2.exe: error: ld returned 1 exit status
make: *** [buildsharedlibrary] Error 1
C:\gstreamer-sdk-android-arm-debug-2013.6\share\gst-sdk\tutorials\android-tutorial-1>
I tried:
Windows linkage problems : Due to problems related to the standard linker, Google’s Gold Linker is used to build GStreamer applications. Unfortunately, the Android NDK toolchain for Windows does not include the gold linker and the standard one has to be used.
If you observe linkage problems, you can replace the linker in your Android NDK with the gold one from this project. Download the android-ndk-r8b-ma-windows.7z file, extract \android-ndk-r8b\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\arm-linux-androideabi\bin\ld.exe (only this file is needed) and overwrite the one in the same folder in your Android NDK installation.
No effect. Any ideas how to solve this?
I had similar problem before please give a try with ndk10b.It is always good to check in header files for __srget before move forward.
UPDATE March 19, 2016: Superpowered has released new binaries which work properly with NDK r11
I'm trying to build Superpowered library CrossExample sample project in Android Studio. Until recent NDK update it worked like charm, but now execution of ndk-build gives an error:
Error:error: undefined reference to '__page_size'
I tried building with different toolchains, removing/adding several build flags with no luck so far.
In a different project that uses Superpowered SDK and pretty much the same config I get some other error details. Part of output message log:
/android/ndk/platforms/android-9/arch-x86/usr/include/unistd.h:173: error: undefined reference to '__page_size'
/android/ndk/platforms/android-9/arch-x86/usr/include/unistd.h:173: error: undefined reference to '__page_size'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/user_name/StudioProjects/project_name/app/src/main/jniSuperpowered/obj/local/x86/libNativeLibName.so] Error 1
make: *** Waiting for unfinished jobs....
/Volumes/iMect/iphone/SuperpoweredSource/decoder/SuperpoweredDecoder.cpp:120: error: undefined reference to '__page_size'
/Volumes/iMect/iphone/SuperpoweredSource/decoder/hlsreader.cpp:582: error: undefined reference to '__page_size'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/user_name/StudioProjects/project_name/app/src/main/jniSuperpowered/obj/local/armeabi-v7a/libNightcorizerSuperpowered.so] Error 1
FAILURE: Build failed with an exception.
What looks not right is undefined reference to __page_size in unistd.h . However I've got very little idea of further troubleshooting.
Thanks ahead for any help/suggestions!
The changes made in this NDK commit seem to explain the issue you're seeing. According to the commit description, __page_size was replaced with PAGE_SIZE for Android API levels 12 and under. As you're using API level 9 and code which directly references __page_size, you're seeing an effect from this change.
However, it looks like the method signature for int getpagesize() hasn't changed across NDK versions or across API levels, so you should be able to resolve this error by replacing the usage of __page_size with getpagesize() in the following locations:
SuperpoweredSource/decoder/SuperpoweredDecoder.cpp:120
SuperpoweredSource/decoder/hlsreader.cpp:582
Update:
To fix it without modifying the Superpowered source code, you'd need to define the symbol __page_size. To do that, you could build a tiny dummy library which just contains
#include <unistd.h>
extern unsigned int __page_size = getpagesize();
Then, add a module for this library to your Android.mk (or your build.gradle if you're using the new experimental system) and make the module for Superpowered depend on the dummy module.
Or, you could file a bug report with Superpowered.
So as a workaround for the situation I reverted NDK to r10e which worked. Will be using it until Superpowered library gets a fix. Great thanks to #bullsy
I am trying to build the x86 image on AOSP 4.3 source code.
followed below steps:
source build/envsetup.sh
lunch ( selected aosp_x86-eng)
make -j4
It gives below error.
bionic/libc/include/string.h:219: error: undefined reference to '__strlen_chk'
bionic/libc/include/string.h:219: error: undefined reference to '__strlen_chk'
bionic/libc/include/string.h:219: error: undefined reference to '__strlen_chk'
bionic/libc/include/string.h:219: error: undefined reference to '__strlen_chk'
Question:
It the steps for building x86 in AOSP 4.3 is correct?
How we can fix the above error.
I've solved it when building libcurl. The key idea is setting D_FORTIFY_SOURCE=0 in flags to disable checks, as mentioned in the source code.
LOCAL_STATIC_LIBRARIES += libc