Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
LLVM/Clang compiler for MinGW
killerbot:
on your instructions for building libcxx :
--- Code: ---mkdir build-release
cd build-release <======================
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
--- End code ---
killerbot:
build and installed clang and libc++ with your instructions, then let CB autodetect it, it finds it in /usr/local/clang.
But when trying a "hello world" , it fails to compile since it doesn't ind the headers (iostream).
What should be the correct location ?
Timestamps wise I think this was a result of the build too : /usr/local/include/c++/v1/ ? => when using this , compiles but now linker problems (eg . : main.cpp:4: undefined reference to `std::__1::cout')
Also my linux shell doesn't seem to know about clang (yet), though I did ldconfig, and /usr/local/bin is already in my path (this is also where codeblocks executable is).
EDIT : on the linking problem : added to Cb for clang compiler settings :
linker path : /usr/local/lib
link lib : c++
==> links but at run time : error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
eranif:
I forgot to mention that you will need libc++abi as well.., building it on linux does not work "out-of-the-box" but requires a small tweak:
First, checkout libcxxabi:
--- Code: --- svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi
--- End code ---
Next:
--- Code: ---cd libcxxabi/lib
--- End code ---
Now you need to add some include paths... otherwise it will not compile:
run:
--- Code: --- g++ -v -x c++ /dev/null -fsyntax-only
--- End code ---
Locate the output line which is similar to this:
--- Code: ---/usr/lib/gcc/x86_64-linux-gnu/4.7/include
--- End code ---
Adjust CXX environment variable so it will be something similar to this:
--- Code: ---export CXX='clang++ -I/usr/local/include/c++/v1 -I/usr/lib/gcc/x86_64-linux-gnu/4.7/include'
--- End code ---
and compile libcxxabi by simply typing:
--- Code: ---./buildit
--- End code ---
once the compilation is done, you should have a new lib: libc++abi.so.1.0
I could not find a simple way of installing so I copied it manually to /usr/local/lib and created 2 symlinks:
--- Code: ---ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so
ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so.1
--- End code ---
Now compiling with clang++/libc++ should be like this:
--- Code: ---clang++ -stdlib=libc++ -c test.cpp -I/usr/local/include/c++/v1
clang++ -stdlib=libc++ test.o -o TestMe -lc++ -lc++abi -I/usr/local/include/c++/v1/
--- End code ---
Eran
killerbot:
Thanks Eran, but not yet ok for me :
--- Code: ---error while loading shared libraries: libc++abi.so.1: cannot open shared object file: No such file or directory
--- End code ---
eranif:
Did you remember to add /usr/local/lib to LD_LIBRARY_PATH?
--- Code: ---export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
--- End code ---
In addition, note that you should create 2 symlinks
--- Code: ---ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so
ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so.1
--- End code ---
Eran
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version