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

Fails on Arch Linux #307

Open
latekvo opened this issue Dec 31, 2024 · 0 comments · May be fixed by #308
Open

Fails on Arch Linux #307

latekvo opened this issue Dec 31, 2024 · 0 comments · May be fixed by #308

Comments

@latekvo
Copy link

latekvo commented Dec 31, 2024

Steps to get ikos 3.4 working on Arch

  • install llvm14 & llvm14-libs
  • cd ikos
  • mkdir build
  • cd build
  • cmake -DCMAKE_INSTALL_PREFIX=. -DIKOS_LINK_LLVM_DYLIB=ON ..
  • export LLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14
  • make

Issue details

upon running:

  • mkdir build
  • cd build
  • cmake -DCMAKE_INSTALL_PREFIX=. ..

I encountered the following error:

-- Found LLVM: /usr (found version "18.1.8")
CMake Error at frontend/llvm/CMakeLists.txt:107 (message):
  LLVM 14 is required.
Outdated details, reproduction and explanation

Outdated reproduction

  • install llvm14 & llvm14-libs
  • cd ikos
  • mkdir build
  • cd build
  • cmake -DCMAKE_INSTALL_PREFIX=. -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14 ..
  • cd frontend/llvm
  • modify the CMakeLists.txt:126 from OFF to ON
  • popd
  • export LLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14
  • make

Outdated details

Please note, that it found the 18.1.8 version only after manually setting some env vars, before that no version was found.

Fixed this issue by explicitly setting the llvm directory:

  • cmake -DCMAKE_INSTALL_PREFIX=. -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14 ..

Continuing with installation:

  • make

Resulted in the following error:

