Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm-linux-gnueabihf-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found #12

Closed
jmattsson opened this issue Feb 4, 2014 · 16 comments

Comments

@jmattsson
Copy link

Hi there,

After the last commit (b49947c) to upgrade the linaro toolchain to 4.8, I'm consistently hitting an error during linking:

$ arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc /tmp/tmp.c -o /tmp/tmp.out
arm-linux-gnueabihf-gcc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
compilation terminated.
$

The liblto_plugin seems to exist:

$ find arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/|grep liblto
arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3/liblto_plugin.so.0.0.0
arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3/liblto_plugin.so.0
$

However, gcc isn't looking for it in the right place - strace shows:

$ strace ./arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc /tmp/tmp.c -o /tmp/tmp.pi 2>&1|grep liblto
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/arm-linux-gnueabihf/4.8.3/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/arm-linux-gnueabihf/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
access("/home/johny/src/MVPSS/linux-buildroot/toolchain_rpi_bcm2708/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/arm-linux-gnueabihf/liblto_plugin.so", R_OK) = -1 ENOENT (No such file or directory)
$

@arron-h
Copy link

arron-h commented Feb 4, 2014

Seems like there's other files missing too like crtbegin.o and crtend.o. Rolling back to previous toolchain for now.

@gadalumo
Copy link

gadalumo commented Feb 5, 2014

Have your rolled it back to the previous version yet?

@arron-h
Copy link

arron-h commented Feb 5, 2014

Yep, compiling fine with HEAD~1

@jlargentaye
Copy link

I've had this issue as well, when trying to compile Xenomai.

Interestingly, I had no issues compiling the Linux kernel with the Linaro toolchain.

The liblto_plugin.so problem was solved by simply creating a symlink.

I don't know how to solve the crtbegin.o problem. It doesn't seem to be in any of the .a files in the Linaro subtree.

@gadalumo
Copy link

gadalumo commented Feb 6, 2014

The crtbegin.o and related files are missing from the latest git repo. You'll need to revert to the older git commit in order to solve the problem for now.

@jlargentaye
Copy link

Thanks, I saw that and did (actually just switched to one of the other toolchains included in this tree). I just wanted to add extra info.

@gadalumo
Copy link

gadalumo commented Feb 6, 2014

:-) . Lets hope they fix this soon.....It took me a lots of hours to figure out their mistake.

@kttran
Copy link

kttran commented Feb 8, 2014

To make it clear, the command to check out a rolled back version of the tools directory, created after the initial 'git clone' command, is:

sudo git checkout HEAD~1

Hope this helps others like me.

@popcornmix
Copy link
Contributor

for me:

find /usr/lib -name "liblto_plugin*"
/usr/lib/gcc/x86_64-linux-gnu/4.8/liblto_plugin.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/liblto_plugin.so.0.0.0
/usr/lib/gcc/x86_64-linux-gnu/4.8/liblto_plugin.so.0

Seems to be provided by cpp-4.8. Can you try:
sudo apt-get install cpp-4.8

@arron-h
Copy link

arron-h commented Feb 14, 2014

@popcornmix As this package is a cross-compile toolchain, using the host's libs would be a bit counterproductive.

@jmattsson
Copy link
Author

@popcornmix if you look at the bug report you'll see that these files are present in the repo, but not in the correct location. The strace shows which paths are searched. Either the files have to move, or the gcc configuration has to be changed to tell gcc where to look for these libs.

Additionally, the liblto_plugin.so symlink to liblto_plugin.so.0 might be missing.

@jlargentaye
Copy link

To followup on popcornmix's suggestion for the sake of being thorough, I have cpp-4.8 installed that provides those files, but that didn't work for me (see my first comment above)

@popcornmix
Copy link
Contributor

Sorry about this. My mistake.
I had *.o and *.so in ~/.gitignore_global so some files were missing from the commit.
I wasn't seeing the issue as the files were present for me locally. Only when a checked out a clean repo did I see the issue.
I've now added the ignored files and it seems to behave better.

@jlargentaye
Copy link

Hah, good catch! The pitfalls of putting binaries in VCS... Thanks for the fix!

@jmattsson
Copy link
Author

I'd say we can safely close this issue now...

majenkotech pushed a commit to UECIDE-Compilers/arm-linux-gnueabihf-gcc that referenced this issue Jun 6, 2016
See: raspberrypi/tools#12

Former-commit-id: 97873a8551d2cce4dac7f2483deff595c07a1622 [formerly 4185745ad3d9a257a2a139ccd39cfa0c63b8b324 [formerly e810a0b88e864dbcdb8c750f65ec454f65c56a3a]]
Former-commit-id: 66a279a225574aa82ac7d6f3e56a77e4415ad382
Former-commit-id: 33b6df0dba85773034bbf0af84683bbc86c72976
@kevinjjames
Copy link

This can also happen when the symbolic links in arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3 is not valid. My tools repo was on an NTFS filesystem which I accessed through Linux. Somehow the links were broken and compilation was failing saying missing liblto.so. Cloned the tools repo again into an ext4 filesystem and things started working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants