Closed marioroy closed 9 months ago
Ping...
I tried the latest llvm-17 branch commit da65536ef12f1976a78f46d614ddcc2e47066d39 without the above patch. The build fails on Clear Linux.
FAILED: CMakeFiles/codonc.dir/codon/parser/common.cpp.o
... codon/parser/common.cpp:176:19: error: use of undeclared identifier 'PATH_MAX'
176 | char buffer[PATH_MAX < 1024 ? 1024 : PATH_MAX];
| ^
... codon/parser/common.cpp:176:44: error: use of undeclared identifier 'PATH_MAX'
176 | char buffer[PATH_MAX < 1024 ? 1024 : PATH_MAX];
| ^
... codon/parser/common.cpp:181:17: error: use of undeclared identifier 'PATH_MAX'
181 | char path[PATH_MAX];
| ^
3 errors generated.
CMake Error at build/cmake_install.cmake:88 (file):
file INSTALL cannot find "build/libcodonc.so": No such file or directory.
Adding the line #include <climits>
to codon/parser/common.cpp
resolves the issue, allowing the build to succeed. The following is how I build codon.
#!/bin/bash
# build_codon-17.sh
# git clone --depth 1 -b llvm-17 https://github.com/exaloop/codon codon-17
# cd codon-17
# Add include line to codon/parser/common.cpp
# #include <climits>;
unset CFLAGS
unset CXXFLAGS
export CC=clang
export CXX=clang++
rm -fr build
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR=../llvm-17/install/lib/cmake/llvm \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCODON_GPU=ON
cmake --build build --config Release && \
cmake --install build --prefix=install
For the llvm dependency, I built using the codon-17
branch.
#!/bin/bash
# build_llvm-17.sh
# git clone --depth 1 -b codon-17 https://github.com/exaloop/llvm-project llvm-17
unset CFLAGS
unset CXXFLAGS
export CC=clang
export CXX=clang++
rm -fr llvm-17/build
cmake -S llvm-17/llvm -B llvm-17/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;NVPTX;WebAssembly;X86"
cmake --build llvm-17/build && \
cmake --install llvm-17/build --prefix=llvm-17/install
Hi @marioroy, I've added this include to the llvm-17
branch. Let me know if there are any other issues.
There are three errors on Linux building the llvm-17 branch.
I added the
<climits>
include line incodon/parser/common.cpp
for the build to succeed.