ROCm / rocm-examples

A collection of examples for the ROCm software stack
MIT License
149 stars 38 forks source link

[Issue]: cmake build failed #156

Open yuqie opened 2 weeks ago

yuqie commented 2 weeks ago

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 commented 2 weeks ago

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 33dff5992b81d5e12f62233df90840418bd2589a if your ROCm version is less than 6.2.

yuqie commented 2 weeks ago

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.