Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable hip-clang with cmake changes to link -lpthread and -lm #29

Closed
wants to merge 1 commit into from

Conversation

aaronenyeshi
Copy link
Contributor

This will help fix build issues for tests using hip-clang.

@@ -56,6 +56,10 @@ foreach(test_src ${rocRAND_TEST_SRCS})
foreach(amdgpu_target ${AMDGPU_TARGETS})
target_link_libraries(${test_name} --amdgpu-target=${amdgpu_target})
endforeach()
if(CMAKE_CXX_COMPILER MATCHES ".*/hipcc$")
# hip-clang needs specific flag to turn on pthread and m
target_link_libraries(${test_name} -lpthread -lm)
Copy link
Contributor

@jszuppe jszuppe Aug 16, 2018

Choose a reason for hiding this comment

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

It should be target_link_libraries(${test_name} m). As for pthread:

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)

should be in cmake/Dependencies.cmake (if it's needed only for tests then it should be in test dependencies section) and later target_link_libraries(${test_name} Threads::Threads). See https://cmake.org/cmake/help/latest/module/FindThreads.html

@aaronenyeshi
Copy link
Contributor Author

Fixed with HIP PR ROCm/HIP#637

@aaronenyeshi aaronenyeshi deleted the hip-clang branch August 21, 2018 17:59
@ax3l
Copy link

ax3l commented Sep 3, 2021

The linked PR is not a fix but a work-around.
If one builds against rocRAND with clang -x hip directly, e.g., with recent CMake builds - then rocRAND should declare its public link dependencies directly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants