elbywan / crystalline

A Language Server Protocol implementation for Crystal. 🔮
MIT License
424 stars 21 forks source link

Error: cannot open ./crystalline/bin/crystalline during install #1

Closed Nicolab closed 3 years ago

Nicolab commented 3 years ago

Hello,

Thanks for your hard work.

I try to install Crystalline on Ubuntu 18.04 (llvm 11) and I have this error:

$ crystal build ./src/crystalline.cr  -o ./bin/crystalline --release --no-debug --progress  -Dpreview_mt
/usr/bin/ld : ne peut ouvrir le fichier de sortie /home/nico/tmp/crystalline/bin/crystalline : Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /home/nico/tmp/crystalline/bin/crystalline  -rdynamic -L/usr/bin/../lib/crystal/lib -lyaml -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` /usr/share/crystal/src/llvm/ext/llvm_ext.o `"/usr/bin/llvm-config-11" --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent_pthreads -levent -levent -lrt -ldl`

My full install is:

sudo apt-get update
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
# whereis llvm-config-11 (v11 for me), when located:
export LLVM_CONFIG=/usr/bin/llvm-config-11
crystal build ./src/crystalline.cr  -o ./bin/crystalline --release --no-debug --progress  -Dpreview_mt
crystal version
Crystal 0.35.1 [5999ae29b] (2020-06-19)

LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu

An idea?

elbywan commented 3 years ago

Hey @Nicolab, thanks for reporting!

I think that the issue is that the ./bin folder does not exist, you'll have to mkdir bin it (it happens when specifying an output path with in an non-existing folder when compiling a crystal program).

I'll add a line in the readme!

Nicolab commented 3 years ago

Indeed, thanks @elbywan

Now I have this error:

crystal build ./src/crystalline.cr  -o ./bin/crystalline --release --no-debug --progress  -Dpreview_mt
/usr/share/crystal/src/llvm/ext/llvm_ext.o : Dans la fonction « LLVMExtDIBuilderCreateCompileUnit » :
llvm_ext.cc:(.text+0x3de) : référence indéfinie vers « llvm::DIBuilder::createCompileUnit(unsigned int, llvm::DIFile*, llvm::StringRef, bool, llvm::StringRef, unsigned int, llvm::StringRef, llvm::DICompileUnit::DebugEmissionKind, unsigned long, bool, bool, llvm::DICompileUnit::DebugNameTableKind, bool) »
/usr/share/crystal/src/llvm/ext/llvm_ext.o : Dans la fonction « LLVMExtWriteBitcodeWithSummaryToFile » :
llvm_ext.cc:(.text+0x1f85) : référence indéfinie vers « llvm::buildModuleSummaryIndex(llvm::Module const&, std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>, llvm::ProfileSummaryInfo*) »
/usr/share/crystal/src/llvm/ext/llvm_ext.o : Dans la fonction « llvm::MetadataTracking::track(llvm::Metadata*&) » :
llvm_ext.cc:(.text._ZN4llvm16MetadataTracking5trackERPNS_8MetadataE[_ZN4llvm16MetadataTracking5trackERPNS_8MetadataE]+0x42) : référence indéfinie vers « llvm::MetadataTracking::track(void*, llvm::Metadata&, llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>) »
/usr/share/crystal/src/llvm/ext/llvm_ext.o : Dans la fonction « llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateAtomicCmpXchg(llvm::Value*, llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::AtomicOrdering, unsigned char) » :
llvm_ext.cc:(.text._ZN4llvm9IRBuilderINS_14ConstantFolderENS_24IRBuilderDefaultInserterEE19CreateAtomicCmpXchgEPNS_5ValueES5_S5_NS_14AtomicOrderingES6_h[_ZN4llvm9IRBuilderINS_14ConstantFolderENS_24IRBuilderDefaultInserterEE19CreateAtomicCmpXchgEPNS_5ValueES5_S5_NS_14AtomicOrderingES6_h]+0x7d) : référence indéfinie vers « llvm::AtomicCmpXchgInst::AtomicCmpXchgInst(llvm::Value*, llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::AtomicOrdering, unsigned char, llvm::Instruction*) »
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /home/nico/tmp/crystalline/bin/crystalline  -rdynamic -L/usr/bin/../lib/crystal/lib -lyaml -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` /usr/share/crystal/src/llvm/ext/llvm_ext.o `"/usr/bin/llvm-config-11" --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent_pthreads -levent -levent -lrt -ldl`

Maybe I should compile Crystalline with LLVM 8?

elbywan commented 3 years ago

Maybe I should compile Crystalline with LLVM 8?

Yes I think this should be safer, I guess the crystal compiler is not compatible with llvm 11 yet.

Nicolab commented 3 years ago

Ok thanks. Official LLVM install script support v9 and +. I have tested with LLVM 9 but I have some errors. I will test again with the next version of Crystal.

elbywan commented 3 years ago

@Nicolab A linux binary is now available if you want to give it shot 😉.

Nicolab commented 3 years ago

I've already given you a feedback on Gitter but to avoid leaving this issue unanswered. It works well now, thanks @elbywan :)