crystal-lang / crystal_lib

Automatic binding generator for native libraries in Crystal
138 stars 30 forks source link

problems building #30

Closed timuckun closed 7 years ago

timuckun commented 8 years ago

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" "${@}" -rdynamicllvm-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

asterite commented 8 years ago
/usr/bin/ld: cannot find -lclang

You need to install libclang

timuckun commented 8 years ago

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
asterite commented 8 years ago

What's your OS? How did you install Crystal?

timuckun commented 8 years ago

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.

asterite commented 8 years ago

Sorry, I don't know what else to do to help you

SuperPaintman commented 7 years ago

@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