views:

482

answers:

0

Hi,

my program compiles nicely for Android, however when I try to copy it to the Android emulator, it gives the following error:

knight666@Katja-Linux /media/Data/Shared/Galaxians $ acpy Galaxians.android
Filename: 'Galaxians.android'
819 KB/s (420657 bytes in 0.501s)
link_image[1638]:   825 could not load needed library 'libstdc++.so.6' for '/system/sbin/Galaxians.android' (load_library[984]: Library 'libstdc++.so.6' not found)CANNOT LINK EXECUTABLE

acpy is a small script I wrote that does the following:

#!/bin/sh

FILEPATH=`dirname $1`
FILENAME=`basename $1 .c`

echo "Filename: '$FILENAME'"

adb push $FILEPATH/$FILENAME /system/sbin/$FILENAME
adb shell chmod 777 /system/sbin/$FILENAME
adb shell /system/sbin/$FILENAME

Here is how I build my application:

oem@androiddev /media/YoghurtGum/Tests/Galaxians $ sudo make
arm-none-linux-gnueabi-g++ -static-libgcc -g -Wall -Werror -O2 -w -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c src/Alien.cpp -o intermediate/Alien.o
arm-none-linux-gnueabi-g++ -static-libgcc -g -Wall -Werror -O2 -w -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c src/Bullet.cpp -o intermediate/Bullet.o
arm-none-linux-gnueabi-g++ -static-libgcc -g -Wall -Werror -O2 -w -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c src/Game.cpp -o intermediate/Game.o
arm-none-linux-gnueabi-g++ -static-libgcc -g -Wall -Werror -O2 -w -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c src/Player.cpp -o intermediate/Player.o

arm-none-linux-gnueabi-gcc 
-Wl,--entry=main,
-dynamic-linker=/system/bin/linker,
-rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib,
-rpath=../../YoghurtGum/lib/Android,
-L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib 
-nostdlib 
-lstdc++ 
intermediate/Alien.o 
intermediate/Bullet.o 
intermediate/Game.o 
intermediate/Player.o 
../../YoghurtGum/lib/Android/libstdc++.a 
../../YoghurtGum/bin/YoghurtGum.a 
-o bin/Galaxians.android

Line breaks are only for clarity, none exist in the actual output.

YoghurtGum is my game library that already statically and dynamically links to libstdc++.

When I remove lstdc++, the program doesn't compile because it can't find the library.

Is there a way to link to stdlibc++ statically or link the application to the correct dynamic library in the emulator?

Thanks in advance.