Can't compile simple OpenMP code with clang 5.0.0

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
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"omp_get_thread_num());
}
 
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/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
I 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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
Why are you using such an old version of Clang?

Clang the compiler needs to be built with support for parsing OpenMP pragmas.

It’s not just the header and runtime you need to successfully compile with OpenMP

On Dec 22, 2020, at 11:57 AM, Керим Хемраев via cfe-dev <[hidden email]> 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"omp_get_thread_num());
}
 
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/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
I 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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
Another thing:

Clang can be compiled without OpenMP support, which removes the omp.h header, libomp.dylib, and tablegen isn’t even run for OpenMP pragmas.

Your Clang distribution needs to be compiled with OpenMP support for it to work at all.

On Dec 22, 2020, at 12:55 PM, Marcus Johnson <[hidden email]> wrote:


Why are you using such an old version of Clang?

Clang the compiler needs to be built with support for parsing OpenMP pragmas.

It’s not just the header and runtime you need to successfully compile with OpenMP

On Dec 22, 2020, at 11:57 AM, Керим Хемраев via cfe-dev <[hidden email]> 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"omp_get_thread_num());
}
 
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/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
I 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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
How can check if OpenMP is enabled in my clang package?

 
Вторник, 22 декабря 2020, 23:57 +03:00 от Marcus Johnson <[hidden email]>:
 
Another thing:
 
Clang can be compiled without OpenMP support, which removes the omp.h header, libomp.dylib, and tablegen isn’t even run for OpenMP pragmas.
 
Your Clang distribution needs to be compiled with OpenMP support for it to work at all.
 
On Dec 22, 2020, at 12:55 PM, Marcus Johnson <MarcusLJohnson1991@...> wrote:
 
Why are you using such an old version of Clang?
 
Clang the compiler needs to be built with support for parsing OpenMP pragmas.
 
It’s not just the header and runtime you need to successfully compile with OpenMP
 
On Dec 22, 2020, at 11:57 AM, Керим Хемраев via cfe-dev <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"omp_get_thread_num());
}
 
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/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
I 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@...
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
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 " ,  omp_get_thread_num ());
> }
>  
> 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/libpthread_nonshared.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` and `libomp.so` are
the ones shipped with
clang 5.

~ Johannes


>  
> I 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
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
Hi Marcus,

On 12/22/20 2:57 PM, Marcus Johnson via cfe-dev wrote:
> Another thing:
>
> Clang can be compiled without OpenMP support, which removes the omp.h header, libomp.dylib, and tablegen isn’t even run for OpenMP pragmas.
>
> Your Clang distribution needs to be compiled with OpenMP support for it to work at all.

As far as I can tell, LLVM/Clang doesn't have the ability to disable
OpenMP support.
This might have been different in the past, or in some derived
compilers, but I would
assume the clang would have emitted an error upon encountering
`-fopenmp` then.

~ Johannes


>> On Dec 22, 2020, at 12:55 PM, Marcus Johnson <[hidden email]> wrote:
>>
>> 
>> Why are you using such an old version of Clang?
>>
>> Clang the compiler needs to be built with support for parsing OpenMP pragmas.
>>
>> It’s not just the header and runtime you need to successfully compile with OpenMP
>>
>>>> On Dec 22, 2020, at 11:57 AM, Керим Хемраев via cfe-dev <[hidden email]> 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", omp_get_thread_num());
>>> }
>>>  
>>> 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/libpthread_nonshared.a
>>> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>>>  
>>> I 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
>>> [hidden email]
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
I don't know precisely how it works, but I do know for a fact that Apple's clang shipped with Xcode completely strips Clang of all OpenMP stuff

On Dec 22, 2020, at 1:49 PM, Johannes Doerfert <[hidden email]> wrote:

Hi Marcus,

On 12/22/20 2:57 PM, Marcus Johnson via cfe-dev wrote:
Another thing:

Clang can be compiled without OpenMP support, which removes the omp.h header, libomp.dylib, and tablegen isn’t even run for OpenMP pragmas.

Your Clang distribution needs to be compiled with OpenMP support for it to work at all.

As far as I can tell, LLVM/Clang doesn't have the ability to disable OpenMP support.
This might have been different in the past, or in some derived compilers, but I would
assume the clang would have emitted an error upon encountering `-fopenmp` then.

~ Johannes


On Dec 22, 2020, at 12:55 PM, Marcus Johnson <[hidden email]> wrote:


Why are you using such an old version of Clang?

Clang the compiler needs to be built with support for parsing OpenMP pragmas.

It’s not just the header and runtime you need to successfully compile with OpenMP

On Dec 22, 2020, at 11:57 AM, Керим Хемраев via cfe-dev <[hidden email]> 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", omp_get_thread_num());
}
 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/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 I 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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
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
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
 
Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <[hidden email]>:
 
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 " ,  omp_get_thread_num ());
> }
>
> 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/libpthread_nonshared.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` and `libomp.so` are
the ones shipped with
clang 5.

~ Johannes


>
> I 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@...
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
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"?

~ Johannes


On 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
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=20.04
> DISTRIB_CODENAME=focal
> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>    
>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <[hidden email]>:
>>  
>> 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 " ,  omp_get_thread_num ());
>>> }
>>>
>>> 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/libpthread_nonshared.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` and `libomp.so` are
>> the ones shipped with
>> clang 5.
>>
>> ~ Johannes
>>
>>
>>> I 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
>>>   [hidden email]
>>>   https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>  
>  
> С уважением,
> Керим Хемраев
> [hidden email]
>  
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
The command:
$ clang-10 -fopenmp foo.cxx
 
gives the error output:
/usr/bin/ld: /tmp/foo-e2d536.o: in function `__clang_call_terminate':
foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0x2): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0xb): undefined reference to `std::terminate()'
/usr/bin/ld: /tmp/foo-e2d536.o:(.eh_frame+0x4b): undefined reference to `__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 
Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <[hidden email]>:
 
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"?

~ Johannes


On 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
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=20.04
> DISTRIB_CODENAME=focal
> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>
>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> 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 " ,  omp_get_thread_num ());
>>> }
>>>
>>> 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/libpthread_nonshared.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` and `libomp.so` are
>> the ones shipped with
>> clang 5.
>>
>> ~ Johannes
>>
>>
>>> I 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@...
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
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 `__clang_call_terminate':
> foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0x2): undefined reference to `__cxa_begin_catch'
> /usr/bin/ld: foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0xb): undefined reference to `std::terminate()'
> /usr/bin/ld: /tmp/foo-e2d536.o:(.eh_frame+0x4b): undefined reference to `__gxx_personality_v0'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>    
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <[hidden email]>:
>>  
>> 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"?
>>
>> ~ Johannes
>>
>>
>> On 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
>>> DISTRIB_ID=Ubuntu
>>> DISTRIB_RELEASE=20.04
>>> DISTRIB_CODENAME=focal
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < [hidden email] >:
>>>>
>>>> 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 " ,  omp_get_thread_num ());
>>>>> }
>>>>>
>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>> the ones shipped with
>>>> clang 5.
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>>> I 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
>>>>>   [hidden email]
>>>>>   https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>> С уважением,
>>> Керим Хемраев
>>>   [hidden email]
>>>
>  
>  
> С уважением,
> Керим Хемраев
> [hidden email]
>  
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
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 <[hidden email]>:
 
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 `__clang_call_terminate':
> foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0x2): undefined reference to `__cxa_begin_catch'
> /usr/bin/ld: foo.cxx:(.text.__clang_call_terminate[__clang_call_terminate]+0xb): undefined reference to `std::terminate()'
> /usr/bin/ld: /tmp/foo-e2d536.o:(.eh_frame+0x4b): undefined reference to `__gxx_personality_v0'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> 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"?
>>
>> ~ Johannes
>>
>>
>> On 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
>>> DISTRIB_ID=Ubuntu
>>> DISTRIB_RELEASE=20.04
>>> DISTRIB_CODENAME=focal
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>
>>>> 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 " ,  omp_get_thread_num ());
>>>>> }
>>>>>
>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>> the ones shipped with
>>>> clang 5.
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>>> I 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@...
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>> С уважением,
>>> Керим Хемраев
>>> kerim.khemraev@...
>>>
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
It seems I know where is my fault (it is was very obvious) but I can’t understand how can I link external library to clang.
 
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++:
 
$ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
 
gives me error:
clang-5.0: error: no such file or directory: 'libomp.so.5'
 
How to link libomp.so.5 ? Can’t find it in google yet
 
 
Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <[hidden email]>:
 
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"?

~ Johannes


On 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
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=20.04
> DISTRIB_CODENAME=focal
> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>
>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> 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 " ,  omp_get_thread_num ());
>>> }
>>>
>>> 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/libpthread_nonshared.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` and `libomp.so` are
>> the ones shipped with
>> clang 5.
>>
>> ~ Johannes
>>
>>
>>> I 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@...
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
-fopenmp will add the -lomp, which will look for libomp.so in your
library path.

