summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiyang Wu <xgreenlandforwyy@gmail.com>2022-06-27 21:12:30 +0800
committerBenda Xu <heroxbd@gentoo.org>2022-07-09 01:40:06 +0800
commit7dac65ea4155fa1f5a21bdd46dd9793d21911e0e (patch)
tree89e9029ec603cf9c3dd5d345db62435bf61d1bb6 /dev-util/hip
parentsci-libs/rocBLAS: respect MAKEOPTS when build Tensile libs (diff)
downloadgentoo-7dac65ea4155fa1f5a21bdd46dd9793d21911e0e.tar.gz
gentoo-7dac65ea4155fa1f5a21bdd46dd9793d21911e0e.tar.bz2
gentoo-7dac65ea4155fa1f5a21bdd46dd9793d21911e0e.zip
dev-util/hip: add missing BDEPEND for USE=profile
Also fix ld warnings by patch out unecessary ldflag added by hipcc.pl Closes: https://github.com/gentoo/gentoo/pull/26090 Closes: https://bugs.gentoo.org/843263 Reference: https://github.com/justxi/rocm/issues/8#issuecomment-1166193820 Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/hip')
-rw-r--r--dev-util/hip/files/hip-5.0.2-correct-ldflag.patch18
-rw-r--r--dev-util/hip/hip-5.0.2-r2.ebuild17
2 files changed, 34 insertions, 1 deletions
diff --git a/dev-util/hip/files/hip-5.0.2-correct-ldflag.patch b/dev-util/hip/files/hip-5.0.2-correct-ldflag.patch
new file mode 100644
index 00000000000..81d1bc3b855
--- /dev/null
+++ b/dev-util/hip/files/hip-5.0.2-correct-ldflag.patch
@@ -0,0 +1,18 @@
+This removes ldflag -L"/usr/lib" and -Wl,-rpath=/usr/lib:/usr/lib which
+causes `ld: skipping incompatible /usr/lib/libm.so when searching for -lm`
+Reference: https://github.com/justxi/rocm/issues/8#issuecomment-1166193820
+===================================================================
+--- HIP-rocm-5.1.3.orig/bin/hipcc.pl
++++ HIP-rocm-5.1.3/bin/hipcc.pl
+@@ -703,9 +703,9 @@ if ($HIP_PLATFORM eq "amd") {
+
+ if (not $isWindows and not $compileOnly) {
+ if ($linkType eq 0) {
+- $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
++ $toolArgs = " -lamdhip64 -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
+ } else {
+- $toolArgs = " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 " . ${toolArgs};
++ $toolArgs = " -Wl,--enable-new-dtags -lamdhip64 " . ${toolArgs};
+ }
+ # To support __fp16 and _Float16, explicitly link with compiler-rt
+ $HIP_CLANG_BUILTIN_LIB="/opt/gentoo/opt/gentoo/usr/lib/llvm/14/bin/../../../../lib/clang/14.0.6/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
diff --git a/dev-util/hip/hip-5.0.2-r2.ebuild b/dev-util/hip/hip-5.0.2-r2.ebuild
index 22338622708..fd069acfe4b 100644
--- a/dev-util/hip/hip-5.0.2-r2.ebuild
+++ b/dev-util/hip/hip-5.0.2-r2.ebuild
@@ -2,7 +2,10 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit cmake prefix
+
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit cmake prefix python-any-r1
DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
HOMEPAGE="https://github.com/ROCm-Developer-Tools/hipamd"
@@ -29,6 +32,10 @@ DEPEND="
RDEPEND="${DEPEND}
dev-perl/URI-Encode
dev-libs/roct-thunk-interface:${SLOT}"
+BDEPEND="profile? ( $(python_gen_any_dep '
+ dev-python/CppHeaderParser[${PYTHON_USEDEP}]
+ ') )
+"
PATCHES=(
"${FILESDIR}/${PN}-5.0.1-DisableTest.patch"
@@ -38,6 +45,12 @@ PATCHES=(
"${FILESDIR}/${PN}-5.0.2-set-build-id.patch"
)
+python_check_deps() {
+ if use profile; then
+ has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]"
+ fi
+}
+
S="${WORKDIR}/hipamd-rocm-${PV}"
HIP_S="${WORKDIR}"/HIP-rocm-${PV}
OCL_S="${WORKDIR}"/ROCm-OpenCL-Runtime-rocm-${PV}
@@ -65,11 +78,13 @@ src_prepare() {
sed -e "/LIBRARY DESTINATION/s:lib:$(get_libdir):" -i src/CMakeLists.txt || die
cd ${HIP_S} || die
+ eapply "${FILESDIR}/${PN}-5.0.2-correct-ldflag.patch"
# Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include"
# which makes "stdlib.h" not found when using "#include_next" in header files;
sed -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \
-e "/HIP.*FLAGS.*isystem.*HIP_INCLUDE_PATH/d" \
-e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \
+ -e "s:\$ENV{'HIP_LIB_PATH'}:'/usr/$(get_libdir)':" \
-e "/rpath/s,--rpath=[^ ]*,," \
-i bin/hipcc.pl || die