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

Build fails on Arch Linux #308

Open
elliottslaughter opened this issue Sep 18, 2018 · 3 comments
Open

Build fails on Arch Linux #308

elliottslaughter opened this issue Sep 18, 2018 · 3 comments

Comments

@elliottslaughter
Copy link
Member

With the following Dockerfile:

FROM archlinux/base:latest

RUN pacman -Syu --noconfirm && \
    pacman -S --noconfirm base-devel git wget clang llvm && \
    pacman -Scc --noconfirm

RUN git clone -b master https://github.com/zdevito/terra.git && \
    make -C terra

I get the following error:

# extract needed LLVM objects based on a dummy linker invocation
< build/llvm_objects/llvm_list build/bin/luajit-2.0.5 src/unpacklibraries.lua build/llvm_objects
ar: invalid option -- 'n'
Usage: ar [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       ar -M [<mri-script]
@elliottslaughter
Copy link
Member Author

The reason this fails is that the current Arch packages for LLVM and Clang 6.0 do not include static libraries for Clang. Therefore, I don't think it will be possible to build Terra with the current Arch packages, without teaching Terra to first build from dynamic libraries.

@SaphireLattice
Copy link

SaphireLattice commented Mar 1, 2019

I have managed to build Terra main binary on arch. It works pretty ok, all tests passed except for the single one. Of course that test is "dynlib" that itself assumes the same thing as the Terra Makefile: that clang and LLVM are static. (edit: nevermind, it just couldn't find the luajit lib because of hacking around with the compiler commands manually instead of letting makefile do stuff by itself... after I also additionally compiled the terra.so with dynamic link th clang and LLVM like in below command)

But yeah, it can be build on Arch, on dynamic libraries, while making every single test work. It just needs a whack into build statements.
Namely, my resulting working statement ended up as

g++ -o release/bin/terra -g -Wl,-export-dynamic -Wl,--whole-archive build/terra.o -Wl,--no-whole-archive  -lcurses  -lz -ldl -pthread -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST -lclangLex -lclangBasic build/lib/libluajit-5.1.a -lLLVM build/lctype.o build/linenoise.o build/lj_strscan.o build/llex.o build/lobject.o build/lparser.o build/lstring.o build/lzio.o build/main.o build/tcompiler.o build/tcuda.o build/tcwrapper.o build/tdebug.o build/tinline.o build/tinternalizedfiles.o build/tkind.o build/tllvmutil.o build/treadnumber.o build/lib/libluajit-5.1.a```

@elliottslaughter
Copy link
Member Author

We may theoretically be able to make this work out of the box now with CMake. I'm not sure that FindClang.cmake is robust enough to handle Clang's dynamic libraries, but I'm sure that can be fixed with some effort.

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

2 participants