I want to use the NDK to build the sample application chat (cpp version) of alljoyn on android. But I got the error undefined reference to 'typeinfo for ajn::BusObject'. And I have checked the alljoyn library path and I could find the libajdaemon.a and liballjoyn.a. The NDK version is r9c. The alljoyn android SDK version is 3.4.6. Can someone help me? Thanks!
The detail information is following:
/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libChat.so -shared --sysroot=/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/platforms/android-17/arch-arm ./obj/local/armeabi/objs-debug/Chat/Chat_jni.o ./obj/local/armeabi/libstdc++.a -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/platforms/android-17/arch-arm/usr/lib -L/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/platforms/android-8/arch-arm/usr/lib -L../..//lib -L/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/libs/armeabi -L/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi -L./libs ../..//lib/BundledDaemon.o -lajdaemon -lalljoyn -llog -lz -ldl -lssl -lcrypto -lm -lc -lstdc++ -lgcc -lgnustl_static -lstdc++ -lc -lm -o ./obj/local/armeabi/libChat.so
/Volumes/MacintoshHD/Users/wshu_cn/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/Chat/Chat_jni.o: in function typeinfo for ChatObject:Chat_jni.cpp(.data.rel.ro._ZTI10ChatObject+0x8): error: undefined reference to 'typeinfo for ajn::BusObject'
collect2: ld returned 1 exit status
Related
I'm trying to build one application with cross compiler on linux. Application is based on OpenEmbedded project. Compiler and all cross compiled libraries are located in build folder. But for one package build script is trying to use a library from my linux environment.
Command which is called from make script at the end:
/bin/sh ./arm-ABC-linux-gnueabi-libtool --tag=CXX --mode=link
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-rpath-link,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -L/opt/my/lib -o modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/local/apr/lib/libapr-2.la
-lcrypt -luuid -lrt -lcrypt -lpthread -ldl -lexpat -lstdc++
Most important from here that is use -lexpat flag for libexpat.so.1.5.2 library. This library is cross compiled and located in the build folder, and at the same time, we have one in my linux environment.
As result I recieve the next error:
| arm-ABC-linux-gnueabi-libtool: link:
arm-ABC-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp -g --std=c++0x -pthread -Wl,-rpath-link -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-Wl,-O1 -Wl,--hash-style=gnu -o .libs/modbus_server_test modbus_server_test.o Serial.o SerialUtil.o Crc.o RtuFramer.o Pdu.o
SerialMaster.o
-L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/opt/my/lib
-L/opt/my/lib /usr/local/apr/lib/libapr-2.so -L/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
/usr/lib/x86_64-linux-gnu/libexpat.so
/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libuuid.so
-lrt -lcrypt -lpthread -ldl /home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so
/home/ABC/build/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libstdc++.so
-lm -pthread -Wl,-rpath -Wl,/usr/local/apr/lib -Wl,-rpath -Wl,/home/ABC/build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib
| /usr/lib/x86_64-linux-gnu/libexpat.so: file not recognized: File
format not recognized
| collect2: ld returned 1 exit status
| make[2]: *** [modbus_server_test] Error 1
From output I can see that it include two libraries: one from linux environment (/usr/lib/x86_64-linux-gnu/libexpat.so which is x86) and one from the build folder (build/sysroots/armv7a-ABC-linux-gnueabi/usr/lib/libexpat.so which is for ARM).At the end it complains about x86 type.
How can I exclude this library from searching in global environment? Why it even trying to use both of them?
I am trying to compile a project that links the nsl lib but it seems to fail to link the library:
/bin/sh ../../libtool --tag=CXX --mode=link g++ -DNDEBUG -std=c++11 -L/usr/lib -R/usr/lib -L../../lib -all-static -lnsl -o Client client.o nettools.o -lgmm -lboost_program_options
libtool: link: g++ -DNDEBUG -std=c++11 -static -o Client client.o nettools.o -L/usr/lib -L../../lib -lnsl -lgmm -lboost_program_options -Wl,-rpath -Wl,/usr/lib
/bin/sh ../../libtool --tag=CXX --mode=link g++ -DNDEBUG -std=c++11 -L/usr/lib -R/usr/lib -L../../lib -all-static -lnsl -o Serveur serveur.o nettools.o -lgmm -lboost_program_options
/bin/ld: cannot find -lnsl
nettools.o: In function `creatSocketCom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
nettools.cc:(.text+0x30e): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
Makefile:426: recipe for target 'Client' failed
make[2]: *** [Client] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: link: g++ -DNDEBUG -std=c++11 -static -o Serveur serveur.o nettools.o -L/usr/lib -L../../lib -lnsl -lgmm -lboost_program_options -Wl,-rpath -Wl,/usr/lib
/bin/ld: cannot find -lnsl
nettools.o: In function `creatSocketCom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
nettools.cc:(.text+0x30e): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
I know this library doesn't need to be linked on Mac OS X but I'm running Arch Linux.
I have 2 questions:
Why does nsl fail to be linked even though λ ld --verbose -lnsl seems to show it's there?
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libnsl.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libnsl.a failed
attempt to open /usr/lib/libnsl.so succeeded
-lnsl (/usr/lib/libnsl.so)
libc.so.6 needed by /usr/lib/libnsl.so
found libc.so.6 at /usr/lib/libc.so.6
ld-linux-x86-64.so.2 needed by /usr/lib/libc.so.6
found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2
ld: warning: cannot find entry symbol _start; not setting start address
What's the purest way to tell autoconf not to link nsl on systems where it's not needed?
The problem was with the -all-static option in the Makefile.am.
Arch Linux doesn't ship the static libraries (while debian's current stable release does).
I am trying to install re2 on a centos7 vm, and I am having some trouble solving these dependencies:
[root#roller re2]# make testinstall
cp testinstall.cc obj
(cd obj && g++ -I/usr/local/include -L/usr/local/lib testinstall.cc -lre2 -pthread -static -o testinstall)
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [testinstall] Error 1
Any help would be great! :)
thanks!
I am trying to install WordNet with cygwin.
But Getting the following error during make
make[2]: Entering directory `/cygdrive/d/VaiVocabulary/vaiLinuxFinal/wordNet/WordNet-3.0/src'
gcc -g -O2 -o wishwn.exe wishwn-tkAppInit.o wishwn-stubs.o -L../lib -lWN -L/usr/lib -ltk8.5 -L/usr/lib -ltcl8.5 -lX11 -lXss -lXext -lXft -lXrender -lfontconfig -lexpat -liconv -lfreetype -lz -lbz2 -lX11 -lxcb -lXau -lXdmcp -ldl
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lXss
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lXext
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lXft
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lXrender
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lfontconfig
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lexpat
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lfreetype
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lbz2
collect2: ld returned 1 exit status
Makefile:223: recipe for target `wishwn.exe' failed
It seems linking error. What would I have to do to resolve it?
It definitely looks like you are missing those libraries. Rerun Cygwin's Setup.exe and when you get to the package selection screen enter your missing dependencies in the 'search' box. For example searching for Xss and Xext finds both libraries (and their development packages) in the X11 folder while bz2 is in Libs.
I have a problem with compiling zabbix-server on CentOS 6.2.
Command line is:
./configure --enable-server --with-mysql --with-net-snmp --with-libcurl
--with-jabber --with-ssh2 --with-openipmi --with-ldap --enable-static
But error occures:
checking for main in -lz... no
configure: error: Not found z library;
Full configure output is here: http://pastebin.ru/WmDP7UL0
I already tried to do:
yum install zlib zlib-devel zlib-static zlibrary zlibrary-devel
But it was unsuccessfully.
Thank you for your attention.
UPD. Config log posted here: http://pastebin.ru/WNtQu9eR and shows this error:
configure:7366: checking for main in -lz
configure:7385: gcc -o conftest -g -O2 -rdynamic -static conftest.c -lz -lm -lrt -lresolv >&5
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
Here's the actual error:
/usr/bin/ld: cannot find -lm
But it is found previously, which points to something else. Check your ulimits to make sure you don't have a low max open file count.