Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
86a0f97
Update rocprofiler-systems subproject, add dependency to Dockerfile
jbonnell-amd Oct 23, 2025
3b8dc6c
Backup - trying to get TheRock to build Dyninst as a third-party depe…
dgaliffiAMD Nov 12, 2025
64f0e39
Forward COMPONENTS property from "find_package". Used by Boost.
dgaliffiAMD Nov 13, 2025
486b287
Move deps to "runtime_deps" add "install_rpath_dirs"
dgaliffiAMD Nov 13, 2025
7812629
Fix `TBB` project name in `therock_cmake_subproject_provide_package`
dgaliffiAMD Nov 17, 2025
45f97c1
Clean up dyninst dependencies
dgaliffiAMD Nov 18, 2025
5bcf1e7
Importing changes from the rocprof-sys branch
dgaliffiAMD Nov 21, 2025
debd6b1
Use upper case naming for Dyninst in provide package call
jbonnell-amd Dec 15, 2025
40b7917
Add sysdep binutils
dgaliffiAMD Dec 18, 2025
3ec47be
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Dec 18, 2025
b0dbe9c
Merge remote-tracking branch 'origin/users/dgaliffi/binutils' into us…
jbonnell-amd Dec 18, 2025
3ab6c13
Update oneTBB version from 2022.2.0 to 2022.3.0
jbonnell-amd Dec 18, 2025
8938a45
Add binutils to runtime_deps for dyninst
jbonnell-amd Dec 18, 2025
4b62b8f
Update patch_install.sh to move header file locations
jbonnell-amd Dec 18, 2025
b503e48
Update comment on binutils section of artifact.toml
jbonnell-amd Dec 18, 2025
31d69ec
Add comment for adding S3 bucket URL for binutils
jbonnell-amd Dec 18, 2025
2615916
Add fPIC flag in elfutils CMakeLists.txt file
jbonnell-amd Dec 18, 2025
8af3121
Update INTERFACE_INCLUDE_DIRECTORIES instead of copying files
jbonnell-amd Dec 19, 2025
14fea42
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Dec 19, 2025
b2e2e88
Remove extra line from third-party/CMakeLists.txt
jbonnell-amd Dec 19, 2025
0c4fb03
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Dec 29, 2025
06a5076
Revert therock_subproject_dep_provider.cmake changes for debugging
jbonnell-amd Dec 29, 2025
cbfe12e
Bring back dep_provider changes
jbonnell-amd Dec 29, 2025
9b23273
Add therock-tbb to rocthrust for testing
jbonnell-amd Dec 29, 2025
f6af7f7
Add therock-tbb runtime_dep to rocprofiler-systems
jbonnell-amd Dec 29, 2025
5667522
Add therock-tbb build_dep to rocthrust to get build passing
jbonnell-amd Dec 29, 2025
83e22de
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Dec 30, 2025
0cadd89
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Jan 2, 2026
dd558c2
Update third-party/dyninst/CMakeLists.txt
jbonnell-amd Jan 5, 2026
a1e608b
Update third-party/sysdeps/linux/binutils/CMakeLists.txt
jbonnell-amd Jan 5, 2026
ca14580
Update third-party/tbb/CMakeLists.txt
jbonnell-amd Jan 5, 2026
8fe986e
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Jan 5, 2026
05a24c6
Update dyninst CMakeLists.txt, added artifact-dyninst.toml
jbonnell-amd Jan 6, 2026
4c5fe52
Add $PAR_JOBS to make command for binutils CMakeLists.txt
jbonnell-amd Jan 12, 2026
9f7982f
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Jan 12, 2026
7c699cd
Merge branch 'main' into users/dgaliffi/rocprof-sys-merged
jbonnell-amd Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ endif()
################################################################################

