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

[Issue]: cmake build failed #156

Closed
yuqie opened this issue Aug 29, 2024 · 6 comments
Closed

[Issue]: cmake build failed #156

yuqie opened this issue Aug 29, 2024 · 6 comments

Comments

@yuqie
Copy link

yuqie commented Aug 29, 2024

Problem Description

I follow the readme to build the Docker image and full examples using CMake:

$ git clone https://github.com/ROCm/rocm-examples.git
$ cd rocm-examples/Dockerfiles
$ docker build . -t rocm-examples -f hip-libraries-rocm-ubuntu.Dockerfile  
$ docker run -it --device /dev/kfd --device /dev/dri rocm-examples bash 
# git clone https://github.com/ROCm/rocm-examples.git
# cd rocm-examples
# cmake -S . -B build 
# cmake --build build

some error I encountered

developer@c26d005341df:/workspaces/rocm-examples$ cmake -S . -B build
-- GPU_ARCHITECTURES: gfx942
-- GPU_ARCHITECTURES: gfx942
-- Google Test not found. Fetching...
-- Google Benchmark not found. Fetching...
-- LLVM FileCheck Found: /usr/bin/FileCheck
-- git version: v1.6.1 normalized to 1.6.1
-- Version: 1.6.1
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/rocm-examples/build
developer@c26d005341df:/workspaces/rocm-examples$ cmake --build build
developer@c26d005341df:/workspaces/rocm-examples$ cmake --build build
Scanning dependencies of target applications_bitonic_sort
[  0%] Built target applications_bitonic_sort
Scanning dependencies of target applications_convolution
[  1%] Built target applications_convolution
Scanning dependencies of target applications_floyd_warshall
[  1%] Built target applications_floyd_warshall
Scanning dependencies of target applications_histogram
[  2%] Built target applications_histogram
Scanning dependencies of target applications_monte_carlo_pi
[  3%] Built target applications_monte_carlo_pi
Scanning dependencies of target applications_prefix_sum
[  3%] Built target applications_prefix_sum
Scanning dependencies of target hip_llvm_ir_to_executable
[  3%] Linking HIP executable ../../bin/HIP-Basic/hip_llvm_ir_to_executable
ld.lld: error: undefined symbol: __hip_fatbin
>>> referenced by main.hip
>>>               CMakeFiles/hip_llvm_ir_to_executable.dir/main.hip.o:(__hip_fatbin_wrapper)
>>> did you mean: __hip_fatbin_
>>> defined in: main_device.o
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [HIP-Basic/llvm_ir_to_executable/CMakeFiles/hip_llvm_ir_to_executable.dir/build.make:111: bin/HIP-Basic/hip_llvm_ir_to_executable] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2599: HIP-Basic/llvm_ir_to_executable/CMakeFiles/hip_llvm_ir_to_executable.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

could anyone give me some advice?

Operating System

VERSION="22.04.4 LTS (Jammy Jellyfish)"

CPU

AMD EPYC 9654 96-Core Processor

GPU

AMD Instinct MI300X

ROCm Version

ROCm 6.1.0

ROCm Component

No response

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

@Snektron
Copy link
Collaborator

Hi, the functionality related to this has changed in a recent version of ROCm. Currently, there is only a tag for ROCm 6.2.0, so it would be best to use that version of ROCm with that version of the ROCm examples. If thats not possible or simply undesirable, I believe the related changes were introduced in PR #142, so perhaps you can try out 33dff59 if your ROCm version is less than 6.2.

@yuqie
Copy link
Author

yuqie commented Aug 30, 2024

Hi, the functionality related to this has changed in a recent version of ROCm. Currently, there is only a tag for ROCm 6.2.0, so it would be best to use that version of ROCm with that version of the ROCm examples. If thats not possible or simply undesirable, I believe the related changes were introduced in PR #142, so perhaps you can try out 33dff59 if your ROCm version is less than 6.2.

Thank you, I will try it with ROCm 6.2.0.

@ppanchad-amd
Copy link

Hi @yuqie. Did you have a chance to try with ROCm 6.2.0 to see if it resolves your issue. Thanks!

