2012-04-22 9 views
1

저는 debian/amd64에 있는데 NDK-7b를 사용하여 안드로이드 2.2 용 GMP를 크로스 컴파일하고 싶습니다. [gmplib] (hg clone http://gmplib.org:8000/gmp-5.0 gmp)에서 소스 코드를 가져 왔습니다.android GMP cross compilation

SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune 

그것은 것 : 메이크 파일에 다음과 같이 나는 SUBDIRS 매개 변수를 업데이트

/* Define to 1 if you have the `obstack_vprintf' function. */ 
#ifndef ANDROID 
#define HAVE_OBSTACK_VPRINTF 1 
#endif 
/* Define to 1 if you have the `localeconv' function. */ 
#ifndef ANDROID 
#define HAVE_LOCALECONV 1 
#endif 
/* Define to 1 if you have the `vsnprintf' function and it works properly. */ 
#ifndef ANDROID 
#define HAVE_VSNPRINTF 1 
#endif 

: 내가 설정하여 파일 config.h 파일을 수정

./configure --enable-shared --host=arm-linux-androideabi --prefix=/home/fabien/android/spica/ndk-standalone-8 CFLAGS="-v -march=armv5te -mtune=xscale -msoft-float -Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables -fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nodefaultlibs -fPIC -shared -Wl,--no-allow-shlib-undefined" PKG_CONFIG_PATH="/home/fabien/android/spica/ndk-standalone-8/lib/pkgconfig" LDFLAGS="-Wl,-rpath-link -Wl,/home/fabien/android/spica/ndk-standalone-8/lib -L/home/fabien/android/spica/ndk-standalone-8/lib" 

: 나는 그것을 구성 make를 실행하면 컴파일됩니다.

libtool: link: (cd ".libs" && rm -f "libgmp.so" && ln -s "libgmp.so.10.0.5" "libgmp.so") 
libtool: link: (cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la") 

하지만 "확인"을 실행하면 링커가 손실 된 것처럼 보입니다.

/../../../../arm-linux-androideabi/bin/ld: warning: ld-linux.so.3, needed by /home/fabien/android/spica/sources/gmp/.libs/libgmp.so, not found (try using -rpath or -rpath-link) 
t-bswap.o:(.ARM.exidx.text.main+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' 
./.libs/libtests.a(misc.o):(.ARM.exidx.text.align_pointer+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' 
. 
. 
. 
refmpn.c:(.text.refmpn_get_str+0xb8): undefined reference to `__aeabi_uidiv' 
refmpn.c:(.text.refmpn_get_str+0x238): undefined reference to `__aeabi_ui2d' 
refmpn.c:(.text.refmpn_get_str+0x250): undefined reference to `__aeabi_dmul' 
refmpn.c:(.text.refmpn_get_str+0x254): undefined reference to `__aeabi_d2uiz' 
./.libs/libtests.a(refmpn.o):(.ARM.exidx.text.refmpn_get_str+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' 
/home/fabien/android/spica/sources/gmp/.libs/libgmp.so: undefined reference to `[email protected]_2.4' 
/home/fabien/android/spica/sources/gmp/.libs/libgmp.so: undefined reference to `[email protected]_2.4' 

힌트 :

+0

Fabien R, 편집 방법을 정확히 알아 냈습니까? 안드로이드 용 GMP도 컴파일하려고하지만 성공하지 못했습니다. 귀하의 절차가 무엇인지 기억합니까? –

+0

@NicoBellic : 아니요. 아마도 최신 NDK로 운이 좋을 것입니다. –

답변

2

이 오류는 링커가 대상을 만들 때 이러한 도우미 함수 (GCC 도우미 함수)가 포함 된 파일이 포함되어 있지 않기 때문에 발생합니다. 이 문제를 해결하려면 링커 플래그에 libgcc.a (GCC 헬퍼 함수 정의가 포함되어 있음)을 추가하십시오. GCC 버전이 팔 - 리눅스 - androideabi-4.4.3, 그것은 것입니다 가정 libgcc.o로의 위치에 관해서는

, $NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a

하지하는 것 다음과 같은 오류가 (관련이있는 것으로 해결됩니다 인 실종의 libc는 GNU)에 : 안드로이드는

참고과 libc는 GNU를 슈퍼맨의 libc를 사용하지으로

.libs/libgmp.so: undefined reference to `[email protected]_2.4' 
.libs/libgmp.so: undefined reference to `[email protected]_2.4' 

위의 두 오류는 항상 표시됩니다 :이를 나에게 thod는 Android뿐 아니라 모든 시스템에서 유사한 문제를 해결할 것입니다.

+2

나는이 [post] (http://stackoverflow.com/questions/5919710/about-arm-eabi-gcc-and-cross-compiling)를 보았다. NDK 독립형 컴파일러를 사용하고 있으므로 "-nostdlib "-L/home/fabien/android/spica/ndk-standalone-8/lib/gcc/arm-linux-androideabi/4.4.3"에서 LDFLAGS 및 LIBS = "- lgcc -lm -ldl -lc ". 하지만이 출력을 얻었습니다 : arm-linux-androideabi/bin/ld : warning : libm.so.6, ... gmp/.libs/libgmp.so가 필요합니다. 링커가 ld-linux.so.3 및 libgcc_s.so.1을 찾지 못했습니다. 또한, 나는이 메시지를 얻었습니다 : ld : warning : 엔트리 심볼을 찾을 수 없습니다 _start; 기본값은 000096입니다. –

+1

시작 심볼은 대상이 실행 파일 또는 라이브러리 인 지에 따라 다음 파일 중 하나에서 가져옵니다. crtbegin_dynamic.o (동적 링크 실행), crtbegin_static.o (실행 가능 정적 링크), crtbegin_so.o (동적 라이브러리). 올바른 객체의 경로를 LD에 입력하고 _start 심볼 오류를 정렬해야합니다 – Samveen

+1

-nostdlib를 -nodefaultlibs로 대체하여 _start 심볼에 대한 오류를 해결했습니다. 그러나 링커는 "make check"를 시작할 때 여전히 손실 된 것처럼 보입니다. configure는 그것을 GNU 호환으로 인식합니다. –