llvm-3.7 release and OpenMP

Jeremy Huddleston Sequoia jeremyhu at macports.org
Thu Sep 3 10:23:22 PDT 2015


> On Sep 3, 2015, at 09:21, Jack Howarth <howarth.at.macports at gmail.com> wrote:
> 
>   You really will want to rewrite the llvm37 Portfile to use a cmake
> build.

Not unless we can depend on cmake existing out-of-tree.  If we need to depend on port:cmake, that introduces cycles.

--Jeremy

> The openmp 3.7 can be built in-tree using cmake (with the
> sources placed at projects/openmp. Also the default for -fopenmp is
> still left as -fopenmp=libgomp in 3.7.0 but this can be changed
> with...
> 
> --- cfe-3.7.0.src/CMakeLists.txt.orig 2015-09-02 12:21:32.000000000 -0400
> +++ cfe-3.7.0.src/CMakeLists.txt 2015-09-02 12:21:51.000000000 -0400
> @@ -182,7 +182,7 @@
> set(DEFAULT_SYSROOT "" CACHE PATH
>   "Default <path> to all compiler invocations for --sysroot=<path>." )
> 
> -set(CLANG_DEFAULT_OPENMP_RUNTIME "libgomp" CACHE STRING
> +set(CLANG_DEFAULT_OPENMP_RUNTIME "libomp" CACHE STRING
>   "Default OpenMP runtime used by -fopenmp.")
> 
> set(CLANG_VENDOR "" CACHE STRING
> 
> In fink, we set the explicit location of the buried libomp.dylib with...
> 
> --- cfe-3.7.0.src/lib/Driver/Tools.cpp.orig     2015-07-02
> 09:10:45.000000000 -0400
> +++ cfe-3.7.0.src/lib/Driver/Tools.cpp  2015-07-03 21:43:42.000000000 -0400
> @@ -6368,12 +6368,18 @@
>                    options::OPT_fno_openmp, false)) {
>     switch (getOpenMPRuntime(getToolChain(), Args)) {
>     case OMPRT_OMP:
> +      // Help clang find libomp.dylib
> +      CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>       CmdArgs.push_back("-lomp");
>       break;
>     case OMPRT_GOMP:
> +      // Help clang find libgomp.dylib
> +      CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>       CmdArgs.push_back("-lgomp");
>       break;
>     case OMPRT_IOMP5:
> +      // Help clang find libiomp5.dylib
> +      CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>       CmdArgs.push_back("-liomp5");
>       break;
>     case OMPRT_Unknown:
> @@ -8079,9 +8085,13 @@
>         // Also link the particular OpenMP runtimes.
>         switch (getOpenMPRuntime(ToolChain, Args)) {
>         case OMPRT_OMP:
> +         // Help clang find libomp.dylib
> +         CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>           CmdArgs.push_back("-lomp");
>           break;
>         case OMPRT_GOMP:
> +          // Help clang find libgomp.dylib
> +          CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>           CmdArgs.push_back("-lgomp");
> 
>           // FIXME: Exclude this for platforms with libgomp that don't require
> @@ -8089,6 +8099,8 @@
>           CmdArgs.push_back("-lrt");
>           break;
>         case OMPRT_IOMP5:
> +         // Help clang find libiomp5.dylib
> +         CmdArgs.push_back("-L at FINK_PREFIX@/opt/llvm- at BRV@/lib");
>           CmdArgs.push_back("-liomp5");
>           break;
>         case OMPRT_Unknown:
> 
> to produce -L/sw/opt/llvm-3.7/lib on the linkage. Lastly, to build the
> fat binary of libomp,
> you need to pass cmake the flag -DLIBOMP_OSX_ARCHITECTURES="x86_64;i386".
>               Jack
> ps Note that the perl-based Makefile build is no longer functional in
> 3.7.0 and is in the process of being completely removed for the 3.8.0
> release.
> 
> On Wed, Sep 2, 2015 at 9:59 PM, Jeremy Huddleston Sequoia
> <jeremyhu at macports.org> wrote:
>> Looks good to me.  Could you go ahead and push this to svn and also do similar changes to the llvm-3.8 port for your openmp variant?
>> 
>> Thanks,
>> Jeremy
>> 
>>> On Sep 2, 2015, at 15:34, Eric A. Borisch <eborisch at macports.org> wrote:
>>> 
>>> Would have done a ticket, but with trac down....
>>> 
>>> Attached is a patch to update to the released llvm/clang-3.7 (this comments out the svn fetch code, removes the default +assertions, and adds checksums)
>>> 
>>> As OpenMP is one of the much discussed items that llvm-3.7 brings to the table, I've added a +openmp variant to clang-3.7. This variants pulls in port:libomp and sets up clang such that "-fopenmp" will use it by default. This makes it much more likely for tools like autoconf to detect OpenMP support. (Without the variant, openmp support is still there, but it requires -fopenmp=libomp, which isn't in the set of standard "can we do OpenMP" flags.) If people are supportive of it, I would suggest making it a default variant.
>>> 
>>> Note that -I/opt/local/include and -L/opt/local/lib (assuming standard MacPorts install location) are required with -fopenmp for things to work and not complain about missing omp.h or -lomp.
>>> 
>>> If there is someone more familiar with clang/llvm building (of the tools themselves), it might be interesting to consider baking in those -I/-L flags (or move the libomp include/lib install directories so they only have omp.h and the libomp*.dylib files and using those) so -fopenmp would "just work." (Without the extra -I and -L)... Let me know if there is interest and I can rework the libomp port to support this.
>>> 
>>> Thanks,
>>>  - Eric
>>> <llvm-3.7.patch>
>> 
>> _______________________________________________
>> macports-dev mailing list
>> macports-dev at lists.macosforge.org
>> https://lists.macosforge.org/mailman/listinfo/macports-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4118 bytes
Desc: not available
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20150903/149c3d9e/attachment-0001.p7s>


More information about the macports-dev mailing list