Closed timuckun closed 7 years ago
/usr/bin/ld: cannot find -lclang
You need to install libclang
I installed that and the rest of the rest of the libs but maybe I am still missing something.
make
crystal build src/main.cr
/usr/bin/ld: /opt/crystal/embedded/lib/../lib/libgc.a(os_dep.o): undefined reference to symbol '_end'
//usr/lib/x86_64-linux-gnu/libffi.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc -o "/home/tim/source/crystal_lib/main" "${@}" -rdynamic `llvm-config-3.6 --ldflags 2>/dev/null || llvm-config-3.5 --ldflags 2>/dev/null || llvm-config --ldflags 2>/dev/null` -lclang -lpcre -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
Makefile:2: recipe for target 'crystal_lib' failed
make: *** [crystal_lib] Error 1
tim@tim-VirtualBox:~/source/crystal_lib$ cc -o "/home/tim/source/crystal_lib/main" "${@}" -rdynamic `llvm-config-3.6 --ldflags 2>/dev/null || llvm-config-3.5 --ldflags 2>/dev/null || llvm-config --ldflags 2>/dev/null` -lclang -lpcre -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
What's your OS? How did you install Crystal?
I could not install it on a mac so I am trying it on ubuntu 16-04 (virtualbox). I installed crystal using the instructions. I added the repository and then apt-get install crystal.
Sorry, I don't know what else to do to help you
@timuckun I solved this problem:
$ sudo apt-get install -y libclang-dev
$ ldconfig -p | grep libclang
# libclang-3.8.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libclang-3.8.so.1
# libclang-3.8.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libclang-3.8.so
# libclang-3.5.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libclang-3.5.so.1
# libclang-3.5.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libclang-3.5.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-3.8.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
$ ld -lclang --verbose
make
crystal build src/main.cr /usr/bin/ld: cannot find -lclang collect2: error: ld returned 1 exit status Error: execution of command failed with code: 1:
cc -o "/home/tim/source/crystal_lib/main" "${@}" -rdynamic
llvm-config-3.6 --ldflags 2>/dev/null || llvm-config-3.5 --ldflags 2>/dev/null || llvm-config --ldflags 2>/dev/null-lclang -lpcre -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib
Makefile:2: recipe for target 'crystal_lib' failed make: *\ [crystal_lib] Error 1