0

Android NDK link failed

asked 2014-08-28 02:45:29 -0800

jayatubi gravatar image

updated 2014-08-29 00:38:17 -0800

Hi,

I am going to use the AllJoyn in my project and I just succeed to make it work on iOS. Now I'm working to make the it work on Android as well. After set the include path and the libs I get such link errors:

......
function BundledRouter::Stop(ajn::NullTransport*): error: undefined reference to 'ajn::BusController::Stop()'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'qcc::LoggerSetting::GetLoggerSetting(char const*, int, bool, __sFILE*)'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::ConfigDB::LoadConfig(ajn::Bus*)'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::Bus::Bus(char const*, ajn::TransportFactoryContainer&, char const*)
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::BusController::BusController(ajn::Bus&, ajn::AuthListener*)'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::BusController::Init(qcc::String const&)'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::TCPTransport::TransportName'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::UDPTransport::TransportName'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::PasswordManager::authMechanism'
function BundledRouter::Start(ajn::NullTransport*): error: undefined reference to 'ajn::PasswordManager::password'
......

Is there anything else missing? Currently I have such files in the lib folder:

BundledRouter.o
libajrouter.a
liballjoyn.a
alljoyn-daemon
lbbdaemon-lib
(these 5 from the SDK)
libcrypto.so 
libssl.so
(these 2 from Android 4.0 device)

And my link args:

LOCAL_LDLIBS := \
-L$(ALLJOYN_PATH) \
-lGLESv2 -llog -lz -ldl \
-lcrypto -lssl \
-lajrouter -lalljoyn -lalljoyn-daemon -lbbdaemon-lib \
$(ALLJOYN_PATH)/BundledRouter.o

BTW my project setting is using the clang as compiler and the abi is arm-v7a. Do I need to git the AllJoyn source to recompile it with the same settings? Could I still use the libs from the pre-compiled SDK?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-09-01 19:01:06 -0800

jayatubi gravatar image

I found the reason and the solution. The symbols have already been defined in the libajrouter.a and liballjoyn.a, what I need to do is just to put the .o file in front of the libs, such as:

LOCAL_LDLIBS := \
-L$(ALLJOYN_PATH) \
-lGLESv2 -llog -lz -ldl \
-lcrypto -lssl \
$(ALLJOYN_PATH)/BundledRouter.o \
-lajrouter -lalljoyn -lalljoyn-daemon -lbbdaemon-lib

Refer to: http://stackoverflow.com/questions/45135/linker-order-gcc

edit flag offensive delete publish link more

Comments

Please avoid using bbdaemon-lib, if possible. It is deprecated, unsupported and not maintained. I have requested to disable building it: https://jira.allseenalliance.org/browse/ASACORE-876 Let us know if removing the final linker flag: -lbbdaemon-lib causes errors on Android.

praveenb ( 2014-09-01 22:24:52 -0800 )edit

That's true. Actually only the -lajrouter -lalljoyn BundleRouter.o are enough. I think the doc should make a clear point about the necessary libs and the link order.

jayatubi ( 2014-09-02 18:22:58 -0800 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-08-28 02:45:29 -0800

Seen: 209 times

Last updated: Sep 01 '14