Skip to content

CMake error building from source #130

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

Closed
Vexu opened this issue Oct 11, 2022 · 4 comments
Closed

CMake error building from source #130

Vexu opened this issue Oct 11, 2022 · 4 comments

Comments

@Vexu
Copy link
Member

Vexu commented Oct 11, 2022

I tried to build Windows tarball for ziglang/zig#12994 but got

ld: cannot find -lzstd.so.1.5.2: No such file or directory

I fixed this with

diff --git a/build b/build
index 96286dd72..35686a7a2 100755
--- a/build
+++ b/build
@@ -36,6 +36,7 @@ cmake "$ROOTDIR/llvm" \
   -DLLVM_ENABLE_BINDINGS=OFF \
   -DLLVM_ENABLE_OCAMLDOC=OFF \
   -DLLVM_ENABLE_Z3_SOLVER=OFF \
+  -DLLVM_ENABLE_ZSTD=OFF \
   -DCLANG_BUILD_TOOLS=OFF \
   -DCLANG_INCLUDE_DOCS=OFF \
   -DLLVM_INCLUDE_DOCS=OFF \

but I'm not sure how correct that is.

I ran into #127 which I was able to fix by applying ziglang/zig#12898 after which I ran into:

CMake Error at /usr/share/cmake/Modules/CMakeDetermineRCCompiler.cmake:47 (get_filename_component):
  get_filename_component unknown component windres
Call Stack (most recent call first):
  /usr/share/cmake/Modules/Platform/Windows-GNU.cmake:163 (enable_language)
  /usr/share/cmake/Modules/Platform/Windows-Clang.cmake:217 (__windows_compiler_gnu)
  /usr/share/cmake/Modules/Platform/Windows-Clang.cmake:227 (__windows_compiler_clang_base)
  /usr/share/cmake/Modules/Platform/Windows-Clang-C.cmake:2 (__windows_compiler_clang)
  /usr/share/cmake/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:4 (project)
@matu3ba
Copy link

matu3ba commented Oct 15, 2022

Upstreams definitions are here: https://github.com/Kitware/CMake/blob/master/Modules/CMakeDetermineRCCompiler.cmake

CMake debugging commands are these:

# Debugging
# --trace,  --trace-expand, --debug-output
# run cmake with -LH to get all variables printed after configuration.

# function(PRINT_VAR VARNAME)
#   message(STATUS "${VARNAME}: ${${VARNAME}}")
# endfunction()
# PRINT_VAR("CMAKE_CXX_COMPILER")

# cmake -P to run a single script

You could either use some of the debugging commands or "printf" on the module code.

@Vexu
Copy link
Member Author

Vexu commented Oct 17, 2022

I updated my system and pulled the latest changes and was able to build LLVM using system C++ compiler, stage1, stage2 and then failing stage3 with:

[100%] Building stage3
error(compilation): clang failed with stderr: zig-bootstrap/zig/src/stage1/codegen.cpp:4838:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'
zig-bootstrap/zig/src/stage1/codegen.cpp:5183:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'

@matu3ba
Copy link

matu3ba commented Oct 18, 2022

This looks exactly like ziglang/zig#12888, which was fixed in some later Zig commit ziglang/zig#12898 (0b47e69).

@Vexu
Copy link
Member Author

Vexu commented Oct 18, 2022

I had that commit patched separately but then also accidentally reverted it in a merge conflict. With the revert reverted it now builds stage3 successfully. I'll let the build run and close when it succeeds.

@Vexu Vexu closed this as completed Oct 18, 2022
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

No branches or pull requests

2 participants