Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

/usr/bin/ld: cannot find -lclang when building irony-server #468

Closed bollafa closed 6 years ago

bollafa commented 6 years ago

I've been trying to build irony-server, at the start I had problems related with not being able to find the libclang libraries, but now it fails when it tries to link:

-*- mode: compilation; default-directory: "/tmp/build-irony-server-1.2.0/" -*-
Compilation started at Sun Feb 25 12:30:50

cmake -DCMAKE_INSTALL_PREFIX\=/home/bollafa/.emacs.d/irony/ /home/bollafa/.emacs.d/elpa/irony-20180104.1109/server && cmake --build . --use-stderr --config Release --target install
-- Irony package version is '1.2.0'
-- Found emacs: /usr/bin/emacs
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build-irony-server-1.2.0
[ 14%] Linking CXX executable ../bin/irony-server
/usr/bin/ld: cannot find -lclang
collect2: error: ld returned 1 exit status
src/CMakeFiles/irony-server.dir/build.make:225: recipe for target 'bin/irony-server' failed
make[2]: *** [bin/irony-server] Error 1
CMakeFiles/Makefile2:981: recipe for target 'src/CMakeFiles/irony-server.dir/all' failed
make[1]: *** [src/CMakeFiles/irony-server.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Compilation exited abnormally with code 2 at Sun Feb 25 12:30:50

I've searched and found related problems but their solutions didn't work ( they where also different programs ) : Clang-complete Crystal-lang

Thanks in advance.

bollafa commented 6 years ago

Yay! Fixed! Thanks to this awesome post in stack-exchange : running ld in verbose mode. Long story short: if you open ld in verbose mode you can see where does it try to open libclang.so So the only thing i had to do was locate libclang.so To find where my libclang.so was, then i simply symlinked it! sudo ln -s /usr/lib/llvm-3.8/lib/libclang.so /usr/lib/libclang.so

Hope this helps someone with the same (dumb) problem! :)

mavavilj commented 2 years ago

Yay! Fixed! Thanks to this awesome post in stack-exchange : running ld in verbose mode. Long story short: if you open ld in verbose mode you can see where does it try to open libclang.so So the only thing i had to do was locate libclang.so To find where my libclang.so was, then i simply symlinked it! sudo ln -s /usr/lib/llvm-3.8/lib/libclang.so /usr/lib/libclang.so

Hope this helps someone with the same (dumb) problem! :)

Any ideas, why this symlink is not defaulting in Ubuntu?