LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   compiler fails to link to library that exists, strace shows "no such file" though (https://www.linuxquestions.org/questions/programming-9/compiler-fails-to-link-to-library-that-exists-strace-shows-no-such-file-though-4175430516/)

hedpe 10-04-2012 11:56 AM

compiler fails to link to library that exists, strace shows "no such file" though
 
I am trying to cross-compile something for Android, and to pose this as a general question... during the compile stage it tries to link to a library that it believes does not exist:

Code:

arm-eabi-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
The file does in fact exist, and I am including that in my path:
Code:

-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
Here, I can list the files in that directory:
Code:

$ 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

So what strace shows is:
Code:

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)

However, that first path that it tries IS valid, however it is a link:
Code:

$ 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'

Does anyone know why this would fail if the file does in fact exist? That link is valid.

eSelix 10-04-2012 12:16 PM

Does directory "/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin" exists?

hedpe 10-04-2012 12:18 PM

Quote:

Originally Posted by eSelix (Post 4797277)
Does directory "/mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin" exists?

It does:

Code:

$ ls -l /mnt/hgfs/Documents/thesis/android-wmon/core/os/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
total 10767
-rwxr-xr-x 1 501 dialout  626840 Oct  3 14:29 arm-eabi-addr2line
-rwxr-xr-x 1 501 dialout  655232 Oct  3 14:29 arm-eabi-ar
-rwxr-xr-x 1 501 dialout 1198816 Oct  3 14:29 arm-eabi-as
-rwxr-xr-x 1 501 dialout  332792 Oct  3 14:29 arm-eabi-c++
-rwxr-xr-x 1 501 dialout  622296 Oct  3 14:29 arm-eabi-c++filt
-rwxr-xr-x 1 501 dialout  328696 Oct  3 14:29 arm-eabi-cpp
-rwxr-xr-x 1 501 dialout  27456 Oct  3 14:29 arm-eabi-elfedit
-rwxr-xr-x 1 501 dialout  332792 Oct  3 14:29 arm-eabi-g++
-rwxr-xr-x 1 501 dialout  328696 Oct  3 14:29 arm-eabi-gcc
-rwxr-xr-x 1 501 dialout  328696 Oct  3 14:29 arm-eabi-gcc-4.6.x-google
-rwxr-xr-x 1 501 dialout  105088 Oct  3 14:29 arm-eabi-gcov
-rwxr-xr-x 1 501 dialout 4122744 Oct  3 14:29 arm-eabi-gdb
-rwxr-xr-x 1 501 dialout 4122744 Oct  3 14:29 arm-eabi-gdbtui
-rwxr-xr-x 1 501 dialout  693624 Oct  3 14:29 arm-eabi-gprof
-rwxr-xr-x 1 501 dialout  942848 Oct  3 14:29 arm-eabi-ld
-rwxr-xr-x 1 501 dialout  942848 Oct  3 14:29 arm-eabi-ld.bfd
-rwxr-xr-x 1 501 dialout  635672 Oct  3 14:29 arm-eabi-nm
-rwxr-xr-x 1 501 dialout  806296 Oct  3 14:29 arm-eabi-objcopy
-rwxr-xr-x 1 501 dialout  989784 Oct  3 14:29 arm-eabi-objdump
-rwxr-xr-x 1 501 dialout  655232 Oct  3 14:29 arm-eabi-ranlib
-rwxr-xr-x 1 501 dialout  326904 Oct  3 14:29 arm-eabi-readelf
-rwxr-xr-x 1 501 dialout  854968 Oct  3 14:29 arm-eabi-run
-rwxr-xr-x 1 501 dialout  626744 Oct  3 14:29 arm-eabi-size
-rwxr-xr-x 1 501 dialout  626744 Oct  3 14:29 arm-eabi-strings
-rwxr-xr-x 1 501 dialout  806296 Oct  3 14:29 arm-eabi-strip

Interestingly, if I go in to the directory containing the shared library and remove the link from liblto_plugin.so to liblto_plugin.so.0.0.0 and then "cp liblto_plugin.so.0.0.0 liblto_plugin.so" then it links properly and my program compiles. Why is it broken when this file is a link? (sorry, using "link" to refer to two different things here).

firstfire 10-04-2012 12:59 PM

Hi.

From man access:
Quote:

NOTES:
.....
access() may not work correctly on NFS file systems with UID mapping enabled, because UID mapping is
done on the server and hidden from the client, which checks permissions.
May this be a bug/incompatibility in HGFS similar to the one in NFS?

hedpe 10-04-2012 01:30 PM

Quote:

Originally Posted by firstfire (Post 4797318)
Hi.

From man access:


May this be a bug/incompatibility in HGFS similar to the one in NFS?


hmmm maybe it is, thanks for pointing this out! I might pull my repository off of HGFS and see how it goes.


All times are GMT -5. The time now is 11:52 AM.