dlopen, link error

818 views
Skip to first unread message

yosemite

unread,
Jul 5, 2009, 3:17:30 AM7/5/09
to android-ndk
Hi,

My C code #include <dlfcn.h> and calls a dlopen. But when I built it,
there is a link error saying "undefined reference to `dlopen' ". Do I
need to add some link option for the libdl?

Thanks,

David Turner

unread,
Jul 5, 2009, 10:17:02 AM7/5/09
to andro...@googlegroups.com
Yes, add the following:

LOCAL_LDLIBS := $(SYSROOT)/usr/lib -lld

Mike Gao

unread,
Jul 5, 2009, 12:26:30 PM7/5/09
to andro...@googlegroups.com
Thanks Dave. But I got the following error:
"build/platforms/android-1.5/arch-arm/usr/lib: file not recognized: Is a directory
collect2: ld returned 1 exit status"

By the way, my $(SYSROOT) does not contain any libld.so/a but libdl.so. However, even after I change OCAL_LDLIBS to $(SYSROOT)/usr/lib -ldl, the error still exists. Any clue?

David Turner

unread,
Jul 5, 2009, 11:35:15 PM7/5/09
to andro...@googlegroups.com
sorry, my typo:

LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -ldl

Note that there is a small bug in this release of the NDK, the -L$(SYSROOT)/usr/lib part will not be needed in future ones.
Reply all
Reply to author
Forward
0 new messages