Open barracuda156 opened 10 months ago
I noticed that originally Clang-17 was used with LLVM-16:
[ 75%] Building CXX object src/libasr/CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o cd /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/build/src/libasr && /opt/local/bin/clang++-mp-17 -DHAVE_TARGET_AARCH64=1 -DHAVE_WHEREAMI=1 -DHAVE_ZLIB=1 -DLCOMPILERS_FAST_ALLOC=1 -I/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/build/src/libasr/.. -I/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/.. -isystem /opt/local/libexec/llvm-16/include -isystem /opt/local/include -pipe -Os -DNDEBUG -I/opt/local/include -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Wall -Wextra -O3 -march=native -funroll-loops -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -mmacosx-version-min=14.0 -fPIC -fno-rtti -std=gnu++17 -Wno-deprecated-declarations -MD -MT src/libasr/CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o -MF CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o.d -o CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o -c /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/llvm_utils.cpp In file included from /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:57: /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/../libasr/codegen/KaleidoscopeJIT.h:74:15: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'? 74 | auto RM = Optional<Reloc::Model>(); | ^ /opt/local/libexec/llvm-17/bin/../include/c++/v1/optional:695:36: note: 'std::optional' declared here 695 | class _LIBCPP_DECLSPEC_EMPTY_BASES optional | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:181:38: error: expected '(' for function-style cast or type construction 181 | llvm::Optional<llvm::Reloc::Model> RM = llvm::Reloc::Model::PIC_; | ~~~~~~~~~~~~~~~~~~^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:181:11: error: no member named 'Optional' in namespace 'llvm' 181 | llvm::Optional<llvm::Reloc::Model> RM = llvm::Reloc::Model::PIC_; | ~~~~~~^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:181:40: error: use of undeclared identifier 'RM' 181 | llvm::Optional<llvm::Reloc::Model> RM = llvm::Reloc::Model::PIC_; | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/llvm_utils.cpp:1380:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 1380 | fn->getBasicBlockList().push_back(bb); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-16/include/llvm/IR/Function.h:728:29: note: declared private here 728 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:182:73: error: use of undeclared identifier 'RM' 182 | TM = target->createTargetMachine(target_triple, CPU, features, opt, RM); | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/asr_to_llvm.cpp:248:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 248 | fn->getBasicBlockList().push_back(bb); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-16/include/llvm/IR/Function.h:728:29: note: declared private here 728 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/asr_to_llvm.cpp:4856:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 4856 | fn->getBasicBlockList().push_back(blockend); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-16/include/llvm/IR/Function.h:728:29: note: declared private here 728 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ 1 error generated.
However with LLVM-17 it still fails:
[ 75%] Building CXX object src/libasr/CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o cd /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/build/src/libasr && /opt/local/bin/clang++-mp-17 -DHAVE_TARGET_AARCH64=1 -DHAVE_WHEREAMI=1 -DHAVE_ZLIB=1 -DLCOMPILERS_FAST_ALLOC=1 -I/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/build/src/libasr/.. -I/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/.. -isystem /opt/local/libexec/llvm-17/include -isystem /opt/local/include -pipe -Os -DNDEBUG -I/opt/local/include -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -Wall -Wextra -O3 -march=native -funroll-loops -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -mmacosx-version-min=14.0 -fPIC -fno-rtti -std=gnu++17 -Wno-deprecated-declarations -MD -MT src/libasr/CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o -MF CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o.d -o CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o -c /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/llvm_utils.cpp /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/evaluator.cpp:39:10: fatal error: 'llvm/Transforms/IPO/PassManagerBuilder.h' file not found 39 | #include <llvm/Transforms/IPO/PassManagerBuilder.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make[2]: *** [src/libasr/CMakeFiles/asr.dir/codegen/evaluator.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/llvm_utils.cpp:1380:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 1380 | fn->getBasicBlockList().push_back(bb); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-17/include/llvm/IR/Function.h:738:29: note: declared private here 738 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/asr_to_llvm.cpp:248:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 248 | fn->getBasicBlockList().push_back(bb); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-17/include/llvm/IR/Function.h:738:29: note: declared private here 738 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ 1 error generated. make[2]: *** [src/libasr/CMakeFiles/asr.dir/codegen/llvm_utils.cpp.o] Error 1 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_lang_lpython/lpython/work/lpython-0.20.0/src/libasr/codegen/asr_to_llvm.cpp:4856:13: error: 'getBasicBlockList' is a private member of 'llvm::Function' 4856 | fn->getBasicBlockList().push_back(blockend); | ~~~~^~~~~~~~~~~~~~~~~ /opt/local/libexec/llvm-17/include/llvm/IR/Function.h:738:29: note: declared private here 738 | BasicBlockListType &getBasicBlockList() { return BasicBlocks; } | ^ 2 errors generated. make[2]: *** [src/libasr/CMakeFiles/asr.dir/codegen/asr_to_llvm.cpp.o] Error 1
Without linking to LLVM it builds fine.
LLVM 17 is not supported yet, but LLVM 16 should work. We need to fix that.
I noticed that originally Clang-17 was used with LLVM-16:
However with LLVM-17 it still fails: