While trying to upgrade rocm, from 5.7 to 6.1, rocm-device-libs fails to compile due to some llvm crap. Reproducible: Always * Package: dev-libs/rocm-device-libs-6.1.1:0/6.1 * Repository: gentoo * Maintainer: candrews@gentoo.org lockalsash@gmail.com * USE: abi_x86_64 amd64 elibc_glibc kernel_linux llvm_slot_18 * FEATURES: network-sandbox preserve-libs sandbox userpriv usersandbox >>> Unpacking source... * Unpacking from llvm-project-rocm-6.1.1.tar.gz ... [ ok ] >>> Source unpacked in /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work >>> Preparing source in /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs ... * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs" * Build directory (BUILD_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build" * Applying rocm-device-libs-5.5.0-test-bitcode-dir.patch ... [ ok ] * Applying rocm-device-libs-6.1.0-fix-llvm-link.patch ... [ ok ] * Applying rocm-device-libs-6.0.0-add-gws-attribute.patch ... patch unexpectedly ends in middle of line [ ok ] * Applying rocm-device-libs-6.1.0-fix-test-failures.patch ... [ ok ] * Applying rocm-device-libs-6.1.0-fix-test-failures2.patch ... [ ok ] * Hardcoded definition(s) removed in CMakeLists.txt: * set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/dist CACHE INTERNAL "Prefix >>> Source prepared. >>> Configuring source in /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs ... * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs" * Build directory (BUILD_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build" cmake -C /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_DIR=/usr/lib/llvm/18 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build/gentoo_toolchain.cmake /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs loading initial cache file /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build/gentoo_common_config.cmake -- The C compiler identification is Clang 18.1.8 -- The CXX compiler identification is Clang 18.1.8 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/lib/llvm/18/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/lib/llvm/18/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test HAVE_FFI_CALL -- Performing Test HAVE_FFI_CALL - Success -- Found FFI: /usr/lib64/libffi.so -- Looking for histedit.h -- Looking for histedit.h - found -- Found LibEdit: /usr/include (found version "2.11") -- Performing Test Terminfo_LINKABLE -- Performing Test Terminfo_LINKABLE - Success -- Found Terminfo: /usr/lib64/libtinfo.so -- Found ZLIB: /usr/lib64/libz.so (found version "1.3.1") -- Found zstd: /usr/lib64/libzstd.so -- Found LibXml2: /usr/lib64/libxml2.so (found version "2.12.8") -- Found CURL: /usr/lib64/libcurl.so (found version "8.8.0") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version "3.2.2", minimum required is "3.0.0") found components: Crypto SSL -- Found Brotli: /usr/include found components: common encoder decoder -- Found httplib: /usr/lib64/libcpp-httplib.so.0.16.0 (found version "0.16.0") -- Linker detection: LLD CMake Deprecation Warning at cmake/OCL.cmake:12 (cmake_policy): The OLD behavior for policy CMP0053 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. Call Stack (most recent call first): CMakeLists.txt:65 (include) -- Running constant fold tests device-libs CPACK_RPM_PACKAGE_RELEASE now is local -- <<< Gentoo configuration >>> Build type Release Install path /usr Compiler flags: C -O2 -march=native -pipe C++ -O2 -march=native -pipe Linker flags: Executable -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs Module -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs Shared -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -- Configuring done (2.2s) -- Generating done (0.1s) -- Build files have been written to: /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build >>> Source configured. >>> Compiling source in /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs ... * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs" * Build directory (BUILD_DIR): "/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build" ninja -v -j8 -l0 [1/668] /usr/lib/llvm/18/bin/clang++ -I/usr/lib/llvm/18/include -O2 -march=native -pipe -std=c++17 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -MD -MT utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o -MF utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o.d -o utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o -c /var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs/utils/prepare-builtins/prepare-builtins.cpp [2/668] : && /usr/lib/llvm/18/bin/clang++ -O2 -march=native -pipe -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o -o utils/prepare-builtins/prepare-builtins -L/usr/lib/llvm/18/lib64 -Wl,-rpath,/usr/lib/llvm/18/lib64 /usr/lib/llvm/18/lib64/libLLVM.so.18.1 && : FAILED: utils/prepare-builtins/prepare-builtins : && /usr/lib/llvm/18/bin/clang++ -O2 -march=native -pipe -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o -o utils/prepare-builtins/prepare-builtins -L/usr/lib/llvm/18/lib64 -Wl,-rpath,/usr/lib/llvm/18/lib64 /usr/lib/llvm/18/lib64/libLLVM.so.18.1 && : ld.lld: error: undefined symbol: llvm::MemoryBuffer::getFile(llvm::Twine const&, bool, bool, bool, std::__1::optional<llvm::Align>) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(main) ld.lld: error: undefined symbol: llvm::toString(llvm::Error) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(main) ld.lld: error: undefined symbol: llvm::ToolOutputFile::ToolOutputFile(llvm::StringRef, std::__1::error_code&, llvm::sys::fs::OpenFlags) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(main) ld.lld: error: undefined symbol: llvm::WriteBitcodeToFile(llvm::Module const&, llvm::raw_ostream&, bool, llvm::ModuleSummaryIndex const*, bool, std::__1::array<unsigned int, 5ul>*) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(main) ld.lld: error: undefined symbol: vtable for llvm::cl::OptionValue<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<llvm::cl::FormattingFlags, llvm::cl::desc, llvm::cl::initializer<char [2]>>(llvm::cl::FormattingFlags const&, llvm::cl::desc const&, llvm::cl::initializer<char [2]> const&)) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<char [2], llvm::cl::desc, llvm::cl::value_desc>(char const (&) [2], llvm::cl::desc const&, llvm::cl::value_desc const&)) >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) ld.lld: error: undefined symbol: vtable for llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<llvm::cl::FormattingFlags, llvm::cl::desc, llvm::cl::initializer<char [2]>>(llvm::cl::FormattingFlags const&, llvm::cl::desc const&, llvm::cl::initializer<char [2]> const&)) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::~opt()) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<char [2], llvm::cl::desc, llvm::cl::value_desc>(char const (&) [2], llvm::cl::desc const&, llvm::cl::value_desc const&)) >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) ld.lld: error: undefined symbol: vtable for llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<llvm::cl::FormattingFlags, llvm::cl::desc, llvm::cl::initializer<char [2]>>(llvm::cl::FormattingFlags const&, llvm::cl::desc const&, llvm::cl::initializer<char [2]> const&)) >>> referenced by prepare-builtins.cpp >>> utils/prepare-builtins/CMakeFiles/prepare-builtins.dir/prepare-builtins.cpp.o:(llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::opt<char [2], llvm::cl::desc, llvm::cl::value_desc>(char const (&) [2], llvm::cl::desc const&, llvm::cl::value_desc const&)) >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. * ERROR: dev-libs/rocm-device-libs-6.1.1::gentoo failed (compile phase): * ninja -v -j8 -l0 failed * * Call stack: * ebuild.sh, line 136: Called src_compile * environment, line 2340: Called cmake_src_compile * environment, line 917: Called cmake_build * environment, line 884: Called eninja * environment, line 1357: Called die * The specific snippet of code: * "$@" || die -n "${*} failed" * * If you need support, post the output of `emerge --info '=dev-libs/rocm-device-libs-6.1.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-libs/rocm-device-libs-6.1.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/temp/environment'. * Working directory: '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs_build' * S: '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/work/llvm-project-rocm-6.1.1/amd/device-libs'
* If you need support, post the output of `emerge --info '=dev-libs/rocm-device-libs-6.1.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-libs/rocm-device-libs-6.1.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-libs/rocm-device-libs-6.1.1/temp/environment'. Please _attach_ those files.
Created attachment 896908 [details] emerge --info output
Created attachment 896909 [details] emerge -pqv output
Created attachment 896910 [details] build.log
Created attachment 896911 [details] environment
Not OP, but I have the same issue here, I uploaded build.log and co
(In reply to Michel Ganguin from comment #6) > Not OP, but I have the same issue here, I uploaded build.log and co Thanks!
Same here, any updates?
Hi, all errors mentioning "undefined symbol: ... std::__1::..." are related to switch from libstdc++ to libc++ done on your side. If you actually want to use libc++ instead of libstdc++, could you run the following: emerge -av1 sys-devel/llvm emerge @preserved-rebuild Let me know if it helps. I don't think it can be fixed in ebuild. The problem is generic, has nothing specific with dev-libs/rocm-device-libs (i. e. affects all packages with C++ ABI), so I've described the fix here: https://wiki.gentoo.org/wiki/Clang#ld.lld:_error:_undefined_symbol:_..._std::_1::basic_string.
(In reply to Sv. Lockal from comment #9) > Hi, all errors mentioning "undefined symbol: ... std::__1::..." are related > to switch from libstdc++ to libc++ done on your side. > > If you actually want to use libc++ instead of libstdc++, could you run the > following: > > emerge -av1 sys-devel/llvm > emerge @preserved-rebuild > > Let me know if it helps. I don't think it can be fixed in ebuild. The > problem is generic, has nothing specific with dev-libs/rocm-device-libs (i. > e. affects all packages with C++ ABI), so I've described the fix here: > https://wiki.gentoo.org/wiki/Clang#ld.lld:_error:_undefined_symbol:_..._std:: > _1::basic_string. Ahh, I see. It's the default-libcxx USE flag ofr clang-common, that seemed to be harmless up until now. There also another related USE flag: libcxx for clang-runtime. I give it a spin without them...
Yes, clang-common[default-libcxx] is also enabled by default if you use llvm profile. libcxx has its own specifics: hip/rocm stack was probably never tested with it (at least new libraries), sometimes fails to build seemingly simple code - https://github.com/llvm/llvm-project/issues/98734 Other than LLVM, you will need to recompile all Qt applications, probably all dev-libs/boost runtime dependencies. https://wiki.gentoo.org/wiki/Profile_(Portage)#About_profile_changes says "It is not possible to change to profiles with a different ABI (e.g. pure LLVM or musl) without a reinstall", but idk, switching from libc++ works to some extent.
I can confirm it compiles without clang-common[default-libcxx] flag. sys-devel/clang-runtime[libcxx] doesn't harm. It says "Install sys-libs/libcxx for -stdlib=libc++"
(In reply to Omar Mohamed from comment #12) > I can confirm it compiles without clang-common[default-libcxx] flag. > > sys-devel/clang-runtime[libcxx] doesn't harm. > It says "Install sys-libs/libcxx for -stdlib=libc++" Compiles for me as well.
(In reply to Sv. Lockal from comment #11) > Yes, clang-common[default-libcxx] is also enabled by default if you use llvm > profile. > > libcxx has its own specifics: hip/rocm stack was probably never tested with > it (at least new libraries), sometimes fails to build seemingly simple code > - https://github.com/llvm/llvm-project/issues/98734 > > Other than LLVM, you will need to recompile all Qt applications, probably > all dev-libs/boost runtime dependencies. > > https://wiki.gentoo.org/wiki/Profile_(Portage)#About_profile_changes says > "It is not possible to change to profiles with a different ABI (e.g. pure > LLVM or musl) without a reinstall", but idk, switching from libc++ works to > some extent. Qt and boost uses gcc and glibc on my system. Is it really necessary to recompile? I have no preserved libs. However firefox, thunderbird and mesa for example uses llvm. Should I re-emerge these?
(In reply to Attila Tóth from comment #14) > Qt and boost uses gcc and glibc on my system. Is it really necessary to > recompile? I have no preserved libs. > However firefox, thunderbird and mesa for example uses llvm. Should I > re-emerge these? glibc/musl are a C libraries, C libraries and applications depending on them is not affected by switch between libstdc++ and libc++. You can get a very approximate list of affected packages with: equery depends dev-qt/qtcore dev-libs/boost sys-devel/llvm If I remember the ecosystem correctly Firefox and Thunderbird won't be there. Mesa is in the list. You will likely experience issues "undefined symbol: ... std::__1::..." (or opposite "undefined reference ...@@GLIBCXX...' like https://github.com/llvm/llvm-project/issues/98473) with these packages on next updates until you recompile them in correct order.