Mentions légales du service

Skip to content
Snippets Groups Projects

intel-oneapi-mkl : we now change rpath using patchelf

Closed Marko requested to merge sed-bso/guix-hpc-non-free-ene-konponketak:master into master
All threads resolved!
+ 45
44
@@ -55,9 +55,7 @@
(let* ((command (string-append "rpm2cpio "
rpm
" | cpio -i"))
(status (system command)))
(unless (zero? status)
(error (format #f
"command '~a' failed with ~a"
command status)))))
(find-files "rpm" "\\.rpm$"))))
@@ -105,2+103,2 @@
;; Let's not publish or obtain substitutes for that.
#:substitutable? #f))
(native-inputs (list tar gzip cpio rpm patchelf))
(inputs
`(("gcc:lib" ,gcc "lib")))
;;(inputs (list `(,(canonical-package gcc) "lib")))
(inputs `(("gcc:lib" ,gcc "lib")))
;; 32-bit libraries are not installed.
(supported-systems '("x86_64-linux"))
@@ -166,13 +161,15 @@ reference a C interface.")
(base32 sha))))
(build-system gnu-build-system)
(arguments
`(
;; Let's not publish or obtain substitutes for that.
`(#:modules ((srfi srfi-1) ; because of remove
(guix build gnu-build-system)
(guix build utils))
;; Let's not publish or obtain substitutes for that.
#:substitutable? #f
;; XXX: This would check DT_RUNPATH, but patchelf populate DT_RPATH,
;; not DT_RUNPATH.
#:validate-runpath? #f
#:phases (modify-phases %standard-phases
#:phases (modify-phases %standard-phases
(delete 'configure)
(delete 'check)
(delete 'build)
@@ -180,7+177,7 @@
(lambda _
;; extract all the debian packages to opt/intel
(for-each (lambda (deb)
(format #t "extracting ~a...~%" deb)
(let* ((command (string-append "ar x " deb
" && tar xf data.tar.xz && rm data.tar.xz"))
@@ -195,7+192,7 @@
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(define out
(assoc-ref outputs "out"))
(assoc-ref outputs "out"))
(define libc
(assoc-ref inputs "libc"))
(define gcc-lib
(assoc-ref inputs "gcc:lib"))
(define source-prefix
(string-append "opt/intel/oneapi/mkl/" ,(package-version this-package)))
(string-append "opt/intel/oneapi/mkl/"
,(package-version this-package)))
(define source-inc
(string-append source-prefix "/include"))
(define source-bin
(string-append source-prefix "/bin"))
(string-append source-prefix "/bin"))
(define source-cmake
(string-append source-prefix "/lib/cmake"))
(string-append source-prefix "/lib/cmake"))
(define libdir
(string-append out "/lib"))
(string-append out "/lib"))
(define bindir
(string-append out "/bin"))
(string-append out "/bin"))
(define ld.so
(string-append libc ,(glibc-dynamic-linker)))
(string-append libc ,(glibc-dynamic-linker)))
(define linktool
(string-append bindir "/intel64/mkl_link_tool"))
(string-append bindir "/intel64/mkl_link_tool"))
(define includedir
(string-append out "/include"))
(string-append out "/include"))
(define must-be-patched
(filter (lambda (x)
(not (or (string-contains x "tbb") ;current link problems
(string-contains x "sycl"))))
(find-files (string-append
source-prefix
"/lib/intel64")
"\\.so(\\..*)?$"))) ; take into account .so and .so.2
(remove (lambda (x)
(or (string-contains x "tbb") ;current link problems
(string-contains x "sycl")))
(find-files (string-append
source-prefix
"/lib/intel64")
"\\.so(\\..*)?$"))) ; just .so and .so.2
(define rpath
(string-join (list "$ORIGIN"
(string-append libc "/lib")
@@ -240,25 +238,28 @@ reference a C interface.")
(format #t "Setting RPATH on '~a'...~%" file)
(invoke "patchelf" "--set-rpath" rpath
"--force-rpath" file))
(for-each (lambda (lib) (when (and (elf-file? lib) (not (symbolic-link? lib))) (patch-elf lib))) ;modify runpath
must-be-patched)
(for-each (lambda (lib) (install-file lib libdir)) ; and install
must-be-patched)
(when (directory-exists? source-inc)
(copy-recursively source-inc includedir))
(when (directory-exists? source-bin)
(copy-recursively source-bin bindir))
(when (directory-exists? source-cmake)
(copy-recursively source-cmake (string-append libdir "/cmake")))
(when (file-exists? linktool)
(invoke "patchelf" linktool "--set-rpath"
(string-join (list (dirname (search-input-file
inputs
"/lib/libgcc_s.so"))
(dirname (search-input-file
inputs
"/lib/libstdc++.so.6"))) ":")))
#t)))))))
(for-each
(lambda (lib)
(when (and (elf-file? lib) (not (symbolic-link? lib)))
(patch-elf lib))) ;modify runpath
must-be-patched)
(for-each (lambda (lib) (install-file lib libdir)) ; and install
must-be-patched)
(when (directory-exists? source-inc)
(copy-recursively source-inc includedir))
(when (directory-exists? source-bin)
(copy-recursively source-bin bindir))
(when (directory-exists? source-cmake)
(copy-recursively source-cmake (string-append libdir "/cmake")))
(when (file-exists? linktool)
(invoke "patchelf" linktool "--set-rpath"
(string-join
(list (dirname (search-input-file
inputs
"/lib/libgcc_s.so"))
(dirname (search-input-file
inputs "/lib/libstdc++.so.6"))) ":")))
#t)))))))
(define-public intel-oneapi-mkl+main
(make-intel-oneapi-mkl "2023.2.0" "49495" "amd64" ""
Loading