hi all,

i'm trying to compile simple native application under Android platform
and got problem with linker (looks like linker or linker scripts bug)

my simple program:

class C
{
    static int m;

public:
    static void f() { m = 0; }
};

int main(int, char**)
{
    C::f();
    return 0;
}

compilation commands:

arm-eabi-gcc -c -I/home/simon/workspace/mydroid/system/core/include -I/
home/simon/workspace/mydroid/hardware/libhardware/include -I/home/
simon/workspace/mydroid/hardware/ril/include -I/home/simon/workspace/
mydroid/dalvik/libnativehelper/include/nativehelper -I/home/simon/
workspace/mydroid/frameworks/base/include -I/home/simon/workspace/
mydroid/frameworks/base/libs/audioflinger -I/home/simon/workspace/
mydroid/external/skia/include -I/home/simon/workspace/mydroid/out/
target/product/generic/obj/include -I/home/simon/workspace/mydroid/
bionic/libc/arch-arm/include -I/home/simon/workspace/mydroid/bionic/
libc/include -I/home/simon/workspace/mydroid/bionic/libstdc++/include -
I/home/simon/workspace/mydroid/bionic/libc/kernel/common -I/home/simon/
workspace/mydroid/bionic/libc/kernel/arch-arm -I/home/simon/workspace/
mydroid/bionic/libm/include -I/home/simon/workspace/mydroid/bionic/
libm/include/arch/arm -I/home/simon/workspace/mydroid/bionic/
libthread_db/include -I/home/simon/workspace/mydroid/bionic/libm/arm -
I/home/simon/workspace/mydroid/bionic/libm -I/home/simon/workspace/
mydroid/out/target/product/generic/obj/SHARED_LIBRARIES/
libm_intermediates -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -
D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_DEBUG -DDEBUG -
march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fno-
threadsafe-statics -fpic -fno-exceptions -ffunction-sections -funwind-
tables -fstack-protector-all -fmessage-length=0 main2.cpp

arm-eabi-gcc -o mt -I/home/simon/workspace/mydroid/system/core/include
-I/home/simon/workspace/mydroid/hardware/libhardware/include -I/home/
simon/workspace/mydroid/hardware/ril/include -I/home/simon/workspace/
mydroid/dalvik/libnativehelper/include/nativehelper -I/home/simon/
workspace/mydroid/frameworks/base/include -I/home/simon/workspace/
mydroid/frameworks/base/libs/audioflinger -I/home/simon/workspace/
mydroid/external/skia/include -I/home/simon/workspace/mydroid/out/
target/product/generic/obj/include -I/home/simon/workspace/mydroid/
bionic/libc/arch-arm/include -I/home/simon/workspace/mydroid/bionic/
libc/include -I/home/simon/workspace/mydroid/bionic/libstdc++/include -
I/home/simon/workspace/mydroid/bionic/libc/kernel/common -I/home/simon/
workspace/mydroid/bionic/libc/kernel/arch-arm -I/home/simon/workspace/
mydroid/bionic/libm/include -I/home/simon/workspace/mydroid/bionic/
libm/include/arch/arm -I/home/simon/workspace/mydroid/bionic/
libthread_db/include -I/home/simon/workspace/mydroid/bionic/libm/arm -
I/home/simon/workspace/mydroid/bionic/libm -I/home/simon/workspace/
mydroid/out/target/product/generic/obj/SHARED_LIBRARIES/
libm_intermediates -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -
D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_DEBUG -DDEBUG -
march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fno-
threadsafe-statics -fpic -fno-exceptions -ffunction-sections -funwind-
tables -fstack-protector-all -fmessage-length=0 -Bdynamic -Wl,-T,/home/
simon/workspace/mydroid/build/core/armelf.x -Wl,-dynamic-linker,/
system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,--no-
undefined -Wl,-rpath,/system/lib,-rpath,/data/lib -Wl,-rpath-link,/
home/simon/workspace/mydroid/out/target/product/generic/obj/lib -L/
home/simon/workspace/mydroid/out/target/product/generic/obj/lib -
nostdlib /home/simon/workspace/mydroid/out/target/product/generic/obj/
lib/crtend_android.o /home/simon/workspace/mydroid/out/target/product/
generic/obj/lib/crtbegin_static.o -lc -lm -gdb main2.o

linker output and error message:

main2.o: In function `C::f()':
main2.cpp:(.gnu.linkonce.t._ZN1C1fEv+0x64): undefined reference to
`C::m'
collect2: ld returned 1 exit status

Maybe I use wrong ldscripts? Have somebody any suggestions?
Thanks for advice.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to