compiler-explorer icon indicating copy to clipboard operation
compiler-explorer copied to clipboard

[BUG]: "x86-64 clang (experimental P1144)" can't find libc++.so.1

Open Quuxplusone opened this issue 4 years ago • 3 comments

Describe the bug

The P1144 "Trivially Relocatable" compiler (a.k.a. clang_relocatable, relocatable_trunk) can compile and link programs, but when you try to "Execute the code", the dynamic linker can't locate libc++.so.1, so you can't actually run the program on CE.

This is probably just a matter of needing to set some LD_LIBRARY_PATH environment variable somewhere in the infrastructure for the P1144 compiler; I just don't know where to look for that.

Steps to reproduce

https://godbolt.org/z/e3vz7Y3sf

ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 127
./output.s: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory

Expected behavior

The program should not only link, but also run (and print "hello world").

Reproduction link

https://godbolt.org/z/e3vz7Y3sf

Screenshots

Not applicable

Operating System

No response

Browser version

No response

Quuxplusone avatar Jan 06 '22 16:01 Quuxplusone

Also worth noting that this seems to affect clang 13.0.0 as well when using -stdlib=libc++.

Clang versions <= 12.0.1 seem to work fine w/ -stdlib=libc++. Curiously, trunk also seems to work as of this moment.

jharmer95 avatar Jan 12 '22 16:01 jharmer95

Also worth noting that this seems to affect clang 13.0.0 as well when using -stdlib=libc++.

Clang versions <= 12.0.1 seem to work fine w/ -stdlib=libc++. Curiously, trunk also seems to work as of this moment.

Interesting; I have always had the impression that -stdlib=libc++ failed with every Clang except trunk, and I had assumed that this was simply because CE's maintainers did something extra special with Clang trunk because it was important, and simply didn't do that special thing for random other compilers (including older Clangs). If you're observing that -stdlib=libc++ works with older Clangs, then either my impression was wrong, or something's changed in the probably-several-years since I formed that impression. :)

Anyhoo, yeah, it would be awesome if -stdlib=libc++ Just Worked for all Clangs, including-but-especially P1144.

Quuxplusone avatar Jan 12 '22 18:01 Quuxplusone

Also worth noting that this seems to affect clang 13.0.0 as well when using -stdlib=libc++.

Clang versions <= 12.0.1 seem to work fine w/ -stdlib=libc++. Curiously, trunk also seems to work as of this moment.

Good to know, thanks, we'll look into it

partouf avatar Jan 12 '22 18:01 partouf