Question

I'm trying to build dschaefer android-box2d, and did follow the recipe. I do get this error when trying to build the TestBox2d with eclipse:


make all /cygdrive/c/android/android-ndk-r3/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-ld \ -nostdlib -shared -Bsymbolic --no-undefined \ -o obj/libtest.so obj/test.o -L../box2d/lib/android -lbox2d \ -L/cygdrive/c/android/android-ndk-r3/build/platforms/android-3/arch-arm/usr/lib \ -llog -lc -lstdc++ -lm \ /cygdrive/c/android/android-ndk-r3/build/prebuilt/windows/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a \

/cygdrive/c/android/android-ndk-r3/build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-ld: cannot find -lbox2d make: *** [obj/libtest.so] Error 1


The only thing I did change was in the TestBox2d\Makefile where i did change the path to the NDK.

There are some other that have the same problem HERE but I do not know how to fix it.

Was it helpful?

Solution

The error indicates that the linker cannot find the library box2d.

What I think is the problem is that you have a relative path pointing to the location of the box2d library (-L../box2d/lib/android). If your build directory changes, your build will break. What you might want to do is substitute an absolute path for the box2d library (such as -L/cygdrive/c/box2d/lib/android). All of your other link paths to the NDK are absolute.

A better way would be to put the path to your box2d library in an environment variable and use this environment variable in your makefile.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top