set(THEROCK_BUNDLED_BZIP2)
set(THEROCK_BUNDLED_BINUTILS)
set(THEROCK_BUNDLED_ELFUTILS)
set(THEROCK_BUNDLED_GMP)
set(THEROCK_BUNDLED_LIBBACKTRACE)
Expand All @@ -373,6 +374,7 @@ if(THEROCK_BUNDLE_SYSDEPS)
message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON on Linux requires (easiest: `pip install meson`)")
endif()
set(THEROCK_BUNDLED_BZIP2 therock-bzip2)
set(THEROCK_BUNDLED_BINUTILS therock-binutils)
set(THEROCK_BUNDLED_ELFUTILS therock-elfutils)
set(THEROCK_BUNDLED_GMP, therock-gmp)
set(THEROCK_BUNDLED_LIBBACKTRACE therock-libbacktrace)
Expand Down
12 changes: 11 additions & 1 deletion cmake/therock_subproject_dep_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,24 @@ function(therock_reparse_super_project_find_package superproject_path package_na
cmake_parse_arguments(PARSE_ARGV 1 UNUSED
"BYPASS_PROVIDER;CONFIG;MODULE;NO_DEFAULT_PATH;NO_CMAKE_PATH;NO_CMAKE_ENVIRONMENT_PATH;NO_SYSTEM_ENVIRONMENT_PATH;NO_CMAKE_PACKAGE_REGISTRY"
""
"HINTS;PATHS"
"HINTS;PATHS;COMPONENTS;OPTIONAL_COMPONENTS"
)
if(NOT superproject_path)
message(FATAL_ERROR "Super-project package path not found for ${package_name}")
endif()

# The signature of MODULE vs DEFAULT mode is different, so switch.
set(_rewritten ${UNUSED_UNPARSED_ARGUMENTS})

# Preserve COMPONENTS and OPTIONAL_COMPONENTS if they were specified. Some packages
# (e.g. Boost) require these to be specified in the find_package signature.
if(UNUSED_COMPONENTS)
list(APPEND _rewritten COMPONENTS ${UNUSED_COMPONENTS})
endif()
if(UNUSED_OPTIONAL_COMPONENTS)
list(APPEND _rewritten OPTIONAL_COMPONENTS ${UNUSED_OPTIONAL_COMPONENTS})
endif()

# Some very old code uses explicit MODULE mode, which forces the basic
# signature (*cough* old FindHIP based junk). In this mode, there is no way
# to explicitly indicate a search path in the signature (and other options
Expand Down
1 change: 1 addition & 0 deletions math-libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ if(THEROCK_ENABLE_PRIM)
rocm-cmake
rocPRIM
therock-googletest
therock-tbb
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, rocthrust configure kept failing due to this error:

Project contains find_package(TBB) for a package available in the super-project but not declared: Add a BUILD_DEPS or RUNTIME_DEPS appropriately

Not sure where this is coming from but added this for now as a workaround. Would appreciate some insight on what the root cause of this might be

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure that thrust must have an optional dependency on TBB and is probing for it. TheRock doesn't let that happen (for this reason). You can add TBB to thrust to unblock BUILD_DEPS to unblock this PR but we should really have an explicit flag to enable/disable the TBB dep there vs having implicit behavior like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dread TBB more than Boost 🗡️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbonnell-amd can you file an issue and link it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #2837

RUNTIME_DEPS
hip-clr
)
Expand Down
10 changes: 4 additions & 6 deletions profiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ if(THEROCK_ENABLE_ROCPROFV3)
hip-clr
rocprofiler-register
${_rocprofiler_sdk_optional_deps}
${THEROCK_BUNDLED_ELFUTILS}
${THEROCK_BUNDLED_LIBDRM}
${THEROCK_BUNDLED_SQLITE3}
)
Expand Down Expand Up @@ -209,11 +208,6 @@ if(THEROCK_ENABLE_ROCPROFV3)
BACKGROUND_BUILD
CMAKE_ARGS
-DHIP_PLATFORM=amd
-DROCPROFSYS_BUILD_ELFUTILS=ON
-DROCPROFSYS_BUILD_TBB=ON
-DROCPROFSYS_BUILD_LIBIBERTY=ON
-DROCPROFSYS_BUILD_BOOST=ON
-DROCPROFSYS_BUILD_DYNINST=ON
CMAKE_INCLUDES
therock_explicit_finders.cmake
RUNTIME_DEPS
Expand All @@ -222,8 +216,12 @@ if(THEROCK_ENABLE_ROCPROFV3)
hip-clr
rocprofiler-register
rocprofiler-sdk
${THEROCK_BUNDLED_BINUTILS}
${THEROCK_BUNDLED_LIBDRM}
${THEROCK_BUNDLED_SQLITE3}
therock-tbb
therock-dyninst
therock-nlohmann-json
)
therock_cmake_subproject_glob_c_sources(rocprofiler-systems
SUBDIRS .
Expand Down
4 changes: 4 additions & 0 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ add_subdirectory(libdivide)
add_subdirectory(msgpack-cxx)
add_subdirectory(nlohmann-json)
add_subdirectory(simde)
add_subdirectory(tbb)
add_subdirectory(yaml-cpp)
add_subdirectory(Catch2)
add_subdirectory(FunctionalPlus)
Expand Down Expand Up @@ -41,3 +42,6 @@ endif()
# gRPC: Static library for RDC (built on-demand when depended upon)
# See: docs/rfcs/RFC0007-rdc-therock-integration.md
add_subdirectory(grpc)

# dyninst depends on elfutils, boost, tbb
add_subdirectory(dyninst)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to go into sysdeps/linux as an optional sysdep. Follow the same pattern as was done for amdmesa.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on moving dyninst into sysdeps/linux on a side branch, I'll merge the changes back over here once it's all done and confirmed working. Thanks for the feedback!

12 changes: 11 additions & 1 deletion third-party/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Installs a limited subset of boost sufficient to build ROCM subprojects.
# Currently, this includes:
# atomic
# chrono
# date_time
# filesystem
# multi_index
# system
# thread
# timer
# Static libraries only
# Release build
# Multithreaded
# See cmake_project/CMakeLists.txt for details.


set(_source_dir "${CMAKE_CURRENT_BINARY_DIR}/source")
set(_download_stamp "${_source_dir}/download.stamp")

Expand All @@ -29,7 +35,7 @@ therock_cmake_subproject_declare(therock-boost
OUTPUT_ON_FAILURE
CMAKE_ARGS
"-DBOOST_SOURCE_DIR=${_source_dir}"
"-DTHEROCK_BOOST_LIBRARIES=atomic,filesystem,multi_index,system"
"-DTHEROCK_BOOST_LIBRARIES=atomic,chrono,date_time,filesystem,multi_index,system,thread,timer"
Comment on lines -32 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Added dyninst third-party dependency
  • Modified boost third-party dependency
    • Added additional packages chrono, date_time, thread, timer which are needed as a dependency for dyninst

We really shouldn't be expanding our dependency on boost, especially not for relatively simple utilities like these. This is especially problematic if the dependency is indirect, as that could make migrating away more difficult.

Should we consider these "grandfathered in" and allow them to be added here, or draw a line and reject them? Either way, the boost dependency must be removed eventually - is the rocprofiler-systems team prioritizing that?

cc @powderluv @stellaraccident

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we weren't. But we need to get the whole gang in place before giving any of them a haircut.

EXTRA_DEPENDS
"${_download_stamp}"
)
Expand All @@ -41,9 +47,13 @@ set(_boost_version 1.87.0)
# kept in sync with above library list.
therock_cmake_subproject_provide_package(therock-boost Boost "lib/cmake/Boost-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_atomic "lib/cmake/boost_atomic-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_chrono "lib/cmake/boost_chrono-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_date_time "lib/cmake/boost_date_time-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_filesystem "lib/cmake/boost_filesystem-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_headers "lib/cmake/boost_headers-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_system "lib/cmake/boost_system-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_thread "lib/cmake/boost_thread-${_boost_version}")
therock_cmake_subproject_provide_package(therock-boost boost_timer "lib/cmake/boost_timer-${_boost_version}")
therock_cmake_subproject_activate(therock-boost)

add_dependencies(therock-third-party therock-boost)
25 changes: 25 additions & 0 deletions third-party/dyninst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
therock_subproject_fetch(therock-dyninst-sources
CMAKE_PROJECT
# Originally mirrored from: https://github.com/dyninst/dyninst/archive/refs/tags/v13.0.0.tar.gz
URL https://rocm-third-party-deps.s3.us-east-2.amazonaws.com/dyninst-13.0.0.tar.gz
URL_HASH SHA256=1bc48d26478b677a6c090c25586a447507bd1b4cf88d369bd61820005ce1be39
)

therock_cmake_subproject_declare(therock-dyninst
BACKGROUND_BUILD
EXCLUDE_FROM_ALL
NO_MERGE_COMPILE_COMMANDS
OUTPUT_ON_FAILURE
EXTERNAL_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/source"
RUNTIME_DEPS
therock-boost
therock-tbb
${THEROCK_BUNDLED_BINUTILS}
${THEROCK_BUNDLED_ELFUTILS}
INSTALL_RPATH_DIRS
lib/rocm_sysdeps/lib
)
therock_cmake_subproject_provide_package(therock-dyninst Dyninst lib/cmake)
therock_cmake_subproject_activate(therock-dyninst)

add_dependencies(therock-third-party therock-dyninst)
2 changes: 2 additions & 0 deletions third-party/sysdeps/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../common/zlib" "${CMAKE_CURRENT_B
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../common/zstd" "${CMAKE_CURRENT_BINARY_DIR}/zstd")

# System deps that depend on the above.
add_subdirectory(binutils)
add_subdirectory(elfutils)

# Core sysdeps: This artifact includes libraries that are widely used and are typically
Expand All @@ -26,6 +27,7 @@ therock_provide_artifact(sysdeps
run
SUBPROJECT_DEPS
therock-bzip2
therock-binutils
therock-elfutils
therock-gmp
therock-libbacktrace
Expand Down
4 changes: 4 additions & 0 deletions third-party/sysdeps/linux/artifact.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ unmatched_exclude = [
"lib/rocm_sysdeps/share/man/**",
]

# binutils
[components.dev."third-party/sysdeps/linux/binutils/build/stage"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this an optional sysdep in the same pattern as amdmesa, with its own artifact.

[components.lib."third-party/sysdeps/linux/binutils/build/stage"]

# bzip2
[components.dev."third-party/sysdeps/linux/bzip2/build/stage"]
# Include the executables in the dev package since some sub-projects
Expand Down
104 changes: 104 additions & 0 deletions third-party/sysdeps/linux/binutils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# When included in TheRock, we download sources and set up the sub-project.
set(_source_dir "${CMAKE_CURRENT_BINARY_DIR}/source")
set(_download_stamp "${_source_dir}/download.stamp")

therock_subproject_fetch(therock-binutils-sources
SOURCE_DIR "${_source_dir}"
# Originally mirrored from: "http://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz"
URL https://rocm-third-party-deps.s3.us-east-2.amazonaws.com/binutils-2.45.tar.gz
URL_HASH "SHA512=5c71ec80884c0b4c0f7a4f8600946f1f6feebe584261b63185b0942cba4062d5b6cf2337539132d0ca03505c0a74f3c2760bc62ed08843c3b7db03df7f5798ad"
TOUCH "${_download_stamp}"
)

therock_cmake_subproject_declare(therock-binutils
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR .
FPRINT_SOURCE_DIR "${_source_dir}"
FPRINT_FILE_GLOBS "${CMAKE_CURRENT_LIST_DIR}/*"
BINARY_DIR build
NO_MERGE_COMPILE_COMMANDS
BACKGROUND_BUILD
OUTPUT_ON_FAILURE
CMAKE_ARGS
"-DSOURCE_DIR=${_source_dir}"
"-DPATCHELF=${PATCHELF}"
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}"
INSTALL_DESTINATION
lib/rocm_sysdeps
INTERFACE_LINK_DIRS
lib/rocm_sysdeps/lib
INTERFACE_INSTALL_RPATH_DIRS
lib/rocm_sysdeps/lib
INTERFACE_PKG_CONFIG_DIRS
lib/rocm_sysdeps/lib/pkgconfig
EXTRA_DEPENDS
"${_download_stamp}"
)

therock_cmake_subproject_provide_package(therock-binutils LibIberty lib/rocm_sysdeps/lib/cmake/libiberty)
therock_cmake_subproject_activate(therock-binutils)

return()
endif()

# Otherwise, this is the sub-project build.
cmake_minimum_required(VERSION 3.25)
project(BINUTILS_BUILD)

include(ProcessorCount)
ProcessorCount(PAR_JOBS)

if(NOT PATCHELF)
message(FATAL_ERROR "Missing PATCHELF from super-project")
endif()

set(EXTRA_CPPFLAGS)
string(APPEND EXTRA_CPPFLAGS " -fPIC")
message(STATUS "EXTRA_CPPFLAGS=${EXTRA_CPPFLAGS}")

add_custom_target(
build ALL
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND
"${CMAKE_COMMAND}" -E rm -rf -- "${CMAKE_INSTALL_PREFIX}" "${CMAKE_CURRENT_BINARY_DIR}/s"
COMMAND
# We have to patch the sources so make a fresh copy.
"${CMAKE_COMMAND}" -E copy_directory "${SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/s"
COMMAND
"${CMAKE_COMMAND}" -E env
"CFLAGS=${EXTRA_CPPFLAGS}"
"CPPFLAGS=${EXTRA_CPPFLAGS}"
--
"${CMAKE_CURRENT_BINARY_DIR}/s/configure"
--prefix "${CMAKE_INSTALL_PREFIX}"
--enable-install-libiberty
--disable-shared
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment that this is only providing binaries, and even if GPL conditions are satisfied since nothing links to these.

--enable-static
--libdir="${CMAKE_INSTALL_PREFIX}/lib"
--includedir="${CMAKE_INSTALL_PREFIX}/include"
--disable-nls
--disable-werror
COMMAND
make -j 1 V=1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this build step benefit from higher parallelism? Logs at https://therock-ci-artifacts.s3.amazonaws.com/20722897507-linux/logs/gfx94X-dcgpu/therock-binutils_build.log suggest this may be taking 5 minutes? Can we try with multithreading?

See how other dependencies use a PAR_JOBS variable:

include(ProcessorCount)
ProcessorCount(PAR_JOBS)
COMMAND
make -j "${PAR_JOBS}" V=1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I've updated the make command to use the $PAR_JOBS var instead of just using 1. Thanks!

COMMAND
make install
COMMAND
"${CMAKE_COMMAND}" -E env
"PATCHELF=${PATCHELF}"
"THEROCK_SOURCE_DIR=${THEROCK_SOURCE_DIR}"
"Python3_EXECUTABLE=${Python3_EXECUTABLE}" --
"${CMAKE_CURRENT_SOURCE_DIR}/patch_install.sh" ${CMAKE_INSTALL_PREFIX}

DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/patch_install.sh"
)

# This matches the conventions of the FindLibIberty.cmake module.
# Other than that, there is so source of truth for this.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libiberty-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libiberty-config.cmake
@ONLY
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libiberty-config.cmake" DESTINATION lib/cmake/libiberty)
17 changes: 17 additions & 0 deletions third-party/sysdeps/linux/binutils/libiberty-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Traverse from lib/cmake/FOO -> the directory holding lib
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()

if(NOT TARGET LibIberty::LibIberty)
add_library(LibIberty::LibIberty STATIC IMPORTED)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libiberty is LGPL licensed. We have to use it as a shared library or not at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbonnell-amd please ping once these comments are resolved and you want another review.

set_target_properties(LibIberty::LibIberty PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/libiberty"
IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/libiberty.a"
)
endif()

set(_IMPORT_PREFIX)
39 changes: 39 additions & 0 deletions third-party/sysdeps/linux/binutils/patch_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Patches installed binaries from the external build system.
# Args: install_dir patchelf_binary
set -e

PREFIX="${1:?Expected install prefix argument}"
PATCHELF="${PATCHELF:-patchelf}"
THEROCK_SOURCE_DIR="${THEROCK_SOURCE_DIR:?THEROCK_SOURCE_DIR not defined}"
Python3_EXECUTABLE="${Python3_EXECUTABLE:?Python3_EXECUTABLE not defined}"

echo "binutils::patch_install.sh - prefix - $PREFIX"

# Copy lib64 to lib if it exists
if [ -d "$PREFIX/lib64" ]; then
cp -r $PREFIX/lib64/* $PREFIX/lib/
rm -rf $PREFIX/lib64
fi

# We don't want library descriptors or binaries.
rm -f $PREFIX/lib/*.la

if [ -d "$PREFIX/lib/bfd-plugins" ]; then
rm -rf $PREFIX/lib/bfd-plugins
fi
if [ -d "$PREFIX/lib/gprofng" ]; then
rm -rf $PREFIX/lib/gprofng
fi
if [ -d "$PREFIX/bin" ]; then
rm -rf $PREFIX/bin
fi
if [ -d "$PREFIX/share" ]; then
rm -rf $PREFIX/share
fi
if [ -d "$PREFIX/etc" ]; then
rm -rf $PREFIX/etc
fi
if [ -d "$PREFIX/x86_64-pc-linux-gnu" ]; then
rm -rf $PREFIX/x86_64-pc-linux-gnu
fi
7 changes: 7 additions & 0 deletions third-party/sysdeps/linux/elfutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ if(NOT PATCHELF)
message(FATAL_ERROR "Missing PATCHELF from super-project")
endif()

# fPIC needed for rocprofiler-systems
set(EXTRA_CFLAGS)
string(APPEND EXTRA_CFLAGS " -fPIC")
message(STATUS "EXTRA_CFLAGS=${EXTRA_CLFAGS}")

# HACK: elfutils consults pkg-config for cflags for the compression libraries
# but then does not seem to use them everywhere needed. So we just hard-code
# paths.
Expand All @@ -70,6 +75,7 @@ string(APPEND EXTRA_CPPFLAGS " -I${THEROCK_BINARY_DIR}/third-party/sysdeps/linux
string(APPEND EXTRA_CPPFLAGS " -I${THEROCK_BINARY_DIR}/third-party/sysdeps/linux/liblzma/build/stage/lib/rocm_sysdeps/include")
string(APPEND EXTRA_CPPFLAGS " -I${THEROCK_BINARY_DIR}/third-party/sysdeps/linux/zlib/build/stage/lib/rocm_sysdeps/include")
string(APPEND EXTRA_CPPFLAGS " -I${THEROCK_BINARY_DIR}/third-party/sysdeps/linux/zstd/build/stage/lib/rocm_sysdeps/include")
string(APPEND EXTRA_CPPFLAGS " -fPIC")
message(STATUS "EXTRA_CPPFLAGS=${EXTRA_CPPFLAGS}")

add_custom_target(
Expand All @@ -96,6 +102,7 @@ add_custom_target(
# Escaping: Double $ to satisfy CMake, then double $ to satisfy configure,
# then escaped single quotes to make it to the linker command line.
"LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath=\\'\\$$\\$$ORIGIN\\'"
"CFLAGS=${EXTRA_CFLAGS}"
"CPPFLAGS=${EXTRA_CPPFLAGS}"
--
"${CMAKE_CURRENT_BINARY_DIR}/s/configure"
Expand Down
Loading
Loading