c3lang / c3c

Compiler for the C3 language
GNU Lesser General Public License v3.0
2.63k stars 152 forks source link

[c3c on aarch64] wont compile on termux #1396

Closed TymekBrunka closed 3 days ago

TymekBrunka commented 2 weeks ago

Minor isssue, just wanted to try out c3 and also do c3 stuff on phone but there are no release binaries for arm.

Is is possible to compile c3c on and for aarch64?

lerno commented 2 weeks ago

As long as you're able to compile LLVM and LLD for it so you have those libraries, it should be straightforward to compile c3c.

TymekBrunka commented 2 weeks ago
~/c3c/build $ cmake -DLLVM_DIR=/usr/local/opt/llvm/lib/cmake/llvm/ ..
-- The C compiler identification is Clang 18.1.8
-- The CXX compiler identification is Clang 18.1.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
C3C version: 0.6.2
-- Found CURL: /data/data/com.termux/files/usr/lib/libcurl.so (found version "8.9.1")
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /data/data/com.termux/files/usr/lib/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /data/data/com.termux/files/usr/lib/libtinfo.so
-- Found ZLIB: /data/data/com.termux/files/usr/lib/libz.so (found version "1.3.1")
-- Found zstd: /data/data/com.termux/files/usr/lib/libzstd.so
-- Found LibXml2: /data/data/com.termux/files/usr/lib/libxml2.so (found version "2.13.3")
CMake Error at /data/data/com.termux/files/usr/lib/cmake/llvm/LLVMExports.cmake:1834 (message):
  The imported target "LLVMDemangle" references the file

     "/data/data/com.termux/files/usr/lib/libLLVMDemangle.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/data/data/com.termux/files/usr/lib/cmake/llvm/LLVMExports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /data/data/com.termux/files/usr/lib/cmake/llvm/LLVMConfig.cmake:364 (include)
  CMakeLists.txt:133 (find_package)

-- Configuring incomplete, errors occurred!
lerno commented 1 week ago

Maybe you only have dynamically linked libraries available? If so the use -DC3_LINK_DYNAMIC=true with CMake.

lerno commented 1 week ago

Were you able to solve this?

lerno commented 1 week ago

Should I close this?

TymekBrunka commented 1 week ago

...

TymekBrunka commented 4 days ago

there is no /usr/local on termux and the flag doesnt work both with and without -DLLVM_DIR

lerno commented 4 days ago

Did you try the -DC3_LINK_DYNAMIC=true flag?

TymekBrunka commented 4 days ago

yes, that's the flag i was talking about

lerno commented 4 days ago

So you get the CMake error?

TymekBrunka commented 3 days ago

yes (just found out that there are libllvm and libllvm-static separetely and installed libllvm-static) and btw what is (/usr)/bin/FileCheck that it failed to find?

lerno commented 3 days ago

This is what it failed to get libLLVMDemangle

TymekBrunka commented 3 days ago

do i have to install it or what?

lerno commented 3 days ago

It is (unfortunately) not unusual that the LLVM libs are broken. So I would look for maybe earlier or later LLVM packages and see if they work. The error you see is in LLVM's own CMake script(!) which is run before any C3 compilation.

TymekBrunka commented 3 days ago

Ok, so basicly termux llvm doesnt support even setting up build directory, ok, thank you for info.

lerno commented 2 days ago

We'll try to set up LLVM builds for various linux variants later, that way we'll have everyone covered regardless of LLVM support through package managers.