I'm doing cross-compile vsomeip for android. But, I have fatal error to boost library. I already to boost for android. It doesn't have error. But, In vsomeip for android, I have boost error.
[ 61%] Linking CXX executable vsomeipd
../libvsomeip.so.2.0.1: error: undefined reference to
'boost::filesystem::detail::dir_itr_close(void*&, void*&)'
../libvsomeip.so.2.0.1: error: undefined reference to 'boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
../libvsomeip.so.2.0.1: error: undefined reference to 'boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)'
../libvsomeip.so.2.0.1: error: undefined reference to '
'boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
clang50++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: [daemon/vsomeipd] Error 1
make[1]: [daemon/CMakeFiles/vsomeipd.dir/all] Error 2
make[1]: Waiting for unfinished jobs....
[98%] Built target vsomeip-sd
make: [all] Error 2
I'm using clang++ in Android-ndk-16b,14b.
please help me.....
Related
I am trying to wrap me head around cross compiling C++ program for Android.
It is a simple console program.
My Cmake Configuration is like so:
cmake_minimum_required(VERSION 3.4.1)
project(app)
set(NDK "/Users/user/Desktop/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_C_COMPILER "${NDK}/clang")
set(CMAKE_CXX_COMPILER "${NDK}/armv7a-linux-androideabi16-clang++")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../Output")
file(GLOB Source "Source/*.cpp")
add_executable(${PROJECT_NAME} ${Source})
compiling succeeds eventually I get linking error like so:
ld: error: unknown argument '-search_paths_first'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../Output/app] Error 1
make[1]: *** [CMakeFiles/app.dir/all] Error 2
make: *** [all] Error 2
When I change armv7a-linux-androideabi16-clang++ compiler to clang++, i get errors like this:
ld: error: unknown argument '-dynamic', did you mean '-Bdynamic'
ld: error: unknown argument '-arch'
ld: error: unknown argument '-platform_version'
ld: error: unknown argument '-syslibroot'
ld: error: unknown argument '-search_paths_first'
ld: error: unable to find library -lto_library
ld: error: cannot open /Users/user/Desktop/NDK/toolchains/llvm/prebuilt/darwin-x86_64/lib/libLTO.dylib: No such file or directory
ld: error: cannot open x86_64: No such file or directory
ld: error: cannot open macos: No such file or directory
ld: error: cannot open 11.0.0: No such file or directory
ld: error: cannot open 11.3: No such file or directory
ld: error: cannot open /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk: Is a directory
ld: error: CMakeFiles/app.dir/Source/Source.cpp.o: unknown file type
ld: error: unable to find library -lc++
ld: error: unable to find library -lSystem
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../Output/app] Error 1
make[1]: *** [CMakeFiles/app.dir/all] Error 2
make: *** [all] Error 2
None of the binaries are in my search path, could this be the problem?
If you don't want to use a toolchain file as discussed in the comments above, one option for this case is to trick cmake into avoiding these macOS specific flags. From my testing you can use -DCMAKE_SYSTEM_NAME=Linux and -DANDROID=ON to do this
I'm trying to cross-compile ncurses using android-ndk but compilation error shows halfway the process.
Command:
CC=~/my-toolchain/bin/arm-linux-androideabi-gcc ./configure --host=arm-linux-androideabi --prefix=/Android
Output:
** Configuration summary for NCURSES 6.0 20150808:
extended funcs: yes
xterm terminfo: xterm-new
bin directory: /Android/bin
lib directory: /Android/lib
include directory: /Android/include/ncurses
man directory: /Android/share/man
terminfo directory: /Android/share/terminfo
** Include-directory is not in a standard location
Command
make
Output
../objects/tic.o:tic.c:function usage: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function put_translate: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function copy_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stdin'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stderr'
../objects/dump_entry.o:dump_entry.c:function show_entry: error: undefined reference to 'stdout'
../objects/dump_entry.o:dump_entry.c:function compare_entry: error: undefined reference to 'stdout'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
collect2: error: ld returned 1 exit status
Makefile:242: recipe for target 'tic' failed
make[1]: *** [tic] Error 1
make[1]: Leaving directory '/home/jrm/softether/src/curses/ncurses-6.0/progs'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
I don't have any idea about the error. I tried using google but i can't seem to find similar problems like mine.
The usual reason for this error is that you've compiled against android-23 or higher but are linking against something earlier. Another variation of that issue is when you have multiple libraries built against different API levels.
It looks like you are using a standalone toolchain? If that's correct, then I'd suspect your issue is either a prebuilt library that's part of libcurses (FWIR there aren't any of those, so unlikely) or that there's something funky going on in their build scripts that causes one of the two issues I mentioned. Tons of projects add their own Android specific hacks to their build scripts that always end up being the cause of these sorts of issues, so that wouldn't surprise me at all.
Should look at both the compilation command for tic.c and the link command for whatever library/executable is failing to link there. Make sure both are using the same API levels (look for things like $NDK/platforms/android-$API_LEVEL, -D__ANDROID_API__=$API_LEVEL, and -target arm-linux-androideabi$API_LEVEL).
btw, not ncurses 6, but I do have an example showing how to use standalone toolchains that had to build ncurses 5.9: https://github.com/DanAlbert/lua-ndk/blob/master/build_lua_with_libreadline.sh#L75. Might be worth taking a look to see if that helps at all.
I am getting following error on compilation of PJSIP 2.7 for architecture arm64-v8a. If any have idea about in which file it getting or how to resolve then please share.
/pjproject-2.7.2/third_party/lib/libsrtp-arm-unknown-linux-androideabi.a(crypto_kernel.o): In function `srtp_crypto_kernel_init':
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x22c): undefined reference to `srtp_aes_icm_128'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x230): undefined reference to `srtp_aes_icm_128'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x240): undefined reference to `srtp_aes_icm_128'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x244): undefined reference to `srtp_aes_icm_128'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x29c): undefined reference to `srtp_aes_icm_256'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x2a0): undefined reference to `srtp_aes_icm_256'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x2b0): undefined reference to `srtp_aes_icm_256'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x2b4): undefined reference to `srtp_aes_icm_256'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x314): undefined reference to `srtp_mod_aes_icm'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x318): undefined reference to `srtp_mod_aes_icm'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x34c): undefined reference to `srtp_mod_aes_icm'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x350): undefined reference to `srtp_mod_aes_icm'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x3cc): undefined reference to `srtp_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x3d0): undefined reference to `srtp_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x3e0): undefined reference to `srtp_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x3e4): undefined reference to `srtp_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x44c): undefined reference to `srtp_mod_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x450): undefined reference to `srtp_mod_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x488): undefined reference to `srtp_mod_hmac'
../../srtp/crypto/kernel/crypto_kernel.c:(.text.srtp_crypto_kernel_init+0x48c): undefined reference to `srtp_mod_hmac'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/pjproject-2.7.2/build/rules.mak:124: recipe for target '../bin/pjmedia-test-arm-unknown-linux-androideabi' failed
make[2]: *** [../bin/pjmedia-test-arm-unknown-linux-androideabi] Error 1
make[2]: Leaving directory '/pjproject-2.7.2/pjmedia/build'
Makefile:243: recipe for target 'pjmedia-test-arm-unknown-linux-androideabi' failed
make[1]: *** [pjmedia-test-arm-unknown-linux-androideabi] Error 2
make[1]: Leaving directory '/pjproject-2.7.2/pjmedia/build'
Makefile:14: recipe for target 'all' failed
make: *** [all] Error 1
out/host/linux-x86/obj/SHARED_LIBRARIES/libart_intermediates/utils.o:
Infunction `art::InitTimeSpec(bool, int, long long, int, timespec*)':
/tmp/android-src/art/runtime/utils.cc:190: undefined reference to
`clock_gettime'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libart.so] Error 1
make: *** Waiting for unfinished jobs....
I use ubuntu 12.04 and android 4.4.2.
How to fix it?
Sorry I may added it as another topic but I get a different error. Now I have the dependencies installed from the repository. I'm trying to build for Android.
I use Mingw32
now I get the following error:
[armeabi-v7a] SharedLibrary : libOgreSampleBrowser.so
C:/ogre/AndroidDependencies/lib/armeabi-v7a/libFreeImage.a(libraw_datastream.c
.o):libraw_datastream.cpp:function LibRaw_bigfile_datastream::get_char(): erro
undefined reference to '__srget'
collect2.exe: error: ld returned 1 exit status
make.exe[3]: *** [obj/local/armeabi-v7a/libOgreSampleBrowser.so] Error 1
Samples\Browser\CMakeFiles\SampleBrowserDummy.dir\build.make:84: recipe for ta
et 'lib/libSampleBrowserDummy.so' failed
mingw32-make[2]: *** [lib/libSampleBrowserDummy.so] Error 2
CMakeFiles\Makefile2:3749: recipe for target 'Samples/Browser/CMakeFiles/Sampl
rowserDummy.dir/all' failed
mingw32-make[1]: *** [Samples/Browser/CMakeFiles/SampleBrowserDummy.dir/all] E
or 2
Makefile:136: recipe for target 'all' failed
I encountered the same error...
Google removed __srget starting from NDKr10c (check their official site in other fixed bugs).
Download r10b and below and it should work.