Hello When I built a C language Application with bionic and prebuilt using tollchaing, some problems happened.
I am not using "Antroid.mk" style. I am just using exist "Makefile" Environment values and "Autoconf" for the application. Let us suppose the application which I am trying to build is "hellWorld". If I build "helloWorld", there would be libHello.so and HelloWorld binalry files. Then I will use those files. I refered to the web site but it failed. (http://honeypod.blogspot.com/2007/12/shared-library-hello-world-for-android.html) I think that build is success. But when I executed the application, follwing error messages showed. [ERROR MESSAGE] ========================================================================== # ./helloWorld link_image[1838]: 976 could not load needed library 'libHello.so' for './helloWorld' (reloc_library[1245]: 976 cannot locate 'strcpy'...)CANNOT LINK EXECUTABLE # strace ./helloWorld execve("./helloWorld", ["./helloWorld"], [/* 12 vars */]) = 0 syscall_983045(0xb001792c, 0xbeec4d44, 0, 0x84a8, 0xb000f448, 0xbeec4d40, 0x8, 0xf0005, 0, 0, 0, 0, 0, 0xbeec4ce8, 0xb000194b, 0xb000229c, 0x80000010, 0xb001792c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = 0 getpid() = 978 sigaction(SIGILL, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGABRT, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGBUS, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGFPE, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGSEGV, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGSTKFLT, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 sigaction(SIGPIPE, {0xb0001d4d, [], SA_RESTART}, {SIG_DFL}, 0) = 0 stat64("/system/lib/libcrypto.so", {st_mode=S_IFREG|0644, st_size=617972, ...}) = 0 ....... 중략 ........ stat64("/system/lib/libHello.so", {st_mode=S_IFREG|0755, st_size=602586, ...}) = 0 open("/system/lib/libHello.so", O_RDONLY|O_LARGEFILE) = 3 lseek(3, 0, SEEK_SET) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0▒W\0\000"..., 4096) = 4096 lseek(3, -8, SEEK_END) = 602578 read(3, "ockname\0", 8) = 8 mmap2(0x80100000, 135168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x80100000 mmap2(0x80100000, 114324, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x80100000 mprotect(0x80100000, 114688, PROT_READ|PROT_WRITE|PROT_EXEC) = 0 mmap2(0x8011c000, 5636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1b) = 0x8011c000 mmap2(0x8011e000, 11524, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x8011e000 close(3) = 0 munmap(0x80100000, 135168) = 0 write(2, "link_image[1838]: 978 could no"..., 147 link_image[1838]: 978 could not load needed library 'libHello.so' for './helloWorld' (reloc_library[1245]: 978 cannot locate 'strcpy'...)) = 147 write(2, "CANNOT LINK EXECUTABLE\n\0", 24CANNOT LINK EXECUTABLE ) = 24 SYS_248(0xffffffff, 0x38, 0x1000, 0x1, 0xffffffff <unfinished ... exit status 255> # ========================================================================== I guess it is a linker error. Do I make a mistake with compile flag? Compile flags what I used are here. It include basic Android CFLAGS and BUILD_SHARED_LIBRARRY to make shared library and BUILD_EXECUTABLE to make binary. [FLAGS] ========================================================================== ###################################################################################### # LOCAL_CFLAGS ###################################################################################### LOCAL_CFLAGS:= $(subst system,$(ANDROID_HOME)/system,$(TARGET_GLOBAL_CFLAGS)) LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libc/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libc/kernel/common LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libc/kernel/arch-$(TARGET_ARCH) LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libc/arch-$(TARGET_ARCH)/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libm/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libm/include/$(TARGET_ARCH) LOCAL_CFLAGS+= -I$(ANDROID_HOME)/kernel/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/bionic/libstdc++/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/external/libvos/svn/include LOCAL_CFLAGS+= -I$(ANDROID_HOME)/external/sqlite/dist LOCAL_CFLAGS+= -I$(ANDROID_HOME)/external/openssl/include LOCAL_CFLAGS+= -nostdlib LOCAL_CFLAGS+= -Wl,-rpath-link=$(OUT)/system/lib/ ###################################################################################### # LOCAL_LDFLAGS ###################################################################################### LOCAL_LDFLAGS:= $(subst system,$(ANDROID_HOME)/system,$(TARGET_GLOBAL_LDFLAGS)) LOCAL_LDFLAGS+= $(ANDROID_HOME)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a LOCAL_LDFLAGS+= -L$(OUT)/system/lib LOCAL_LDFLAGS+= -lc -lm -lstdc++ -lsqlite -lcrypto ###################################################################################### # BUILD_SHARED_LIBRARRY ###################################################################################### SHARED_LDFLAGS:= -Wl,-T,$(ANDROID_HOME)/build/core/armelf.xsc SHARED_LDFLAGS+= -Wl,-shared,-Bsymbolic ###################################################################################### # BUILD_EXECUTABLE ###################################################################################### EXECUTE_CFLAGS:= -Bdynamic EXECUTE_CFLAGS+= -Wl,-T,${ANDROID_HOME}/build/core/armelf.x EXECUTE_CFLAGS+= -Wl,-dynamic-linker,/system/bin/linker EXECUTE_CFLAGS+= -Wl,--gc-sections -Wl,-z,nocopyreloc EXECUTE_LDFLAGS:= $(OUT)/obj/lib/crtbegin_dynamic.o EXECUTE_LDFLAGS+= $(OUT)/obj/lib/crtend_android.o EXECUTE_LDFLAGS:= -lHello ========================================================================== Thank you. -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting