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

libclc/amdgcn: prepare-builtins.cpp.o: undefined reference to symbol '_ZN4llvm2cl6Option11addArgumentEv' #62018

Closed
illwieckz opened this issue Apr 8, 2023 · 4 comments
Labels
cmake Build system in general and CMake in particular

Comments

@illwieckz
Copy link
Contributor

illwieckz commented Apr 8, 2023

I get this while building libclc AMD GCN targets with LLVM 17-git (e58a493), 16.0.1 and 16.0.0 (I haven't tried to build older Git references):

/usr/bin/ld: CMakeFiles/prepare_builtins.dir/utils/prepare-builtins.cpp.o:
  undefined reference to symbol '_ZN4llvm2cl6Option11addArgumentEv'

I completely deleted the build and install directories on each attempt.

@nikic
Copy link
Contributor

nikic commented Apr 8, 2023

Which cmake command are you using?

@illwieckz
Copy link
Contributor Author

Hi @nikic here is the options I use to build llvm:

		-D'LLVM_BUILD_TOOLS'='ON' \
		-D'LLVM_ENABLE_ASSERTIONS'="${llvm_enable_assertions}" \
		-D'LLVM_ENABLE_PROJECTS'='clang' \
		-D'LLVM_ENABLE_RTTI'='ON' \
		-D'LLVM_BUILD_RUNTIME'='OFF' \
		-D'LLVM_BUILD_RUNTIMES'='OFF' \
		-D'LLVM_BUILD_TESTS'='OFF' \
		-D'LLVM_BUILD_UTILS'='OFF' \
		-D'LLVM_ENABLE_PLUGINS'='OFF' \
 		-D'LLVM_INCLUDE_BENCHMARKS'='OFF' \
 		-D'LLVM_INCLUDE_DOCS'='OFF' \
 		-D'LLVM_INCLUDE_EXAMPLES'='OFF' \
 		-D'LLVM_INCLUDE_TESTS'='OFF' \
		-D'LLVM_INCLUDE_UTILS'='OFF' \
		-D'LLVM_SPIRV_INCLUDE_TESTS'='OFF' \
		-D'LLVM_TARGETS_TO_BUILD'="AMDGPU;Native" \
		-D'LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR'="${workspace_dir}/SPIRV-Headers" \
		-D'CLANG_ENABLE_ARCMT'='OFF' \
		-D'CLANG_ENABLE_STATIC_ANALYZER'='OFF' \
		-D'CLANG_TOOL_DICTIONARY_BUILD'='OFF' \
		-D'CLANG_TOOL_HANDLE_CXX_BUILD'='OFF' \
		-D'CLANG_TOOL_HANDLE_LLVM_BUILD'='OFF'

I also set a symlink to SPIRV-LLVM-Translator to llvm-project/llvm/projects/SPIRV-LLVM-Translator before building llvm.

And here are the options I use to build libclc:

		-D'LIBCLC_TARGETS_TO_BUILD'='amdgcn-mesa-mesa3d;r600--;spirv-mesa3d-;spirv64-mesa3d-'

Details can be found there.

@illwieckz
Copy link
Contributor Author

I forgot to mention this are the defaults I use for all cmake projects in my scripts (they are added to the previously mentioned ones):

		-S'.' \
		-B'build' \
		-G'Ninja' \
		-D'CMAKE_INSTALL_PREFIX'="${install_dir}" \
		-D'CMAKE_BUILD_TYPE'="${cmake_build_type}" \
		-D'BUILD_SHARED_LIBS'='ON' \

This is a Release build.

@illwieckz
Copy link
Contributor Author

@nikic here is a fix:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular
Projects
None yet
Development

No branches or pull requests

3 participants