armado@arche:~/dev/ikos/build (master %) $ make
[  0%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/dot.cpp.o
[  1%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/namer.cpp.o
[  1%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/format/text.cpp.o
[  3%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/add_loop_counters.cpp.o
[  3%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/add_partitioning_variables.cpp.o
[  4%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/name_values.cpp.o
[  4%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/pass.cpp.o
[  6%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/simplify_cfg.cpp.o
[  6%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/pass/simplify_upcast_comparison.cpp.o
[  7%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/bundle.cpp.o
[  7%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/code.cpp.o
[  9%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/context.cpp.o
[  9%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/context_impl.cpp.o
[ 11%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/data_layout.cpp.o
[ 11%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/function.cpp.o
[ 11%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/intrinsic.cpp.o
[ 12%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/statement.cpp.o
[ 12%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/type.cpp.o
[ 14%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/semantic/value.cpp.o
[ 14%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/verify/frontend.cpp.o
[ 15%] Building CXX object ar/CMakeFiles/ikos-ar.dir/src/verify/type.cpp.o
[ 15%] Linking CXX static library libikos-ar.a
[ 15%] Built target ikos-ar
[ 15%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/initialize.cpp.o
[ 17%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/lower_cst_expr.cpp.o
[ 17%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/lower_select.cpp.o
[ 19%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/mark_internal_inline.cpp.o
[ 19%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/name_values.cpp.o
[ 20%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/remove_printf_calls.cpp.o
[ 20%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp-lib.dir/src/pass/remove_unreachable_blocks.cpp.o
[ 22%] Linking CXX static library libikos-pp.a
[ 22%] Built target ikos-pp-lib
[ 23%] Building CXX object frontend/llvm/CMakeFiles/ikos-pp.dir/src/ikos_pp.cpp.o
[ 23%] Linking CXX executable ikos-pp
/usr/bin/ld: cannot find -lLLVMAggressiveInstCombine: No such file or directory
/usr/bin/ld: cannot find -lLLVMAnalysis: No such file or directory
/usr/bin/ld: cannot find -lLLVMAsmParser: No such file or directory
/usr/bin/ld: cannot find -lLLVMBitReader: No such file or directory
/usr/bin/ld: cannot find -lLLVMBitWriter: No such file or directory
/usr/bin/ld: cannot find -lLLVMCodeGen: No such file or directory
/usr/bin/ld: cannot find -lLLVMCore: No such file or directory
/usr/bin/ld: cannot find -lLLVMCoroutines: No such file or directory
/usr/bin/ld: cannot find -lLLVMInstCombine: No such file or directory
/usr/bin/ld: cannot find -lLLVMInstrumentation: No such file or directory
/usr/bin/ld: cannot find -lLLVMipo: No such file or directory
/usr/bin/ld: cannot find -lLLVMIRReader: No such file or directory
/usr/bin/ld: cannot find -lLLVMMC: No such file or directory
/usr/bin/ld: cannot find -lLLVMObjCARCOpts: No such file or directory
/usr/bin/ld: cannot find -lLLVMScalarOpts: No such file or directory
/usr/bin/ld: cannot find -lLLVMTarget: No such file or directory
/usr/bin/ld: cannot find -lLLVMTransformUtils: No such file or directory
/usr/bin/ld: cannot find -lLLVMVectorize: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [frontend/llvm/CMakeFiles/ikos-pp.dir/build.make:108: frontend/llvm/ikos-pp] Error 1
make[1]: *** [CMakeFiles/Makefile2:1969: frontend/llvm/CMakeFiles/ikos-pp.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

It's happening because the llvm14-libs package in Arch extra repo only has the mono-library instead of all the individual libraries that failed to load:

$ ls /usr/lib/llvm14/*                                                                             2
/usr/lib/llvm14/bin:
bugpoint               dsymutil            llvm-cxxdump            llvm-libtool-darwin  llvm-PerfectShuffle  llvm-tapi-diff
c-index-test           FileCheck           llvm-cxxfilt            llvm-link            llvm-profdata        llvm-tblgen
clang                  llc                 llvm-cxxmap             llvm-lipo            llvm-profgen         llvm-tli-checker
clang++                lli                 llvm-debuginfod-find    llvm-lto             llvm-ranlib          llvm-undname
clang-14               lli-child-target    llvm-diff               llvm-lto2            llvm-rc              llvm-windres
clang-check            llvm-addr2line      llvm-dis                llvm-mc              llvm-readelf         llvm-xray
clang-cl               llvm-ar             llvm-dlltool            llvm-mca             llvm-readobj         not
clang-cpp              llvm-as             llvm-dwarfdump          llvm-ml              llvm-reduce          obj2yaml
clang-extdef-mapping   llvm-bcanalyzer     llvm-dwp                llvm-modextract      llvm-rtdyld          opt
clang-offload-bundler  llvm-bitcode-strip  llvm-extract            llvm-mt              llvm-sim             sancov
clang-offload-wrapper  llvm-cat            llvm-gsymutil           llvm-nm              llvm-size            sanstats
clang-refactor         llvm-cfi-verify     llvm-ifs                llvm-objcopy         llvm-split           split-file
clang-repl             llvm-config         llvm-install-name-tool  llvm-objdump         llvm-stress          verify-uselistorder
clang-scan-deps        llvm-cov            llvm-jitlink            llvm-opt-report      llvm-strings         yaml2obj
count                  llvm-c-test         llvm-jitlink-executor   llvm-otool           llvm-strip           yaml-bench
diagtool               llvm-cvtres         llvm-lib                llvm-pdbutil         llvm-symbolizer

/usr/lib/llvm14/include:
clang  clang-c  llvm  llvm-c

/usr/lib/llvm14/lib:
clang            libclang-cpp.so.14  libclang.so.14.0.6  libLLVMDemangle.a  libLLVMTableGen.a  libRemarks.so
cmake            libclang.so         libLLVM-14.0.6.so   libLLVM.so         libLTO.so          libRemarks.so.14
libclang-cpp.so  libclang.so.13      libLLVM-14.so       libLLVMSupport.a   libLTO.so.14       LLVMgold.so

/usr/lib/llvm14/share:
opt-viewer

This issue can be fixed by changing ikos/frontend/llvm/CMakeLists.txt line 126 from OFF to ON.

Then, after running make again, i encountered the following error:

armado@arche:~/dev/ikos/build (master *%) $ make                                                                                             2
CMake Deprecation Warning at CMakeLists.txt:41 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Install prefix: /home/armado/dev/ikos/install
-- Build type: Release
-- CMake version: 3.31.3
-- CMake generator: Unix Makefiles
-- Including core
CMake Deprecation Warning at core/CMakeLists.txt:41 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


Found Boost: /usr/lib/cmake/Boost-1.86.0 (found version "1.55.0")
Found Boost components:
   unit_test_framework
-- Could NOT find APRON. Please provide -DAPRON_ROOT=/path/to/apron (missing: APRON_INCLUDE_DIR APRON_APRON_LIB APRON_BOX_LIB APRON_OCT_LIB APRON_POLKA_LIB APRON_PPL_LIB APRON_PKGRID_LIB) 
-- Including ar
CMake Deprecation Warning at ar/CMakeLists.txt:41 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


Found Boost: /usr/lib/cmake/Boost-1.86.0 (found version "1.55.0")
-- Including frontend/llvm
CMake Deprecation Warning at frontend/llvm/CMakeLists.txt:41 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


Found Boost: /usr/lib/cmake/Boost-1.86.0 (found version "1.55.0")
Found Boost components:
   filesystem;system
CMake Error at frontend/llvm/CMakeLists.txt:107 (message):
  LLVM 14 is required.


-- Configuring incomplete, errors occurred!
make: *** [Makefile:968: cmake_check_build_system] Error 1

This is the exact issue we encountered earlier, except this time invoked by make instead of cmake, so i couldn't just set -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14, so instead, i used export LLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-14.

After that, running make resulted in successful compilation.

I'll look into the issues later, I think they should all be simple to fix. Unfortunately I'm not too familiar with C++, and especially make & cmake, so i'm not certain what kind of fixes are acceptable.

The root cause of this issue is that when mutliple llvm versions are installed in parrarell, the program names are: llvm-[something] for the latest version of llvm, and llvm-[something]-[version] for any other version. (e.g. llvm-config-14 instead of llvm-config).

llvm-config-14 in particular is used to determine library include dirs and cmake dirs, which also differ from regular llvm installation if multiple versions are installed in pararell.

On my machine, version 18, 15 and 14 of llvm are installed in parrarell, but due to the bug i described, only version 18 was considered, which resulted in the LLVM 14 is required error.

@latekvo latekvo changed the title Fails on Arch Linux. Fails on Arch Linux Dec 31, 2024
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

Successfully merging a pull request may close this issue.

1 participant