5

Android 용으로 크로스 컴파일하려고하므로 별도의 툴체인을 사용하고 있습니다. 링커가 찾을 수없는 불평 라이브러리가있다 :링커 클레임 라이브러리를 찾을 수 없습니다. strace가 올바른 경로에 액세스하려고 시도합니다.

arm-eabi-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found 
라이브러리는 확실히이 경로에 존재

:

$ ls -l /mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/libexec/gcc/arm-eabi/4.6.x-google 
total 70053 
-rwxr-xr-x 1 501 dialout 47040814 Oct 3 14:29 cc1 
-rwxr-xr-x 1 501 dialout 50903764 Oct 3 14:29 cc1plus 
-rwxr-xr-x 1 501 dialout 423914 Oct 3 14:29 collect2 
drwxr-xr-x 1 501 dialout  204 Oct 3 14:29 install-tools 
-rwxr-xr-x 1 501 dialout  1090 Oct 3 14:29 libfunction_reordering_plugin.la 
lrwxr-xr-x 1 501 dialout  38 Oct 3 14:29 libfunction_reordering_plugin.so -> libfunction_reordering_plugin.so.0.0.0 
lrwxr-xr-x 1 501 dialout  38 Oct 3 14:29 libfunction_reordering_plugin.so.0 -> libfunction_reordering_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 89427 Oct 3 14:29 libfunction_reordering_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout  994 Oct 3 14:29 liblto_plugin.la 
lrwxr-xr-x 1 501 dialout  22 Oct 3 14:29 liblto_plugin.so -> liblto_plugin.so.0.0.0 
lrwxr-xr-x 1 501 dialout  22 Oct 3 14:29 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 238575 Oct 3 14:29 liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 44647203 Oct 3 14:29 lto1 
-rwxr-xr-x 1 501 dialout 114284 Oct 3 14:29 lto-wrapper 

그래서, 내 컴파일 라인에 내가 "포함 -L을/mnt/hgfs /Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/libexec/gcc/arm-eabi/4.6.x-google "을 입력 한 다음"-lliblto_plugin "을 지정하십시오. ...하지만 여전히이 오류가 계속 발생합니다.

arm-eabi-gcc -o test \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/../android-ndk-r8b-linux/platforms/android-14/arch-arm/usr/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/../ported-deps/jni/libgcrypt/src \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/../ported-deps/jni/libgpg-error/src \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/system/core/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/hardware/libhardware/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/hardware/ril/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/dalvik/libnativehelper/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/frameworks/base/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/external/skia/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/out/target/product/generic/obj/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libc/arch-arm/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libc/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libstdc++/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libc/kernel/common \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libc/kernel/arch-arm \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libm/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libm/include/arch/arm \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libthread_db/include \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libm/arm \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/bionic/libm \ 
-I/mnt/hgfs/Documents/thesis/android-wmon/core/os/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_RELEASE -DNDEBUG \ 
-include /mnt/hgfs/Documents/thesis/android-wmon/core/os/system/core/include/arch/linux-arm/AndroidConfig.h \ 
-UDEBUG -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork \ 
-fpic -fno-exceptions -ffunction-sections -funwind-tables -fstack-protector -fmessage-length=0 \ 
test.c \ 
-Bdynamic -Wl,-T,/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/arm-eabi/lib/ldscripts/armelf.x \ 
-Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc \ 
-Wl,--no-undefined -Wl,-rpath-link=/mnt/hgfs/Documents/thesis/android-wmon/core/os/../android-ndk-r8b-linux/platforms/android-14/arch-arm/usr/lib \ 
-L/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/libexec/gcc/arm-eabi/4.6.x-google \ 
-L/mnt/hgfs/Documents/thesis/android-wmon/core/os/../android-ndk-r8b-linux/platforms/android-14/arch-arm/usr/lib \ 
-nostdlib /mnt/hgfs/Documents/thesis/android-wmon/core/os/../android-ndk-r8b-linux/platforms/android-14/arch-arm/usr/lib/crtend_android.o \ 
/mnt/hgfs/Documents/thesis/android-wmon/core/os/../android-ndk-r8b-linux/platforms/android-14/arch-arm/usr/lib/crtbegin_dynamic.o \ 
/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/lib/gcc/arm-eabi/4.6.x-google/libgcc.a \ 
-lc -lliblto_plugin -lm 
arm-eabi-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found 

