[cfe-dev] Can't compile simple OpenMP code with clang 5.0.0
Marcus Johnson via cfe-dev
cfe-dev at lists.llvm.org
Tue Dec 22 14:10:53 PST 2020
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 <johannesdoerfert at gmail.com> 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 <MarcusLJohnson1991 at gmail.com> 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 at lists.llvm.org> 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 at lists.llvm.org
>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201222/e4ae2836/attachment-0001.html>
More information about the cfe-dev
mailing list