Again, libomp.so versioning is not related to clang versioning.

What is the output of

clang++ -fopenmp foo.cxx



On 12/22/20 7:33 PM, Керим Хемраев wrote:

> It seems I know where is my fault (it
>
>
> using clang 5.0 with libomp.so.5 is probably not going to work.
>
> is was very obvious) but I can’t understand how can I link external library to clang.
>  
> 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++:
>  
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>  
> gives me error:
> clang-5.0: error: no such file or directory: 'libomp.so.5'
>  
> How to link  libomp.so.5  ? Can’t find it in google yet
>  
>    
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <[hidden email]>:
>>  
>> 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"?
>>
>> ~ Johannes
>>
>>
>> On 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
>>> DISTRIB_ID=Ubuntu
>>> DISTRIB_RELEASE=20.04
>>> DISTRIB_CODENAME=focal
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < [hidden email] >:
>>>>
>>>> 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 " ,  omp_get_thread_num ());
>>>>> }
>>>>>
>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>> the ones shipped with
>>>> clang 5.
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>>> I 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
>>>>>   [hidden email]
>>>>>   https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>> С уважением,
>>> Керим Хемраев
>>>   [hidden email]
>>>
>  
>  
> С уважением,
> Керим Хемраев
> [hidden email]
>  
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
$ clang++ -fopenmp foo.cxx
 
gives:
foo.cxx:2:10: fatal error: 'omp.h' file not found
#include "omp.h"
         ^~~~~~~
1 error generated.
 
 
Then I try:
 
$ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
 
this produces the error:
/usr/bin/ld: cannot find -lomp
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
The dir: -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
 
Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert <[hidden email]>:
 
-fopenmp will add the -lomp, which will look for libomp.so in your
library path.

Again, libomp.so versioning is not related to clang versioning.

What is the output of

clang++ -fopenmp foo.cxx



On 12/22/20 7:33 PM, Керим Хемраев wrote:
> It seems I know where is my fault (it

>
>
> using clang 5.0 with libomp.so.5 is probably not going to work.
>
> is was very obvious) but I can’t understand how can I link external library to clang.
>
> 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++:
>
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>
> gives me error:
> clang-5.0: error: no such file or directory: 'libomp.so.5'
>
> How to link  libomp.so.5 ? Can’t find it in google yet
>
>
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> 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"?
>>
>> ~ Johannes
>>
>>
>> On 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
>>> DISTRIB_ID=Ubuntu
>>> DISTRIB_RELEASE=20.04
>>> DISTRIB_CODENAME=focal
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>
>>>> 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 " ,  omp_get_thread_num ());
>>>>> }
>>>>>
>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>> the ones shipped with
>>>> clang 5.
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>>> I 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@...
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>> С уважением,
>>> Керим Хемраев
>>> kerim.khemraev@...
>>>
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
Ok, closer. is there a symlink from libomp.so to libomp.so.5 in
/home/../usr/lib/llvm-10/lib ?
If not, create one. Then try:

clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib



On 12/22/20 8:00 PM, Керим Хемраев wrote:

> $ clang++ -fopenmp foo.cxx
>  
> gives:
> foo.cxx:2:10: fatal error: 'omp.h' file not found
> #include "omp.h"
>           ^~~~~~~
> 1 error generated.
>  
>  
> Then I try:
>  
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
>  
> this produces the error:
> /usr/bin/ld: cannot find -lomp
> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>  
> The dir:  -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
>    
>> Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert <[hidden email]>:
>>  
>> -fopenmp will add the -lomp, which will look for libomp.so in your
>> library path.
>>
>> Again, libomp.so versioning is not related to clang versioning.
>>
>> What is the output of
>>
>> clang++ -fopenmp foo.cxx
>>
>>
>>
>> On 12/22/20 7:33 PM, Керим Хемраев wrote:
>>> It seems I know where is my fault (it
>>>
>>>
>>> using clang 5.0 with libomp.so.5 is probably not going to work.
>>>
>>> is was very obvious) but I can’t understand how can I link external library to clang.
>>>
>>> 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++:
>>>
>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>>>
>>> gives me error:
>>> clang-5.0: error: no such file or directory: 'libomp.so.5'
>>>
>>> How to link  libomp.so.5 ? Can’t find it in google yet
>>>
>>>
>>>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert < [hidden email] >:
>>>>
>>>> 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"?
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>> On 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
>>>>> DISTRIB_ID=Ubuntu
>>>>> DISTRIB_RELEASE=20.04
>>>>> DISTRIB_CODENAME=focal
>>>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>>>
>>>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <  [hidden email] >:
>>>>>>
>>>>>> 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 " ,  omp_get_thread_num ());
>>>>>>> }
>>>>>>>
>>>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>>>> the ones shipped with
>>>>>> clang 5.
>>>>>>
>>>>>> ~ Johannes
>>>>>>
>>>>>>
>>>>>>> I 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
>>>>>>>   [hidden email]
>>>>>>>   https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>> С уважением,
>>>>> Керим Хемраев
>>>>>   [hidden email]
>>>>>
>>>
>>> С уважением,
>>> Керим Хемраев
>>>   [hidden email]
>>>
>  
>  
> С уважением,
> Керим Хемраев
> [hidden email]
>  
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
Yes, it is
 
