terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.72k stars 201 forks source link

Make failure due to dummy linker output being too long #422

Closed SeekingMeaning closed 4 years ago

SeekingMeaning commented 4 years ago

This is a pretty nasty issue that I've been working at for hours. The output of the dummy linker invocation is too long, so it gets cut off while writing to build/llvm_objects/llvm_list. Here's my llvm_list: https://gist.github.com/SeekingMeaning/fc5761ba5baf4319f5a03fab3ff36480

The bottom line is cut off, so the linker gets confused and says that there's no file named SelectionDAGPr when actually, it should be SelectionDAGPrinter.cpp.o. I've tried everything, and it seems that the only way to get the full output is to print it directly to the terminal. Here are the changes I made: https://github.com/SeekingMeaning/terra/commit/51958829a345a4b9d0a0f8daec1213f73386dd0b

What I have to do is copy the list of filepaths from terminal to a file named libs_list. Once the list is an actual file, then it can used to generate llvm_list. It's hacky, but it works.

elliottslaughter commented 4 years ago

Can you try the CMake build? It should avoid this issue entirely. I've been meaning to deprecate the Makefile build for some time now.

SeekingMeaning commented 4 years ago

Okay, I've got it working with some edits. See SeekingMeaning/terra@b54d94e. For context, I'm on macOS Catalina, so Terra's copy of LuaJIT compiles but doesn't work. (Homebrew/homebrew-core#46928)

Once I have LLVM and LuaJIT installed via brew install llvm luajit then I can run these commands to build Terra:

cd build
cmake .. -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm/9.0.0_1 -DLUAJIT_INSTALL_PREFIX=/usr/local/Cellar/luajit/2.0.5
make

On a side note, the patch linked allows Terra to be installed with Homebrew. Link to formula: https://gist.github.com/SeekingMeaning/80b780547c004bc40e15cfc52875976a

elliottslaughter commented 4 years ago

Is the problem with LuaJIT that 2.0.x doesn't build on Catalina without patches? (But 2.1.0-beta* does?) If so, my inclination would be to bump Terra's official LuaJIT to 2.1. Even though it's still technically beta, I know people who have been using it extensively and it seems solid.

I'm also happy to take a patch to enable Terra to be built against the system's LuaJIT, but it would be nice to do it in a way that's more idiomatic to CMake. That would be a larger refactor though, so it's ok if you don't want to take that on right now.

It would be great to get Terra on Homebrew, though I'll warn you now that you'll have to pin the LLVM version since we often lag behind the official releases.

elliottslaughter commented 4 years ago

We've upgraded LuaJIT to 2.1 via #426, so the build should now work on Catalina out of the box subject to the caveats in #435.