Skip to content

[Issue] Linux ASAN CI: storage-libs / hipfile build fails — "undefined symbols pthread_getspecific/pthread_key_create/pthread_setspecific/pthread_key_delete (missing Threads::Threads linkage in hipfile test CMakeLists)" #5898

Closed

Description

@amd-chiranjeevi

Context

Summary

The storage-libs / hipfile stage fails during the link phase for all three test executables (hipfile_tests, hipfile_system_tests, test/amd_detail/internal_tests) with undefined symbol errors from libgtest.a / libgmock.a:

[hipfile] FAILED: test/hipfile_tests
[hipfile] ld.lld: error: undefined symbol: pthread_getspecific
[hipfile] >>> referenced by gtest-port.h:1774
[hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::~UnitTestImpl()) in archive .../libgtest.a
[hipfile] ld.lld: error: undefined symbol: pthread_key_delete
[hipfile] ld.lld: error: undefined symbol: pthread_key_create
[hipfile] ld.lld: error: undefined symbol: pthread_setspecific
[hipfile] clang++: error: linker command failed with exit code 1

Root Cause

The hipfile test CMakeLists files in rocm-systems (pinned at 7ced1a6) do not link Threads::Threads (i.e., -lpthread) for the test executables:

  • projects/hipfile/test/CMakeLists.txt — hipfile_tests and hipfile_system_tests link only against GTest::gtest (and GTest::gtest_main), with no Threads::Threads
  • projects/hipfile/test/amd_detail/CMakeLists.txt — calls find_package(Threads REQUIRED) but does not add target_link_libraries(internal_tests PRIVATE Threads::Threads)

ld.lld (LLVM's linker, used in the ASAN toolchain) is strict about undefined symbols in static archives. GTest's ThreadLocal<T> implementation uses POSIX thread-key APIs (pthread_key_create, etc.) from gtest-port.h:1774–1819, which require explicit -lpthread linkage under lld. GNU ld resolves these transitively from glibc, masking the bug in non-ASAN builds.

Activity

  1. amd-chiranjeevi commented on Jun 17, 2026

    @amd-chiranjeevi
    ContributorAuthor

    @derobins
    created revert: #5899

  2. derobins commented on Jun 17, 2026

    @derobins
    Contributor

    Can we just fix this instead of reverting? Reverting seems a bit harsh.

  3. ScottTodd commented on Jun 17, 2026

    @ScottTodd
    Member

    Given that ASan builds are not running by default on PRs I'm comfortable attempting a fix-forward before we jump straight to a revert in this case. Note that since any fixes would probably be in rocm-systems, we could carry a patch (https://github.com/ROCm/TheRock/tree/main/patches) here while we wait for a rocm-systems submodule update


    To test changes on CI...

    Here in TheRock it looks like ASan builds run on PRs if the PR modifies submodules, with no label to force it enabled:

    # Skip ASAN on PRs unless submodule changes are present.
    # This avoids running expensive ASAN builds on every PR while still
    # catching ASAN issues when library code (submodules) changes.
    # TODO: Contributors may open draft PRs with submodule updates which run ASAN builds.
    # If overly expensive, remove that option
    if (
    ci_inputs.is_pull_request
    and ci_inputs.build_variant == "asan"
    and git_context.changed_files is not None
    and git_context.submodule_paths is not None
    ):
    matching = set(git_context.submodule_paths) & set(git_context.changed_files)
    if not matching:
    print(" Skipping: ASAN PR without submodule changes")
    return True

    https://github.com/ROCm/TheRock/blob/main/.github/workflows/multi_arch_ci_asan.yml can be triggered directly with workflow_dispatch from a branch though.

    Over in rocm-systems, there is a "multi arch CI asan" workflow drafted at ROCm/rocm-systems#6610

  4. ScottTodd commented on Jun 17, 2026

    @ScottTodd
    Member

    Another option would be:

    1. Revert here in TheRock
    2. Fix in rocm-systems
    3. Re-land at the same time or shortly after the next rocm-systems submodule update containing the fix
  5. changed the title [-][Issue] Linux ASAN CI: storage-libs / hipfile build fails — `undefined symbols pthread_getspecific/pthread_key_create/pthread_setspecific/pthread_key_delete (missing Threads::Threads linkage in hipfile test CMakeLists)`[/-] [+][Issue] Linux ASAN CI: storage-libs / hipfile build fails — "undefined symbols pthread_getspecific/pthread_key_create/pthread_setspecific/pthread_key_delete (missing Threads::Threads linkage in hipfile test CMakeLists)"[/+] on Jun 17, 2026
  6. gaoikawa commented on Jun 17, 2026

    @gaoikawa

    Merged PR ROCm/rocm-systems#7387, presumably we will need a successful rocm-systems bump PR for TheRock to pickup the change.

  7. amd-chiranjeevi commented on Jun 18, 2026

    @amd-chiranjeevi
    ContributorAuthor

    @derobins @gaoikawa
    Still noticing these failures in rocm-systems bump(#5946) which is carrying the fix rocm-system#7387
    commit diff: ROCm/rocm-systems@7ced1a6...c59673f

    log: https://github.com/ROCm/TheRock/actions/runs/27729666076/job/82053632711?pr=5946

    __w/TheRock/TheRock/build/core/clr/dist/lib/llvm/lib/clang/23/lib/linux/libclang_rt.builtins-x86_64.a && :
    [hipfile] ld.lld: error: undefined symbol: pthread_getspecific
    [hipfile] >>> referenced by gtest-port.h:1774 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1774)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::~UnitTestImpl()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1774 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1774)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::~UnitTestImpl()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1812 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1812)
    [hipfile] >>>               gmock-all.cc.o:(testing::InSequence::InSequence()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] >>> referenced 10 more times
    [hipfile] 
    [hipfile] ld.lld: error: undefined symbol: pthread_key_delete
    [hipfile] >>> referenced by gtest-port.h:1778 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1778)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::~UnitTestImpl()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1778 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1778)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::~UnitTestImpl()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1778 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1778)
    [hipfile] >>>               gmock-all.cc.o:(testing::internal::ThreadLocal<testing::Sequence*>::~ThreadLocal()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] >>> referenced 2 more times
    [hipfile] 
    [hipfile] ld.lld: error: undefined symbol: pthread_setspecific
    [hipfile] >>> referenced by gtest-port.h:1819 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1819)
    [hipfile] >>>               gmock-all.cc.o:(testing::InSequence::InSequence()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] >>> referenced by gtest-port.h:1819 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1819)
    [hipfile] >>>               gmock-all.cc.o:(testing::InSequence::InSequence()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] >>> referenced by gtest-port.h:1819 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1819)
    [hipfile] >>>               gmock-all.cc.o:(testing::InSequence::~InSequence()) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] >>> referenced 5 more times
    [hipfile] 
    [hipfile] ld.lld: error: undefined symbol: pthread_key_create
    [hipfile] >>> referenced by gtest-port.h:1805 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1805)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::UnitTestImpl(testing::UnitTest*)) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1805 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1805)
    [hipfile] >>>               gtest-all.cc.o:(testing::internal::UnitTestImpl::UnitTestImpl(testing::UnitTest*)) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgtest.a
    [hipfile] >>> referenced by gtest-port.h:1805 (/__w/TheRock/TheRock/build/third-party/googletest/source/googletest/include/gtest/internal/gtest-port.h:1805)
    [hipfile] >>>               gmock-all.cc.o:(_GLOBAL__sub_I_gmock_all.cc) in archive /__w/TheRock/TheRock/build/third-party/googletest/dist/lib/libgmock.a
    [hipfile] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    [hipfile] ninja: build stopped: subcommand failed.
    ninja: build stopped: cannot make progress due to previous errors.
    Error: Process completed with exit code 1.
    0s
    0s
    0s
    
  8. added theissue type on Jun 18, 2026
  9. gaoikawa commented on Jun 18, 2026

    @gaoikawa

    @amd-chiranjeevi - Acknowledging - will look into it - thanks.

  10. rahulc-gh commented on Jun 18, 2026

    @rahulc-gh
    Contributor
  11. gaoikawa commented on Jun 19, 2026

    @gaoikawa

    We are getting a different error now though.

    [hipfile install] /__w/TheRock/TheRock/build/storage-libs/hipfile/build/test/hipfile_tests: error while loading shared libraries: librocm_sysdeps_mount.so.1: cannot open shared object file: No such file or directory

    Update - was caused by ROCm/rocm-systems#7431

  12. gaoikawa commented on Jun 19, 2026

    @gaoikawa

    FYI - In the case of the hipfile_tests mount dependency issue, @derobins has reverted the change that caused this new 2nd issue: ROCm/rocm-systems#7484 Unblocks theRock CI. Will need to do a proper fix.

  13. gaoikawa commented on Jun 19, 2026

    @gaoikawa

    We think that ROCm/rocm-systems#7519 fixes this. Waiting for bumpPR + asan CI signal to confirm. Thanks.

    Re-open this if it's still not fixed.

  14. derobins commented on Jun 20, 2026

    @derobins
    Contributor

    FWIW, TheRock still hasn't done a submodule bump that would bring our changes in, so we can't tell if it's fixed.

  15. derobins commented on Jun 20, 2026

    @derobins
    Contributor

    It looks like everything is fine now, given the results of this rocm-systems bump PR's CI:

    https://github.com/ROCm/TheRock/actions/runs/27855298319/job/82463564195

  16. added
    gfx94X-dcgpu
    gfx950-dcgpu
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

asan-failuresbump-prcode-regressiongfx94X-dcgpugfx950-dcgpumonitoringplatform: Linuxproject: hipfile

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions