<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
Just add <span style="-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(249, 249, 252);"> -L/usr/lib/llvm-10/lib to your compilation command. </span><br>
<br>
<div dir="ltr">Best regards,
<div>Alexey Bataev</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">22 дек. 2020 г., в 21:00, Керим Хемраев via cfe-dev <cfe-dev@lists.llvm.org> написал(а):<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div><strong><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">$ clang++
-fopenmp foo.cxx</span></strong></div>
<div> </div>
<div><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">gives:</span></div>
<div><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><strong>foo.cxx:2:10:
fatal error: 'omp.h' file not found<br>
#include "omp.h"<br>
^~~~~~~<br>
1 error generated.</strong></span></div>
<div> </div>
<div> </div>
<div><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Then
I try:</span></div>
<div> </div>
<div><em><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">$
clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/</span></em></div>
<div> </div>
<div>this produces the error:</div>
<div><strong>/usr/bin/ld: cannot find -lomp<br>
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)</strong></div>
<div> </div>
<div><em><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">The
dir: </span></em><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><strong>-I/home/../usr/lib/llvm-10/include/openmp/</strong>
contains</span><em><span style="color: rgb(51, 51, 51); font-family: Arial, Tahoma, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
omp.h</span></em></div>
<div> </div>
<blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert <johannesdoerfert@gmail.com>:<br>
<div id="">
<div class="js-helper js-readmsg-msg">
<div>
<div id="style_16086886122028359015_BODY">-fopenmp will add the -lomp, which will look for libomp.so in your<br>
library path.<br>
<br>
Again, libomp.so versioning is not related to clang versioning.<br>
<br>
What is the output of<br>
<br>
clang++ -fopenmp foo.cxx<br>
<br>
<br>
<br>
On 12/22/20 7:33 PM, Керим Хемраев wrote:
<div class="mail-quote-collapse">> It seems I know where is my fault (it<br>
><br>
><br>
> using clang 5.0 with libomp.so.5 is probably not going to work.<br>
><br>
> is was very obvious) but I can’t understand how can I link external library to clang.<br>
><br>
> In the folder /home/../usr/lib/llvm-10/lib I have a file called libomp.so.5 (as I understood it is a library of version 5) and I strongly believe that I need to link this library when parsing commands to clang++:<br>
><br>
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5<br>
><br>
> gives me error:<br>
> clang-5.0: error: no such file or directory: 'libomp.so.5'<br>
><br>
> How to link libomp.so.5 ? Can’t find it in google yet<br>
><br>
><br>
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <<a href="/compose?To=johannesdoerfert@gmail.com">johannesdoerfert@gmail.com</a>>:<br>
>><br>
>> I think libomp is still on version 5.0, (I know, I know).<br>
>> It is not coupled to LLVM wrt. version numbers.<br>
>><br>
>> Last time I checked, LLVM build for debian (and Ububuntu)<br>
>> came bundled with the OpenMP runtimes (for the host). That<br>
>> means you should not need libomp-5-dev but just clang-10.<br>
>> libomp-5-dev is useful if you *don't* want clang but still<br>
>> target libomp, which is the LLVM OpenMP host runtime, from<br>
>> gcc, thus use it as a replacement of libgomp.<br>
>><br>
>> All that said, doesn't `clang-10 -fopenmp ...` "just work"?<br>
>><br>
>> ~ Johannes<br>
>><br>
>><br>
>> On 12/22/20 5:28 PM, Керим Хемраев wrote:<br>
>>> Hi Johannes,<br>
>>><br>
>>> Thank you for response<br>
>>><br>
>>> 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 :)<br>
>>><br>
>>> 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.<br>
>>><br>
>>> I’ve tried to do the following:<br>
>>> $ sudo apt-get install clang-10<br>
>>> $ sudo apt-get install libomp-5-dev<br>
>>><br>
>>> Now I want to find where are these packages were installed:<br>
>>> $ find /usr -iname clang-10<br>
>>> /usr/lib/llvm-10/bin/clang-10<br>
>>> /usr/lib/cmake/clang-10<br>
>>> /usr/share/doc/clang-10<br>
>>> /usr/share/bash-completion/completions/clang-10<br>
>>> /usr/share/lintian/overrides/clang-10<br>
>>> /usr/bin/clang-10<br>
>>><br>
>>> $ find /usr -iname libomp-10-dev<br>
>>> /usr/share/doc/libomp-10-dev<br>
>>><br>
>>> So I’m afraid that libomp-10-dev contains only some docs and there is no library libomp-10-dev.so (or something)<br>
>>><br>
>>> Could you please guide me how to properly install clang with OpenMP that I could build my test script?<br>
>>><br>
>>> I’m on Ubuntu 20.04, x64<br>
>>> $ cat /etc/lsb-release<br>
>>> DISTRIB_ID=Ubuntu<br>
>>> DISTRIB_RELEASE=20.04<br>
>>> DISTRIB_CODENAME=focal<br>
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"<br>
>>><br>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < <a href="/compose?To=johannesdoerfert@gmail.com">
johannesdoerfert@gmail.com</a> >:<br>
>>>><br>
>>>> Hi Kerim,<br>
>>>><br>
>>>> I tried to help below. Looking at xeus-cling I did not immediately see<br>
>>>> why clang 5 is<br>
>>>> required. If this doesn't work as described below, I might spend time<br>
>>>> trying to get it<br>
>>>> to run with clang 11 ;)<br>
>>>><br>
>>>> On 12/22/20 1:57 PM, Керим Хемраев via cfe-dev wrote:<br>
>>>>> Hi,<br>
>>>>><br>
>>>>> I’m struggling with compiling simple OpenMP program with clang 5.0.0.<br>
>>>>> Here is the code (foo.cxx):<br>
>>>>><br>
>>>>> #include "omp.h"<br>
>>>>> #include <stdio.h><br>
>>>>> int main ( void ) {<br>
>>>>> #pragma omp parallel<br>
>>>>> printf ( "thread %d \n " , omp_get_thread_num ());<br>
>>>>> }<br>
>>>>><br>
>>>>> As I use clang as part of xeus-cling my clang installation is inside conda packages:<br>
>>>>> $ which clang<br>
>>>>> /home/tasik/miniconda3/envs/cling/bin/clang<br>
>>>>><br>
>>>>> As this clang package does’t have omp.h I provide additional directories to find omp.h and libomp.so<br>
>>>>> To compile the code I use the command:<br>
>>>>> $ clang -fopenmp -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib foo.cxx<br>
>>>>><br>
>>>>> And I get errors:<br>
>>>>> /usr/bin/ld: cannot find /lib64/libpthread.so.0<br>
>>>>> /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a<br>
>>>>> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)<br>
>>>> The error basically means clang looks for the libthread libraries and<br>
>>>> cannot find them.<br>
>>>> Check on you system where they are and provide the path via -L to clang.<br>
>>>> That might allow<br>
>>>> you to proceed. That said, I don't think you are able to mix clang 5 and<br>
>>>> llvm 10 as you<br>
>>>> do now. The headers and libraries clang might pick up need to be<br>
>>>> consistent (with the clang<br>
>>>> version). At least, you need to make sure `omp.h` and `libomp.so` are<br>
>>>> the ones shipped with<br>
>>>> clang 5.<br>
>>>><br>
>>>> ~ Johannes<br>
>>>><br>
>>>><br>
>>>>> I really need some help to undertand how to work with clang 5.0.0 OpenMP<br>
>>>>> And I think that it is difficult to update clang’s version as xeus-cling requires mentioned 5.0.0 version...<br>
>>>>><br>
>>>>><br>
>>>>> With respect,<br>
>>>>> kerim<br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> cfe-dev mailing list<br>
>>>>> <a href="/compose?To=cfe%2ddev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
>>>>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
>>><br>
>>> С уважением,<br>
>>> Керим Хемраев<br>
>>> <a href="/compose?To=kerim.khemraev@mail.ru">kerim.khemraev@mail.ru</a><br>
>>><br>
><br>
><br>
> С уважением,<br>
> Керим Хемраев<br>
> <a href="/compose?To=kerim.khemraev@mail.ru">kerim.khemraev@mail.ru</a><br>
></div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div> </div>
<div data-signature-widget="container">
<div data-signature-widget="content">
<div>С уважением,<br>
Керим Хемраев<br>
kerim.khemraev@mail.ru</div>
</div>
</div>
<div> </div>
</div>
</div>
</blockquote>
</body>
</html>