hip: fix naming of libraries when installing from tarballs (#20780)

There's two issues with hip where it tries to autodetect the patch
version number from git (when installed), but it does not check if it
even is inside of a git repo. The result is we end up with a shared lib
with a trailing dash in the library suffix: `libamd64.so.x.y.z-`, which
confuses GCC. The patch tries to check if the `.git` folder exists, and
if it does not, it handles version numbering the same as when git was
not installed previously.
This commit is contained in:
Harmen Stoppels 2021-01-12 09:48:03 +01:00 committed by GitHub
parent 60a58d89e7
commit a2a0262f79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,56 @@
From 3a05d9ee5af2d318d27ee4b8e81542e2c81b9d5a Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <harmenstoppels@gmail.com>
Date: Mon, 11 Jan 2021 16:38:14 +0100
Subject: [PATCH] Improve compilation without git repo
---
CMakeLists.txt | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7831bb4d..c0c7a536 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,9 +42,17 @@ string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
-find_package(Git)
+# only look for git when we have a git repo
+if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
+ find_package(Git)
+endif()
# FIXME: Two different version strings used.
+
+set(HIP_PACKAGING_VERSION_PATCH "0")
+set(HIP_VERSION_GITDATE "0")
+set(HIP_VERSION_PATCH "0")
+
if(GIT_FOUND)
# get date information based on UTC
# use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
@@ -88,9 +96,6 @@ if(GIT_FOUND)
else()
set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}-${HIP_VERSION_GITHASH})
endif()
-else()
- # FIXME: Some parts depend on this being set.
- set(HIP_PACKAGING_VERSION_PATCH "0")
endif()
## Debian package specific variables
@@ -488,10 +493,6 @@ endif()
# Generate .hipVersion
file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
-if(NOT DEFINED HIP_VERSION_GITDATE)
- set(HIP_VERSION_GITDATE 0)
-endif()
-
# Build doxygen documentation
find_program(DOXYGEN_EXE doxygen)
if(DOXYGEN_EXE)
--
2.25.1

View file

@ -51,6 +51,9 @@ class Hip(CMakePackage):
# See https://github.com/ROCm-Developer-Tools/HIP/pull/2141
patch('0002-Fix-detection-of-HIP_CLANG_ROOT.patch', when='@:3.9.0')
# See https://github.com/ROCm-Developer-Tools/HIP/pull/2218
patch('0003-Improve-compilation-without-git-repo.patch', when='@4.0.0:')
def get_rocm_prefix_info(self):
# External packages in Spack do not currently contain dependency
# information. External installations of hip therefore must compute