편집 :

access("/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory) 
access("/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../libexec/gcc/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory) 
access("/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../lib/gcc/arm-eabi/4.6.x-google/../../../../arm-eabi/bin/arm-eabi/4.6.x-google/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory) 
access("/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../lib/gcc/arm-eabi/4.6.x-google/../../../../arm-eabi/bin/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory) 

: 컴파일과 함께 strace를 실행, 나는 실패 공유 라이브러리를 읽을 수있는 액세스를 참조 여기에

내 전체 라인과 오류입니다 그러나 흥미롭게도 시도한 첫 번째 경로는 실제로 존재하지만 링크입니다 :

$ file /mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/liblto_plugin.so 
/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/liblto_plugin.so: symbolic link to `liblto_plugin.so.0.0.0' 

링크도 유효합니다

$ ls -l /mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/../libexec/gcc/arm-eabi/4.6.x-google/ 
total 70053 
-rwxr-xr-x 1 501 dialout 47040814 Oct 3 14:29 cc1 
-rwxr-xr-x 1 501 dialout 50903764 Oct 3 14:29 cc1plus 
-rwxr-xr-x 1 501 dialout 423914 Oct 3 14:29 collect2 
drwxr-xr-x 1 501 dialout  204 Oct 3 14:29 install-tools 
-rwxr-xr-x 1 501 dialout  1090 Oct 3 14:29 libfunction_reordering_plugin.la 
lrwxr-xr-x 1 501 dialout  38 Oct 3 14:29 libfunction_reordering_plugin.so -> libfunction_reordering_plugin.so.0.0.0 
lrwxr-xr-x 1 501 dialout  38 Oct 3 14:29 libfunction_reordering_plugin.so.0 -> libfunction_reordering_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 89427 Oct 3 14:29 libfunction_reordering_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout  994 Oct 3 14:29 liblto_plugin.la 
lrwxr-xr-x 1 501 dialout  22 Oct 3 14:29 liblto_plugin.so -> liblto_plugin.so.0.0.0 
lrwxr-xr-x 1 501 dialout  22 Oct 3 14:29 liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 238575 Oct 3 14:29 liblto_plugin.so.0.0.0 
-rwxr-xr-x 1 501 dialout 44647203 Oct 3 14:29 lto1 
-rwxr-xr-x 1 501 dialout 114284 Oct 3 14:29 lto-wrapper 

ANOTHER 편집 : 공유 라이브러리를 포함하는 디렉토리에 가서 liblto_plugin.so.0.0.0에 liblto_plugin.so에서 링크를 제거하는 경우 "cp liblto_plugin.so.0.0.0 liblto_plugin.so"그러면 제대로 링크되고 프로그램이 컴파일됩니다. 이 파일이 링크 일 때 왜 깨졌습니까? (죄송합니다, "링크"를 사용하여 두 가지 다른 것들을 여기에서 참조하십시오).

답변

1

내 가상 컴퓨터에서 HGFS를 통해 공유 디렉터리를 사용할 때 버그가 있음이 밝혀졌습니다. 공유 디렉토리의 코드를 원시 파일 시스템으로 가져온다면 빌드 문제가 발생하지 않습니다.

이것은 내게 암시되었습니다. here

+0

위대한 발견. VM에서 사용되는 호스트의 공유 폴더에서 Android NDK와 동일한 문제가 발생했습니다. –

관련 문제