llvm-clang needed for gromacs-2016-1
Jack Howarth <[email protected]>
| Newsgroups | gmane.os.apple.fink.devel |
|---|---|
| Message-ID | <CAP5Ds0BVRydNqzf0AMJp3DaAgUxLFiF4p6R6WYLurUqoE+GU7w@mail.gmail.com> |
Hanspeter,
It has been a couple of weeks now since I emailed David Fang
about the update to the llvm39 package to add the proposed llvm-clang,
libomp-dev and libomp-shlibs split-offs required to cleanly support
packages like the gromacs/gromacs-mpi-2016-1 updates which require a
clang that supports -fopenmp without tethering the package to a
specific llvmXY release. The proposed changes are quite sensible,
straight-forward and safe...
https://sourceforge.net/p/fink/package-submissions/4831/
https://sourceforge.net/p/fink/package-submissions/4827/
Index: llvm39.info
===================================================================
RCS file: /cvsroot/fink/dists/10.9-libcxx/stable/main/finkinfo/languages/llvm39.info,v
retrieving revision 1.2
diff -u -r1.2 llvm39.info
--- llvm39.info 27 Oct 2016 04:01:28 -0000 1.2
+++ llvm39.info 13 Nov 2016 18:26:26 -0000
@@ -1,7 +1,7 @@
Info3: <<
Package: llvm39
Version: 3.9.0
-Revision: 1
+Revision: 2
Description: Modular and reusable compiler
License: BSD
Maintainer: David Fang <[email protected]>
@@ -54,8 +54,8 @@
PatchFile: %n.patch
PatchFile-MD5: 6addcbd4c9fe449b3cd006eb48f5219b
-#PatchFile2: %n-clang.patch
-#PatchFile2-MD5: d2a2b4207c19b7f09f197ae9769a51d2
+PatchFile2: %n-clang.patch
+PatchFile2-MD5: 25a45c309e14611b278c30b782f0d7e5
#PatchFile3: %n-compiler-rt.patch
#PatchFile3-MD5: 60ed1415e15b1781f2d58c0db17aab78
#PatchFile4: %n-polly.patch
@@ -65,7 +65,7 @@
#PatchFile6: %n-clang-omp.patch
#PatchFile6-MD5: 8067f4cc1f58030f7746521d58c776c2
PatchFile7: %n-clang-iomp5.patch
-PatchFile7-MD5: 33f21b006473cbdd5feced616b05903b
+PatchFile7-MD5: d5d9686fd0727c0e1cd953f585f4481d
PatchScript: <<
#!/bin/sh -ev
@@ -108,7 +108,7 @@
pushd tools/clang
# Apply clang-omp merge before clang patch
#$patch_filter %{PatchFile6} | patch -p1
- #$patch_filter %{PatchFile2} | patch -p1
+ $patch_filter %{PatchFile2} | patch -p1
$patch_filter %{PatchFile7} | patch -p1
popd
pushd tools/polly
@@ -1078,15 +1078,6 @@
iprefix=%i/$stem
prefix=%p/$stem
- # Pass path to libLTO.dylib with -lto_library using ld shell script
- pushd $iprefix/bin
- cat <<EOF > ./ld
-#!/bin/sh
-exec /usr/bin/ld -lto_library %p/opt/llvm-3.9/lib/libLTO.dylib "\$@"
-EOF
- chmod ugo+x ./ld
- popd
-
# convenient clang symlinks
mkdir -p %i/bin
pushd %i/bin
@@ -1112,6 +1103,26 @@
cp %b/../build/last/*-check.log testlogs/
cp %b/../build/last-libcxx/*-check.log testlogs/
popd
+
+# place omp.h in %p/include/libomp for common libomp-dev package
+ install -d %i/include/libomp
+ pushd %i/opt/llvm-$brv/lib/clang/%v/include
+ mv omp.h %i/include/libomp
+ popd
+
+# place libomp.dylib in libomp subdirectory for common libomp-shlibs package
+# leave legacy copy in %p/opt/llvm-$brv/lib for clang39-shlibs
+ install -d %i/lib/libomp
+ pushd %i/opt/llvm-$brv/lib
+ cp libomp.dylib %i/lib/libomp
+ ln -s libomp.dylib %i/lib/libomp/libiomp5.dylib
+ ln -s libomp.dylib %i/lib/libomp/libgomp.dylib
+ popd
+ install_name_tool -id %p/lib/libomp/libomp.dylib %i/lib/libomp/libomp.dylib
+
+# create compiler symlinks for common llvm-clang split-off
+ ln -s clang-$brv %i/bin/llvm-clang
+ ln -s clang++-$brv %i/bin/llvm-clang++
<<
SplitOff: <<
Package: clang39-tools
@@ -1178,7 +1189,9 @@
# odcctools,
# choosing to require opt-in instead of defaulting to libcxx1-dev
# libcxx1-dev,
+ libomp-dev (>= %v-%r),
clang39-shlibs (= %v-%r),
+ libomp-shlibs (>= %v-%r),
polly39-shlibs (= %v-%r)
<<
Description: Executables and runtime for clang compiler
@@ -1186,7 +1199,6 @@
Files: <<
bin/clang*
opt/llvm-3.9/bin/clang*
- opt/llvm-3.9/bin/ld
opt/llvm-3.9/lib/clang
<<
DescUsage: <<
@@ -1313,6 +1325,37 @@
<<
<<
SplitOff14: <<
+ Package: libomp-shlibs
+ Description: Standard library for libomp
+ Files: <<
+ (%m != powerpc) lib//libomp/lib*omp*.dylib
+ <<
+ DocFiles: <<
+ projects/openmp/CREDITS.txt
+ projects/openmp/LICENSE.txt
+ <<
+ Shlibs: <<
+ (%m != powerpc) %p/lib/libomp/libomp.dylib 5.0.0 %n (>= 3.9.0-2)
+ <<
+<<
+SplitOff15: <<
+ Package: libomp-dev
+ Description: Standard library header for libomp
+ Depends: libomp-shlibs (= %v-%r)
+ BuildDependsOnly: false
+ Files: include/libomp/omp.h
+ DescPackaging: <<
+ BuildDependsOnly set to false since clang compiler always needs
+ access to omp.h at run-time.
+ <<
+<<
+SplitOff16: <<
+ Package: llvm-clang
+ Description: LLVM.org clang compilers
+ Depends: clang39 (= %v-%r)
+ Files: bin/llvm-clang bin/llvm-clang++
+<<
+SplitOff17: <<
Package: %N-bundle
Description: Bundle of LLVM/Clang compiler tools
Type: bundle
I would also point out that David left the details of the openmp
support in the llvmXY packaging up to me since I was working with the
upstream developers to make sure the openmp support on darwin had no
regressions compared to linux.
Please go ahead and commit the attached packaging files into the
10.9-libc++ tree so we can have the current version of gromacs and
gromacs-mpi. Thanks in advance.
Jack
ps This refactoring of llvm39 is *extremely* useful to other fink
package maintainers as it simplifies their task of building against a
-fopenmp-savvy clang to just adding a
BuildDepends: llvm-clang, libomp-dev
Depends: libomp-shlibs
which will result in the llvm-clang split-off from the most recent
llvmXY package being used. It also fully decouples the libomp.dylib
and omp.h dependencies from a specific llvmXY package.
pos The deprecation of the ld script again is now allowed by the back
port of the llvm 4.0 changes to clang in llvm39-clang.patch which
cause the compiler to automatically emit -lto_library for the linkage
with the correct path to the libLTO.dylib bundled with the specific
llvmXY release.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Fink-devel mailing list
[email protected]
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel
llvm39.info
(application/octet-stream, 47.9 KB) - not displayed
llvm39.patch
(application/octet-stream, 2.8 KB)
diff -uNr llvm-3.9.0.src.orig/cmake/config-ix.cmake llvm-3.9.0.src/cmake/config-ix.cmake
--- llvm-3.9.0.src.orig/cmake/config-ix.cmake 2015-09-21 08:59:14.000000000 -0400
+++ llvm-3.9.0.src/cmake/config-ix.cmake 2015-09-21 09:42:08.000000000 -0400
@@ -323,6 +323,12 @@
set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING
"Host on which LLVM binaries will run")
+if( APPLE )
+get_host_osx_version(LLVM_INFERRED_OSX_VERSION)
+set(LLVM_HOST_OSX_VERSION "${LLVM_INFERRED_OSX_VERSION}" CACHE STRING
+ "Host version of Mac OS X")
+endif( APPLE )
+
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
if( LLVM_NATIVE_ARCH STREQUAL "host" )
diff -uNr llvm-3.9.0.src.orig/cmake/modules/GetHostTriple.cmake llvm-3.9.0.src/cmake/modules/GetHostTriple.cmake
--- llvm-3.9.0.src.orig/cmake/modules/GetHostTriple.cmake 2015-07-04 14:35:51.000000000 -0400
+++ llvm-3.9.0.src/cmake/modules/GetHostTriple.cmake 2015-09-21 09:42:08.000000000 -0400
@@ -28,3 +28,15 @@
set( ${var} ${value} PARENT_SCOPE )
message(STATUS "Target triple: ${value}")
endfunction( get_host_triple var )
+
+# Mac OS X only: get the host version
+function( get_host_osx_version var )
+ if( APPLE )
+ execute_process(COMMAND sw_vers -productVersion COMMAND cut -d. -f1-2
+ RESULT_VARIABLE TT_RV
+ OUTPUT_VARIABLE value
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set( ${var} ${value} PARENT_SCOPE )
+ message(STATUS "Host OS X version: ${value}")
+ endif ( APPLE )
+endfunction( get_host_osx_version var )
diff -uNr llvm-3.9.0.src.orig/utils/lit/lit/TestRunner.py llvm-3.9.0.src/utils/lit/lit/TestRunner.py
--- llvm-3.9.0.src.orig/utils/lit/lit/TestRunner.py 2015-09-21 08:56:28.000000000 -0400
+++ llvm-3.9.0.src/utils/lit/lit/TestRunner.py 2015-09-21 09:42:08.000000000 -0400
@@ -484,11 +484,16 @@
return str(line_number - int(match.group(2)))
ln = re.sub('%\(line *([\+-]) *(\d+)\)', replace_line_number, ln)
+ ln1 = ln.split(' ')[1];
# Collapse lines with trailing '\\'.
if script and script[-1][-1] == '\\':
script[-1] = script[-1][:-1] + ln
- else:
+ # do not commit this patch
+ # exception: built-in shell commands and operators
+ elif ln[1] == '(' or ln[1] == '{' or ln[1] == '!' or ln[1] == '|' or ln1 == 'export' or ln1 == 'env' or ln1 == 'cd' or ln1 == 'pushd' or ln1 == 'set' or ln1 == 'test' or ln1 == 'umask' or ln1 == '%clang_profgen' or 'LLVM_PROFILE_FILE=' in ln1 or 'LLVM_PROFILE_VERBOSE_ERRORS=' in ln1:
script.append(ln)
+ else:
+ script.append('gtimeout 1m ' +ln)
elif command_type == 'XFAIL':
test.xfails.extend([s.strip() for s in ln.split(',')])
elif command_type == 'REQUIRES':
llvm39-clang-iomp5.patch
(application/octet-stream, 2 KB)
diff -uNr cfe-3.9.0.src.orig/lib/Driver/Tools.cpp cfe-3.9.0.src/lib/Driver/Tools.cpp
--- cfe-3.9.0.src.orig/lib/Driver/Tools.cpp 2016-08-13 16:43:56.000000000 -0400
+++ cfe-3.9.0.src/lib/Driver/Tools.cpp 2016-11-01 20:08:04.000000000 -0400
@@ -3061,12 +3061,18 @@
switch (getOpenMPRuntime(TC, Args)) {
case OMPRT_OMP:
+ // Help clang find libomp.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-lomp");
break;
case OMPRT_GOMP:
+ // Help clang find libgomp.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-lgomp");
break;
case OMPRT_IOMP5:
+ // Help clang find libiomp5.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-liomp5");
break;
case OMPRT_Unknown:
@@ -5031,6 +5037,8 @@
case OMPRT_OMP:
case OMPRT_IOMP5:
// Clang can generate useful OpenMP code for these two runtime libraries.
+ // Automatically find omp.h from libomp-dev
+ CmdArgs.push_back("-I@FINK_PREFIX@/include/libomp");
CmdArgs.push_back("-fopenmp");
// If no option regarding the use of TLS in OpenMP codegeneration is
@@ -9524,9 +9532,13 @@
// Also link the particular OpenMP runtimes.
switch (getOpenMPRuntime(ToolChain, Args)) {
case OMPRT_OMP:
+ // Help clang find libomp.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-lomp");
break;
case OMPRT_GOMP:
+ // Help clang find libgomp.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-lgomp");
// FIXME: Exclude this for platforms with libgomp that don't require
@@ -9534,6 +9546,8 @@
CmdArgs.push_back("-lrt");
break;
case OMPRT_IOMP5:
+ // Help clang find libiomp5.dylib
+ CmdArgs.push_back("-L@FINK_PREFIX@/lib/libomp");
CmdArgs.push_back("-liomp5");
break;
case OMPRT_Unknown:
llvm39-clang.patch
(application/octet-stream, 3.2 KB)
diff -uNr cfe-3.9.0.src.orig/lib/Driver/Tools.cpp cfe-3.9.0.src/lib/Driver/Tools.cpp
--- cfe-3.9.0.src.orig/lib/Driver/Tools.cpp 2016-08-13 16:43:56.000000000 -0400
+++ cfe-3.9.0.src/lib/Driver/Tools.cpp 2016-10-29 07:57:22.000000000 -0400
@@ -7637,22 +7637,22 @@
CmdArgs.push_back("-object_path_lto");
CmdArgs.push_back(TmpPath);
}
+ }
- // Use -lto_library option to specify the libLTO.dylib path. Try to find
- // it in clang installed libraries. If not found, the option is not used
- // and 'ld' will use its default mechanism to search for libLTO.dylib.
- if (Version[0] >= 133) {
- // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
- StringRef P = llvm::sys::path::parent_path(D.getInstalledDir());
- SmallString<128> LibLTOPath(P);
- llvm::sys::path::append(LibLTOPath, "lib");
- llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
- if (llvm::sys::fs::exists(LibLTOPath)) {
- CmdArgs.push_back("-lto_library");
- CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
- } else {
- D.Diag(diag::warn_drv_lto_libpath);
- }
+ // Use -lto_library option to specify the libLTO.dylib path. Try to find
+ // it in clang installed libraries. If not found, the option is not used
+ // and 'ld' will use its default mechanism to search for libLTO.dylib.
+ if (Version[0] >= 133) {
+ // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
+ StringRef P = llvm::sys::path::parent_path(D.Dir);
+ SmallString<128> LibLTOPath(P);
+ llvm::sys::path::append(LibLTOPath, "lib");
+ llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
+ if (llvm::sys::fs::exists(LibLTOPath)) {
+ CmdArgs.push_back("-lto_library");
+ CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
+ } else {
+ D.Diag(diag::warn_drv_lto_libpath);
}
}
diff -uNr cfe-3.9.0.src.orig/test/Driver/darwin-ld-lto.c cfe-3.9.0.src/test/Driver/darwin-ld-lto.c
--- cfe-3.9.0.src.orig/test/Driver/darwin-ld-lto.c 2015-10-02 11:10:33.000000000 -0400
+++ cfe-3.9.0.src/test/Driver/darwin-ld-lto.c 2016-10-29 07:58:30.000000000 -0400
@@ -3,7 +3,7 @@
// Check that ld gets "-lto_library" and warnings about libLTO.dylib path.
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN: -mlinker-version=133 -flto 2> %t.log
+// RUN: -mlinker-version=133 2> %t.log
// RUN: cat %t.log
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s < %t.log
//
@@ -11,14 +11,14 @@
// LINK_LTOLIB_PATH: "-lto_library"
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -flto 2> %t.log
+// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
// RUN: cat %t.log
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s < %t.log
//
// LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto -flto 2> %t.log
+// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto 2> %t.log
// RUN: cat %t.log
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s < %t.log
//
gromacs.info
(application/octet-stream, 4.2 KB) - not displayed
gromacs-mpi.info
(application/octet-stream, 4.4 KB) - not displayed
gromacs-libxml2.patch
(application/octet-stream, 444 B)
--- gromacs-2016/CMakeLists.txt.orig 2016-10-30 10:02:20.000000000 -0400 +++ gromacs-2016/CMakeLists.txt 2016-10-30 10:02:42.000000000 -0400 @@ -475,6 +475,7 @@ # tests. This exports LIBXML2_FOUND, which we should not use because # it does not tell us that linking will succeed. Instead, we test that # next. +set(LIBXML2_LIBRARIES @FINKPREFIX@/lib/libxml2.dylib) #if(DEFINED LIBXML2_LIBRARIES) # set(LibXml2_FIND_QUIETLY TRUE) #endif()