I have built libc++ and want to use it when compiling my program ? so I have something like
clang++ -stdlib=~/libc++/libc++.so main.cpp
but this does not work. How can use my custom built libc++ when building the application?
This information comes from llvm documentation about libcxx.
If you want to use a custom libc++ with clang you have to specify argument like this :
$ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ -I<path_to_libcxx>/include/c++/v1 -L<path_to_libcxx>/lib -Wl,-rpath,<path_to_libcxx>/lib main.cpp ${end_of_compile_line...}
Alternatively, you can put the path of your library in LD_LIBRARY_PATH (assuming you are under Linux) :
export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib:$LD_LIBRARY_PATH
and compile using simply these options :
$ clang++ -stdlib=libc++ -nostdinc++ -I<path_to_libcxx>/include/c++/v1 -L<path_to_libcxx>/lib main.cpp -o ${end_of_compile_line...}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With