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

Codon v0.17.0 compilation failure with LLVM 18 #590

Open
admnd opened this issue Sep 13, 2024 · 3 comments
Open

Codon v0.17.0 compilation failure with LLVM 18 #590

admnd opened this issue Sep 13, 2024 · 3 comments

Comments

@admnd
Copy link

admnd commented Sep 13, 2024

On a Gentoo box with LLVM 18.1.8 the build aborts with:

[ 77%] Building CXX object CMakeFiles/codonc.dir/codon/parser/visitors/typecheck/assign.cpp.o
[ 77%] Building CXX object CMakeFiles/codonc.dir/codon/parser/visitors/typecheck/basic.cpp.o
[ 77%] Building CXX object CMakeFiles/codonc.dir/codon/parser/visitors/typecheck/call.cpp.o
/tmp/codon/codon/compiler/memory_manager.cpp: In member function ‘virtual void codon::BoehmGCJITLinkMemoryManager::allocate(const llvm::jitlink::JITLinkDylib*, llvm::jitlink::LinkGraph&, llvm::jitlink::JITLinkMemoryManager::OnAllocatedFunction)’:
/tmp/codon/codon/compiler/memory_manager.cpp:182:13: error: ‘class llvm::orc::AllocGroup’ has no member named ‘getMemLifetimePolicy’; did you mean ‘constexpr const unsigned int llvm::orc::AllocGroup::BitsForLifetimePolicy’? (not accessible from this context)
  182 |         (AG.getMemLifetimePolicy() == llvm::orc::MemLifetimePolicy::Standard)
      |             ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/llvm/18/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h:21,
                 from /usr/lib/llvm/18/include/llvm/ExecutionEngine/JITLink/JITLink.h:20,
                 from /tmp/codon/./codon/cir/llvm/llvm.h:28,
                 from /tmp/codon/codon/compiler/memory_manager.h:9,
                 from /tmp/codon/codon/compiler/memory_manager.cpp:3:
/usr/lib/llvm/18/include/llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h:115:29: note: declared private here
  115 |   static constexpr unsigned BitsForLifetimePolicy = 2;
      |                             ^~~~~~~~~~~~~~~~~~~~~
/tmp/codon/codon/compiler/memory_manager.cpp:182:50: error: ‘llvm::orc::MemLifetimePolicy’ has not been declared
  182 |         (AG.getMemLifetimePolicy() == llvm::orc::MemLifetimePolicy::Standard)
      |                                                  ^~~~~~~~~~~~~~~~~
/tmp/codon/codon/compiler/memory_manager.cpp:186:36: error: expected primary-expression before ‘char’
  186 |     Seg.WorkingMem = SegAddr.toPtr<char *>();
make[2]: *** [CMakeFiles/codonc.dir/build.make:156: CMakeFiles/codonc.dir/codon/compiler/memory_manager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:812: CMakeFiles/codonc.dir/all] Error 2
@arshajii
Copy link
Contributor

Hi @admnd -- Codon requires LLVM 17 currently. We use a LLVM fork with a few modifications: https://github.com/exaloop/llvm-project

@bvlgah
Copy link

bvlgah commented Nov 19, 2024

Hi, Codon is an interesting project. I have tried to compile with LLVM 20. It fails because LLVM APIs have changed a lot since the version 17, and the failure reported by this issue is just one of them (i.e. llvm::orc::MemLifetimePolicy has been renamed to llvm::orc::MemLifetime). I just made some changes to Codon today, and it seems to work with the naive fib.py.

@bvlgah
Copy link

bvlgah commented Nov 19, 2024

And I think it would be more intuitive for developers to know that LLVM 17 is required by adding version to find_package in CMakeLists.txt.

codon/CMakeLists.txt

Lines 35 to 39 in d13d6a5

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(LLVM REQUIRED)

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

3 participants