Hello all,<div><br></div><div>I wanna build a static linked executable using llvm. But I failed.</div><div>My question is Can we use -static using llvm?</div><div><br></div><div>Thanks for any response.</div><div><br></div>
<div>Below is details</div><div>========</div><div>First I use </div><div><br></div><div>  $ clang++ test.cc `llvm-config --cxxflags --ldflags --libs` </div><div><br></div><div>I works as usual.  But if I use</div><div><br>
</div><div>  $ clang++ test.cc `llvm-config --cxxflags --ldflags --libs` -static</div><div><br></div><div>It yells lots of undefined reference, like this </div><div><div><br></div><div>/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases':</div>
<div>(.text+0x1a16): undefined reference to `pthread_mutex_unlock'</div><div>/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases':</div><div>(.text+0x61): undefined reference to `pthread_mutex_unlock'</div>
<div>/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases':</div><div>(.text+0xfa): undefined reference to `pthread_mutex_unlock'</div><div>collect2: ld returned 1 exit status</div>
<div>clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)</div></div><div><br></div><div>But in directory <llvm>/lib, I see many libxxx.a.</div><div>I think they just have lots of xxx.o archive.</div>
<div>Why cannot these xxx.o build with -static?</div><div><br></div><div>Thank you.</div><div><br>-- <br>Best regards,<br>Wen-Han (Nowar)<br>
</div>