The command:
 
$ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib
 
gives the error:
/usr/bin/ld: cannot find /lib64/libpthread.so.0
/usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
 
 
Среда, 23 декабря 2020, 5:02 +03:00 от Johannes Doerfert <[hidden email]>:
 
Ok, closer. is there a symlink from libomp.so to libomp.so.5 in
/home/../usr/lib/llvm-10/lib ?
If not, create one. Then try:

clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib



On 12/22/20 8:00 PM, Керим Хемраев wrote:
> $ clang++ -fopenmp foo.cxx

>
> gives:
> foo.cxx:2:10: fatal error: 'omp.h' file not found
> #include "omp.h"
>          ^~~~~~~
> 1 error generated.
>
>
> Then I try:
>
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
>
> this produces the error:
> /usr/bin/ld: cannot find -lomp
> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>
> The dir:  -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
>
>> Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> -fopenmp will add the -lomp, which will look for libomp.so in your
>> library path.
>>
>> Again, libomp.so versioning is not related to clang versioning.
>>
>> What is the output of
>>
>> clang++ -fopenmp foo.cxx
>>
>>
>>
>> On 12/22/20 7:33 PM, Керим Хемраев wrote:
>>> It seems I know where is my fault (it
>>>
>>>
>>> using clang 5.0 with libomp.so.5 is probably not going to work.
>>>
>>> is was very obvious) but I can’t understand how can I link external library to clang.
>>>
>>> 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++:
>>>
>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>>>
>>> gives me error:
>>> clang-5.0: error: no such file or directory: 'libomp.so.5'
>>>
>>> How to link  libomp.so.5 ? Can’t find it in google yet
>>>
>>>
>>>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>
>>>> 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"?
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>> On 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
>>>>> DISTRIB_ID=Ubuntu
>>>>> DISTRIB_RELEASE=20.04
>>>>> DISTRIB_CODENAME=focal
>>>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>>>
>>>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>>>
>>>>>> 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 " ,  omp_get_thread_num ());
>>>>>>> }
>>>>>>>
>>>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>>>> the ones shipped with
>>>>>> clang 5.
>>>>>>
>>>>>> ~ Johannes
>>>>>>
>>>>>>
>>>>>>> I 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@...
>>>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>> С уважением,
>>>>> Керим Хемраев
>>>>> kerim.khemraev@...
>>>>>
>>>
>>> С уважением,
>>> Керим Хемраев
>>> kerim.khemraev@...
>>>
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
Maybe install libpthread-dev?


On 12/22/20 8:07 PM, Керим Хемраев wrote:

