ROCm-Device-Libs BinaryBuilder

pxl-th
Fri, 08 Jul 2022 17:41:22 +0000
Tooling

I’m having trouble building ROCm-Device-Libraries using BinaryBuilder with ROCmLLVM.
I’m trying to follow build recipe from the rocm-arch repository.
There they use ROCmLLVM to build it. But when specifying it in the BinaryBuilder I get errors I’m not sure show to fix.

The gist of the error:

The C compiler
  "/workspace/destdir/tools/clang"
is not able to compile a simple test program.
It fails with the following output:
  ...
  /workspace/destdir/tools/clang CMakeFiles/cmTC_7b11b.dir/testCCompiler.c.o -o cmTC_7b11b
  /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: cannot find crt1.o: No such file or directory
  /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: cannot find crti.o: No such file or directory
  /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory
  /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: cannot find -lgcc
  /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: cannot find -lgcc_s
  clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

I’ve tried specifying toolchain file ${CMAKE_TARGET_TOOLCHAIN} as well as clang specific ${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake.
But they overwrite the compiler with their own /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-clang

Am I missing somethings that needs to be configured when using different compiler?
I want to compile all the necessary packages to be able to build rocBLAS while reducing number of patches that disable features and potentially avoid mixing musl and glibc in the process.

Here’s the recipe:

using Pkg
using BinaryBuilder

name = "ROCmDeviceLibs"
version = v"4.2.0"

sources = [
    ArchiveSource(
        "https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-$(version).tar.gz",
        "34a2ac39b9bb7cfa8175cbab05d30e7f3c06aaffce99eed5f79c616d0f910f5f"),
]

script = raw"""
cd ${WORKSPACE}/srcdir/ROCm-Device-Libs*/
mkdir build && cd build

ln -s ${prefix}/bin/clang ${prefix}/tools/clang
ln -s ${prefix}/bin/lld ${prefix}/tools/lld
export PATH="${prefix}/bin:${prefix}/tools:${PATH}"

CC=${prefix}/tools/clang \
CXX=${prefix}/tools/clang++ \
cmake \
    -DCMAKE_PREFIX_PATH=${prefix} \
    -DCMAKE_INSTALL_PREFIX=${prefix} \
    -DLLVM_DIR="${prefix}/lib/cmake/llvm" \
    -DClang_DIR="${prefix}/lib/cmake/clang" \
    ..
make -j${nproc}
make install
"""

platforms = [Platform("x86_64", "linux"; libc="glibc", cxxstring_abi="cxx11")]
platforms = expand_cxxstring_abis(platforms)
products = [FileProduct("amdgcn/bitcode/", :bitcode_path)]

dependencies = [
    #BuildDependency(PackageSpec(; name="LLVM_full_jll", version=v"12.0.1")),
    BuildDependency(PackageSpec(; name="ROCmLLVM_jll", version=v"4.2.0")),
    Dependency("Zlib_jll"),
]
build_tarballs(
    ARGS, name, version, sources, script, platforms, products, dependencies;
    preferred_gcc_version=v"9", preferred_llvm_version=v"12")

6 posts - 3 participants