@zichguan-amd
Copy link

Hi @yuqie, please use the docker files from develop branch to create the docker image with ROCm 6.2.0 and use the rocm-6.2.0 tag inside the docker container to build the examples.

$ git clone https://github.com/ROCm/rocm-examples.git
$ cd rocm-examples/Dockerfiles
$ docker build . -t rocm-examples -f hip-libraries-rocm-ubuntu.Dockerfile --build-arg GID="$(getent group render | cut -d':' -f 3)"
$ docker run -it --device /dev/kfd --device /dev/dri rocm-examples bash
# git clone https://github.com/ROCm/rocm-examples.git
# cd rocm-examples
# git checkout rocm-6.2.0
# cmake -S . -B build 
# cmake --build build

@justinkb
Copy link

justinkb commented Jan 9, 2025

this isn't the exact same issue, but almost certainly related, so posting this here.

[1/2] Linking HIP executable bin\HIP-Basic\hip_assembly_to_executable.exe
FAILED: bin/HIP-Basic/hip_assembly_to_executable.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\PROGRA~1\AMD\ROCm\6.2\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview --offload-arch=gfx1100 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console --hip-link --rtlib=compiler-rt -fuse-ld=lld-link HIP-Basic/assembly_to_executable/main_device.obj HIP-Basic/assembly_to_executable/CMakeFiles/hip_assembly_to_executable.dir/main.hip.obj -o bin\HIP-Basic\hip_assembly_to_executable.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:HIP-Basic\assembly_to_executable\hip_assembly_to_executable.lib -Xlinker /pdb:bin\HIP-Basic\hip_assembly_to_executable.pdb -Xlinker /version:0.0 "C:/Program Files/AMD/ROCm/6.2/lib/amdhip64.lib" -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
clang++: warning: argument unused during compilation: '--rtlib=compiler-rt' [-Wunused-command-line-argument]
lld-link: error: undefined symbol: __hip_fatbin
>>> referenced by HIP-Basic/assembly_to_executable/CMakeFiles/hip_assembly_to_executable.dir/main.hip.obj:(__hip_fatbin_wrapper)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[2/2] Linking HIP executable bin\HIP-Basic\hip_llvm_ir_to_executable.exe
FAILED: bin/HIP-Basic/hip_llvm_ir_to_executable.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\PROGRA~1\AMD\ROCm\6.2\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O0 -g -Xclang -gcodeview --offload-arch=gfx1100 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console --hip-link --rtlib=compiler-rt -fuse-ld=lld-link HIP-Basic/llvm_ir_to_executable/main_device.obj HIP-Basic/llvm_ir_to_executable/CMakeFiles/hip_llvm_ir_to_executable.dir/main.hip.obj -o bin\HIP-Basic\hip_llvm_ir_to_executable.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:HIP-Basic\llvm_ir_to_executable\hip_llvm_ir_to_executable.lib -Xlinker /pdb:bin\HIP-Basic\hip_llvm_ir_to_executable.pdb -Xlinker /version:0.0 "C:/Program Files/AMD/ROCm/6.2/lib/amdhip64.lib" -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
clang++: warning: argument unused during compilation: '--rtlib=compiler-rt' [-Wunused-command-line-argument]
lld-link: error: undefined symbol: __hip_fatbin
>>> referenced by HIP-Basic/llvm_ir_to_executable/CMakeFiles/hip_llvm_ir_to_executable.dir/main.hip.obj:(__hip_fatbin_wrapper)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

this is with HIP SDK 24.Q4 for Windows

edit: I should note I patched CMakeLists.txt so it can find these tools, which are installed in the base dir instead of /llvm subdirectory on HIP SDK ROCM root directorys.

'llvm-dis', 'llvm-mc', or 'clang-offload-bundler' not found, not building assembly example.
'llvm-mc' or 'clang-offload-bundler' not found, not building LLVM IR example.

This exposes this issue.

@zichguan-amd
Copy link

Hi @justinkb, please open a new issue and specify the Windows driver version, how are you building the examples and which branch are you based on. HIP SDK issues will differ from Linux ones.

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

No branches or pull requests

5 participants