> Yes, it is
>  
> The command:
>  
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib
>  
> gives the error:
> /usr/bin/ld: cannot find /lib64/libpthread.so.0
> /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a
> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>  
>  
>    
>> Среда, 23 декабря 2020, 5:02 +03:00 от Johannes Doerfert <[hidden email]>:
>>  
>> Ok, closer. is there a symlink from libomp.so to libomp.so.5 in
>> /home/../usr/lib/llvm-10/lib ?
>> If not, create one. Then try:
>>
>> clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib
>>
>>
>>
>> On 12/22/20 8:00 PM, Керим Хемраев wrote:
>>> $ clang++ -fopenmp foo.cxx
>>>
>>> gives:
>>> foo.cxx:2:10: fatal error: 'omp.h' file not found
>>> #include "omp.h"
>>>           ^~~~~~~
>>> 1 error generated.
>>>
>>>
>>> Then I try:
>>>
>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
>>>
>>> this produces the error:
>>> /usr/bin/ld: cannot find -lomp
>>> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>>>
>>> The dir:  -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
>>>
>>>> Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert < [hidden email] >:
>>>>
>>>> -fopenmp will add the -lomp, which will look for libomp.so in your
>>>> library path.
>>>>
>>>> Again, libomp.so versioning is not related to clang versioning.
>>>>
>>>> What is the output of
>>>>
>>>> clang++ -fopenmp foo.cxx
>>>>
>>>>
>>>>
>>>> On 12/22/20 7:33 PM, Керим Хемраев wrote:
>>>>> It seems I know where is my fault (it
>>>>>
>>>>>
>>>>> using clang 5.0 with libomp.so.5 is probably not going to work.
>>>>>
>>>>> is was very obvious) but I can’t understand how can I link external library to clang.
>>>>>
>>>>> 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++:
>>>>>
>>>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>>>>>
>>>>> gives me error:
>>>>> clang-5.0: error: no such file or directory: 'libomp.so.5'
>>>>>
>>>>> How to link  libomp.so.5 ? Can’t find it in google yet
>>>>>
>>>>>
>>>>>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <  [hidden email] >:
>>>>>>
>>>>>> 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"?
>>>>>>
>>>>>> ~ Johannes
>>>>>>
>>>>>>
>>>>>> On 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
>>>>>>> DISTRIB_ID=Ubuntu
>>>>>>> DISTRIB_RELEASE=20.04
>>>>>>> DISTRIB_CODENAME=focal
>>>>>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>>>>>
>>>>>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert <  [hidden email] >:
>>>>>>>>
>>>>>>>> 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 " ,  omp_get_thread_num ());
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>>>>>> the ones shipped with
>>>>>>>> clang 5.
>>>>>>>>
>>>>>>>> ~ Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>>> I 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
>>>>>>>>>   [hidden email]
>>>>>>>>>   https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>>> С уважением,
>>>>>>> Керим Хемраев
>>>>>>>   [hidden email]
>>>>>>>
>>>>> С уважением,
>>>>> Керим Хемраев
>>>>>   [hidden email]
>>>>>
>>>
>>> С уважением,
>>> Керим Хемраев
>>>   [hidden email]
>>>
>  
>  
> С уважением,
> Керим Хемраев
> [hidden email]
>  
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
Just add  -L/usr/lib/llvm-10/lib to your compilation command. 

Best regards,
Alexey Bataev

22 дек. 2020 г., в 21:00, Керим Хемраев via cfe-dev <[hidden email]> написал(а):


$ clang++ -fopenmp foo.cxx
 
gives:
foo.cxx:2:10: fatal error: 'omp.h' file not found
#include "omp.h"
         ^~~~~~~
1 error generated.
 
 
Then I try:
 
$ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
 
this produces the error:
/usr/bin/ld: cannot find -lomp
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
 
The dir: -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
 
Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert <[hidden email]>:
 
-fopenmp will add the -lomp, which will look for libomp.so in your
library path.

Again, libomp.so versioning is not related to clang versioning.

What is the output of

clang++ -fopenmp foo.cxx



On 12/22/20 7:33 PM, Керим Хемраев wrote:
> It seems I know where is my fault (it
>
>
> using clang 5.0 with libomp.so.5 is probably not going to work.
>
> is was very obvious) but I can’t understand how can I link external library to clang.
>
> 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++:
>
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>
> gives me error:
> clang-5.0: error: no such file or directory: 'libomp.so.5'
>
> How to link  libomp.so.5 ? Can’t find it in google yet
>
>
>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> 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"?
>>
>> ~ Johannes
>>
>>
>> On 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
>>> DISTRIB_ID=Ubuntu
>>> DISTRIB_RELEASE=20.04
>>> DISTRIB_CODENAME=focal
>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>
>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>
>>>> 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 " ,  omp_get_thread_num ());
>>>>> }
>>>>>
>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>> the ones shipped with
>>>> clang 5.
>>>>
>>>> ~ Johannes
>>>>
>>>>
>>>>> I 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@...
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>> С уважением,
>>> Керим Хемраев
>>> kerim.khemraev@...
>>>
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Can't compile simple OpenMP code with clang 5.0.0

shirley breuer via cfe-dev
In reply to this post by shirley breuer via cfe-dev
Thank you very much!
 
I’ve figured out that I have libpthread.so.0 in /usr/lib/x86_64-linux-gnu
 
So I can compile it with command:
$ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib -L/home/../usr/lib/x86_64-linux-gnu
 
Is there a way to change that /usr/bin/ld looks for libpthread.so.0 in /usr/lib/x86_64-linux-gnu instead of /lib64 ?
 
Среда, 23 декабря 2020, 5:13 +03:00 от Johannes Doerfert <[hidden email]>:
 
Maybe install libpthread-dev?


On 12/22/20 8:07 PM, Керим Хемраев wrote:
> Yes, it is

>
> The command:
>
> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib
>
> gives the error:
> /usr/bin/ld: cannot find /lib64/libpthread.so.0
> /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a
> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>
>
>
>> Среда, 23 декабря 2020, 5:02 +03:00 от Johannes Doerfert <johannesdoerfert@...>:
>>
>> Ok, closer. is there a symlink from libomp.so to libomp.so.5 in
>> /home/../usr/lib/llvm-10/lib ?
>> If not, create one. Then try:
>>
>> clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib
>>
>>
>>
>> On 12/22/20 8:00 PM, Керим Хемраев wrote:
>>> $ clang++ -fopenmp foo.cxx
>>>
>>> gives:
>>> foo.cxx:2:10: fatal error: 'omp.h' file not found
>>> #include "omp.h"
>>>          ^~~~~~~
>>> 1 error generated.
>>>
>>>
>>> Then I try:
>>>
>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/
>>>
>>> this produces the error:
>>> /usr/bin/ld: cannot find -lomp
>>> clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
>>>
>>> The dir:  -I/home/../usr/lib/llvm-10/include/openmp/ contains omp.h
>>>
>>>> Среда, 23 декабря 2020, 4:56 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>
>>>> -fopenmp will add the -lomp, which will look for libomp.so in your
>>>> library path.
>>>>
>>>> Again, libomp.so versioning is not related to clang versioning.
>>>>
>>>> What is the output of
>>>>
>>>> clang++ -fopenmp foo.cxx
>>>>
>>>>
>>>>
>>>> On 12/22/20 7:33 PM, Керим Хемраев wrote:
>>>>> It seems I know where is my fault (it
>>>>>
>>>>>
>>>>> using clang 5.0 with libomp.so.5 is probably not going to work.
>>>>>
>>>>> is was very obvious) but I can’t understand how can I link external library to clang.
>>>>>
>>>>> 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++:
>>>>>
>>>>> $ clang++ -fopenmp foo.cxx -I/home/../usr/lib/llvm-10/include/openmp/ -L/home/../usr/lib/llvm-10/lib libomp.so.5
>>>>>
>>>>> gives me error:
>>>>> clang-5.0: error: no such file or directory: 'libomp.so.5'
>>>>>
>>>>> How to link  libomp.so.5 ? Can’t find it in google yet
>>>>>
>>>>>
>>>>>> Среда, 23 декабря 2020, 2:33 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>>>
>>>>>> 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"?
>>>>>>
>>>>>> ~ Johannes
>>>>>>
>>>>>>
>>>>>> On 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
>>>>>>> DISTRIB_ID=Ubuntu
>>>>>>> DISTRIB_RELEASE=20.04
>>>>>>> DISTRIB_CODENAME=focal
>>>>>>> DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
>>>>>>>
>>>>>>>> Среда, 23 декабря 2020, 0:48 +03:00 от Johannes Doerfert < johannesdoerfert@... >:
>>>>>>>>
>>>>>>>> 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 " ,  omp_get_thread_num ());
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> 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/libpthread_nonshared.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` and `libomp.so` are
>>>>>>>> the ones shipped with
>>>>>>>> clang 5.
>>>>>>>>
>>>>>>>> ~ Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>>> I 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@...
>>>>>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>>> С уважением,
>>>>>>> Керим Хемраев
>>>>>>> kerim.khemraev@...
>>>>>>>
>>>>> С уважением,
>>>>> Керим Хемраев
>>>>> kerim.khemraev@...
>>>>>
>>>
>>> С уважением,
>>> Керим Хемраев
>>> kerim.khemraev@...
>>>
>
>
> С уважением,
> Керим Хемраев
> kerim.khemraev@...
>
 
 
С уважением,
Керим Хемраев
[hidden email]
 

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
12