<div dir="ltr"><div><span style="font-size:12.8px">Try removing "</span><span style="font-size:12.8px">/path/to/musl/lib/ld-musl-x86_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">64.so.1" from the invocation and see if that helps:</span></div><span style="font-size:12.8px"><div><span style="font-size:12.8px"><br></span></div>$ LD_LIBRARY_PATH=/path/to/musl/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">lib /path/to/musl/lib/ld-musl-x86_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">64.so.1 /path/to/llvm/bin/clang -v</span><br><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">because the shell thinks you want to run "</span><span style="font-size:12.8px">"</span><span style="font-size:12.8px">/path/to/musl/lib/ld-musl-x86_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">64.so.1" not "</span><span style="font-size:12.8px">/path/to/llvm/bin/clang"</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">hth...</span></div><div><span style="font-size:12.8px">don</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 9, 2016 at 1:42 AM, Dmitry Golovin via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have managed to compile llvm and clang against musl, but it behaves really strange:<br>
<br>
At first I tried to launch the compiler with musl dynamic loader:<br>
<br>
    $ LD_LIBRARY_PATH=/path/to/musl/<wbr>lib /path/to/musl/lib/ld-musl-x86_<wbr>64.so.1 /path/to/llvm/bin/clang -v<br>
    clang version 4.0.0 (<a href="https://github.com/llvm-mirror/clang" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/clang</a> 40adebeca0f99006d407508653c2cb<wbr>d270a1a51c) (<a href="https://github.com/llvm-mirror/llvm" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/llvm</a> 943496ffc4e7cb9d7dd6f5119325a7<wbr>583e2cc31f)<br>
    Target: x86_64-pc-linux-musl<br>
    Thread model: posix<br>
    InstalledDir: /path/to/llvm/bin<br>
<br>
It worked, but couldn't compile binaries:<br>
<br>
    $ LD_LIBRARY_PATH=/path/to/musl/<wbr>lib /path/to/musl/lib/ld-musl-x86_<wbr>64.so.1 /path/to/llvm/bin/clang -v -c hello.c<br>
    clang version 4.0.0 (<a href="https://github.com/llvm-mirror/clang" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/clang</a> 40adebeca0f99006d407508653c2cb<wbr>d270a1a51c) (<a href="https://github.com/llvm-mirror/llvm" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/llvm</a> 943496ffc4e7cb9d7dd6f5119325a7<wbr>583e2cc31f)<br>
    Target: x86_64-pc-linux-musl<br>
    Thread model: posix<br>
    InstalledDir: /path/to/llvm/bin<br>
     "/path/to/musl/lib/ld-musl-<wbr>x86_64.so.1" -cc1 -triple x86_64-pc-linux-musl -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /path/to/hello/hello.gcno -resource-dir /path/to/musl/lib/clang/4.0.0 -isysroot /path/to/musl -internal-isystem /path/to/musl/usr/local/<wbr>include -internal-isystem /path/to/musl/lib/clang/4.0.0/<wbr>include -internal-externc-isystem /path/to/musl/include -internal-externc-isystem /path/to/musl/usr/include -fdebug-compilation-dir /path/to/hello -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -o hello.o -x c hello.c<br>
    /path/to/musl/lib/ld-musl-x86_<wbr>64.so.1: cannot load -cc1: No such file or directory<br>
<br>
As you can see it is trying to execute a compilation command with omitted clang binary path.<br>
<br>
So I thought that it would work in chroot with nothing but musl and clang in it. So I chrooted to a newly created directory, put musl and clang in it, and it still didn't work:<br>
<br>
    (chroot)$ clang -v -I/include -c hello.c<br>
    clang version 4.0.0 (<a href="https://github.com/llvm-mirror/clang" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/clang</a> 40adebeca0f99006d407508653c2cb<wbr>d270a1a51c) (<a href="https://github.com/llvm-mirror/llvm" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/llvm</a> 943496ffc4e7cb9d7dd6f5119325a7<wbr>583e2cc31f)<br>
    Target: x86_64-pc-linux-musl<br>
    Thread model: posix<br>
    InstalledDir: /bin<br>
     "" -cc1 -triple x86_64-pc-linux-musl -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /hello/hello.gcno -resource-dir ../lib/clang/4.0.0 -I /include -isysroot /path/to/musl -internal-isystem /path/to/musl/usr/local/<wbr>include -internal-isystem ../lib/clang/4.0.0/include -internal-externc-isystem /path/to/musl/include -internal-externc-isystem /path/to/musl/usr/include -fdebug-compilation-dir /hello -ferror-limit 19 -fmessage-length 139 -fobjc-runtime=gcc -fdiagnostics-show-option -o hello.o -x c hello.c<br>
    error: unable to execute command: Executable "" doesn't exist!<br>
<br>
So it still doesn't launch clang as it should. But if I just copy and paste the produced line replacing `""` with `clang` it works and produces fine object file.<br>
<br>
What else can I try to make it work? Does clang have public bugzilla?<br>
<br>
Where can I send my musl support patches?<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>