Hello all, I caught a problem related to pthread library. I built llvm and llvm-gcc then compiling a multithreaded benchmark written in POSIX thread library. The command "llvm-gcc -o bench bench.c -lpthread" ran well while "llvm-gcc -c bench; llvm-ld -o bench bench.o -lpthread" crashed. It told that "llvm-ld: error: Cannot find library 'pthread'". I could not find libpthread.a as well as libpthread.so** in my llvm installation path directory. Did llvm not support pthread? Any suggestions? Best regards, Hanfeng -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110925/9c315f67/attachment.html>
> I could not find libpthread.a as well as libpthread.so** in my llvm > installation path directory. Did llvm not support pthread? Any suggestions?I believe it uses your system pthread library. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667
> Hi chenwj, > If it use system pthread library, then it should find it in the stand search path. I also added the option "-L/usr/lib -L/usr/lib64" but it still failed.Don't know if the link below helps or not, http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-November/027274.html Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667
Hi chenwj, According to the link, I found that during the compiling process, the option "-emit-llvm" must be added to generate immediate object *.o. [hanfeng at os-wstation02 fft]llvm-gcc -c fft.c -emit-llvm Then using llvm-ld will generate two files - a shell excutable and a llvm bytecode data both of which would run perfect. [hanfeng at os-wstation02 fft]llvm-ld -o FFT fft.o [hanfeng at os-wstation02 fft]$ ls FFT FFT.bc fft.c fft.C fft.o Makefile README.fft [hanfeng at os-wstation02 fft]$ lli FFT.bc ... <omit some outputs here, it worked well> ... I guess llvm-ld may not support to generate native executable. However, I am not sure that. Best regards, Hanfeng -----Original Message----- From: 陳韋任 [mailto:chenwj at iis.sinica.edu.tw] Sent: Sunday, September 25, 2011 12:57 To: llvmdev at cs.uiuc.edu Cc: Hanfeng Qin Subject: Re: [LLVMdev] POSIX thread library support> Hi chenwj, > If it use system pthread library, then it should find it in the stand search path. I also added the option "-L/usr/lib -L/usr/lib64" but it still failed.Don't know if the link below helps or not, http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-November/027274.html Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667