[cfe-dev] Can't compile simple OpenMP code with clang 5.0.0 (original) (raw)
Керим Хемраев via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 22 16:08:44 PST 2020
- Previous message: [cfe-dev] Can't compile simple OpenMP code with clang 5.0.0
- Next message: [cfe-dev] Can't compile simple OpenMP code with clang 5.0.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thank you! The command: $ clang++-10 -fopenmp foo.cxx successfully builds. $ ./a.out thread 1 thread 2 thread 0 thread 3 Now I think we can go back to xeus-cling :)
Среда, 23 декабря 2020, 2:57 +03:00 от Johannes Doerfert <johannesdoerfert at gmail.com>:
clang++-10 -fopenmp foo.cxx (or whatever the clang++ symlink is called) ~ Johannes
On 12/22/20 5:37 PM, Керим Хемраев wrote: The command: $ clang-10 -fopenmp foo.cxx
gives the error output: _/usr/bin/ld: /tmp/foo-e2d536.o: in function
_clangcallterminate':_ _foo.cxx:(.text._clangcallterminate[_clangcallterminate]+0x2): undefined reference to
cxabegincatch' _/usr/bin/ld: foo.cxx:(.text._clangcallterminate[_clangcallterminate]+0xb): undefined reference tostd::terminate()'_ _/usr/bin/ld: /tmp/foo-e2d536.o:(.ehframe+0x4b): undefined reference to
gxxpersonalityv0' clang: error: linker command failed with exit code 1 (use -v to see invocation)Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert < johannesdoerfert at gmail.com >:
I think libomp is still on version 5.0, (I know, I know). It is not coupled to LLVM wrt. version numbers. Last time I checked, LLVM build for debian (and Ububuntu) came bundled with the OpenMP runtimes (for the host). That means you should not need libomp-5-dev but just clang-10. libomp-5-dev is useful if you don't want clang but still target libomp, which is the LLVM OpenMP host runtime, from gcc, thus use it as a replacement of libgomp. All that said, doesn't
clang-10 -fopenmp ...
"just work"? ~ JohannesOn 12/22/20 5:28 PM, Керим Хемраев wrote: Hi Johannes, Thank you for response It seems that I don’t have libthread. Moreover it is highly likely that omp.h and libomp.so that I used to provide as parameters to clang are not shipped with clang 5 :) I think I should now forget about xeus-cling for a while and simply build the code with latest (or any) version of clang with OpenMP. I’ve tried to do the following: $ sudo apt-get install clang-10 $ sudo apt-get install libomp-5-dev Now I want to find where are these packages were installed: $ find /usr -iname clang-10 /usr/lib/llvm-10/bin/clang-10 /usr/lib/cmake/clang-10 /usr/share/doc/clang-10 /usr/share/bash-completion/completions/clang-10 /usr/share/lintian/overrides/clang-10 /usr/bin/clang-10 $ find /usr -iname libomp-10-dev /usr/share/doc/libomp-10-dev So I’m afraid that libomp-10-dev contains only some docs and there is no library libomp-10-dev.so (or something) Could you please guide me how to properly install clang with OpenMP that I could build my test script? I’m on Ubuntu 20.04, x64 $ cat /etc/lsb-release DISTRIBID=Ubuntu DISTRIBRELEASE=20.04 DISTRIBCODENAME=focal DISTRIBDESCRIPTION="Ubuntu 20.04.1 LTS" Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert at gmail.com >:
Hi Kerim, I tried to help below. Looking at xeus-cling I did not immediately see why clang 5 is required. If this doesn't work as described below, I might spend time trying to get it to run with clang 11 ;) On 12/22/20 1:57 PM, Керим Хемраев via cfe-dev wrote: Hi,
I’m struggling with compiling simple OpenMP program with clang 5.0.0. Here is the code (foo.cxx): #include "omp.h" #include <stdio.h> int main ( void ) { #pragma omp parallel printf ( "thread %d \n " , ompgetthreadnum ()); } As I use clang as part of xeus-cling my clang installation is inside conda packages: $ which clang /home/tasik/miniconda3/envs/cling/bin/clang As this clang package does’t have omp.h I provide additional directories to find omp.h and libomp.so To compile the code I use the command: $ clang -fopenmp -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib foo.cxx And I get errors: /usr/bin/ld: cannot find /lib64/libpthread.so.0 /usr/bin/ld: cannot find /usr/lib64/libpthreadnonshared.a clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation) The error basically means clang looks for the libthread libraries and cannot find them. Check on you system where they are and provide the path via -L to clang. That might allow you to proceed. That said, I don't think you are able to mix clang 5 and llvm 10 as you do now. The headers and libraries clang might pick up need to be consistent (with the clang version). At least, you need to make sure
omp.h
andlibomp.so
are the ones shipped with clang 5. ~ JohannesI really need some help to undertand how to work with clang 5.0.0 OpenMP And I think that it is difficult to update clang’s version as xeus-cling requires mentioned 5.0.0 version...
With respect, kerim
cfe-dev mailing list cfe-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev С уважением, Керим Хемраев kerim.khemraev at mail.ru С уважением, Керим Хемраев kerim.khemraev at mail.ru С уважением, Керим Хемраев kerim.khemraev at mail.ru -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201223/acf901b2/attachment-0001.html>
- Previous message: [cfe-dev] Can't compile simple OpenMP code with clang 5.0.0
- Next message: [cfe-dev] Can't compile simple OpenMP code with clang 5.0.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]