Syniurge / Calypso

LDC fork to experiment direct interfacing with C++
http://wiki.dlang.org/LDC
Other
136 stars 10 forks source link

Document compilation from scratch #123

Open 00sapo opened 4 years ago

00sapo commented 4 years ago

I'm having trouble while compiling Calypso from scratch. I did what follows:

make fails because it tries to compile clang into the base directory. To overcome this, I run:

Now, ld fails in finding the newly compiled clang libraries. So I try make "LDFLAGS=-L$PWD/../deps/clang/build/lib" but it still fails with errors like:

/usr/bin/ld: cannot find -l/[absolute path]/Calypso/build/deps/clang/lib/libclangBasic.a

I also tried by using cmake -DCLANG_PREBUILT_DIR="../deps/clang/build/" but it doesn't change.

By using ninja, as suggested in the original ldc wiki, clang is compiled correctly out-of-the-box, but ld still fails in the same way and I have not found a way to specify the option -L.

Am I the only one with these problems? I'm using Manjaro with Linux 5.4.44, cmake 3.17.3, make 4.3.

GavinRay97 commented 3 years ago

This is how I managed to compile it on Windows. Took me a few hours to figure out:

git clone --recursive https://github.com/Syniurge/Calypso
cd Calypso

# Download and place the below in directory
# https://github.com/ldc-developers/llvm-project/releases/download/ldc-v9.0.1/llvm-9.0.1-windows-x64.7z

cmake -B ./build -G Ninja ^
-DCMAKE_C_COMPILER:PATH=cl.exe ^
-DCMAKE_CXX_COMPILER:PATH=cl.exe ^
-DCMAKE_LINKER:PATH=lld-link.exe ^
-DCMAKE_RC:PATH=llvm-rc.exe ^
-DCMAKE_RC_COMPILER:PATH=llvm-rc.exe ^
-DCMAKE_MT:PATH=mt.exe ^
-DCMAKE_BUILD_TYPE=Release ^
-DLLVM_ROOT_DIR="./llvm-9.0.1-windows-x64" ^
-DD_COMPILER=ldmd2

cmake --build ./build

In another comment here, someone else said that this worked for them on Ubuntu:

# DMD64 D Compiler v2.090.0
export DMD=/snap/bin/dmd

mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja -DLLVM_CONFIG=/usr/lib/llvm-9/bin/llvm-config ..

You might try just grabbing a copy of prebuilt LLVM9 from LDC repo that matches your OS, and fiddling with the C_COMPILER, CXX_COMPILER, LINKER, RC/RC_COMPILER, and MT CMake binaries to get it to run.

This did NOT work for me using clang-cl.exe oddly.