Problem with LOCAL_LDLIBS -l on Windows/Cygwin

519 views
Skip to first unread message

tomgibara

unread,
Jun 26, 2009, 7:12:14 AM6/26/09
to android-ndk
Great to see the NDK available.

I've got a small C++ library (which I've been developing thus far
using the platform build) that I'm trying to build under the NDK on
Windows XP. I've read through through the docs (which are great btw)
but have encountered a problem linking to liblog.so. My C is very
rusty, so apologies in advance if this is a dumb mistake on my part.

Here's my Android.mk

>>>>>
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := mosey
LOCAL_SRC_FILES := mosey.cpp
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)
>>>>>


The source compiles fine, but the linker complains:

/cygdrive/c/development/android/ndk-1.5_r1/build/prebuilt/windows/arm-
eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/bin/ld:
cannot find -llog
collect2: ld returned 1 exit status
make: *** [out/apps/mosey/android-1.5-arm/libmosey.so] Error 1


I was able to fix the problem by changing my Android.mk file to
include this:

LOCAL_LDLIBS := -Lbuild/platforms/android-1.5/arch-arm/usr/lib -
llog


I don't understand why this should be necessary when I can see using
the V=1 flag that -rpath-link includes build/platforms/android-1.5/
arch-arm/usr/lib

Tom.

Todd

unread,
Jun 26, 2009, 10:56:06 PM6/26/09
to android-ndk
I faced the same problem here and I am also developing android
programs on cygwin.
Thanks for your solution, I'll try to check whether this resolves my
problem or not.

Eurico Inocêncio

unread,
Jun 27, 2009, 3:53:15 AM6/27/09
to andro...@googlegroups.com
Faced same problem on MAC OS/X and the -L pointing to pre-built libs
fixed it too

LOCAL_MODULE := libnav
LOCAL_LDLIBS := -L${SYSROOT}/usr/lib -llog -lz

2009/6/27 Todd <taig...@gmail.com>:

Tyler Ernst

unread,
Jun 29, 2009, 5:49:39 PM6/29/09
to android-ndk
I had this same problem on XP/Cygwin. Setting the path fixed it for
me too.

Thanks

On Jun 27, 12:53 am, Eurico Inocêncio <eurico.inocen...@gmail.com>
wrote:
> Faced same problem on MAC OS/X and the -L pointing to pre-built libs
> fixed it too
>
> LOCAL_MODULE := libnavLOCAL_LDLIBS:= -L${SYSROOT}/usr/lib -llog -lz
>
> 2009/6/27 Todd <taigc...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages