Description of problem: Trying to compile a hello world cpp on Fedora 25 with clang++ and libc++ (libcxx). sudo dnf install clang libcxx-devel #include <iostream> #include <string> int main() { std::string a = "abc"; std::cout << a; } clang++ -stdlib=libc++ hello.cpp This results in a bunch of linker errors. Version-Release number of selected component (if applicable): libcxx-devel-3.8.1-1.fc25.x86_64 How reproducible: Always Steps to Reproduce: 1. Install clang and libcxx 2. Try to compile a hello world program Actual results: Compile fails Expected results: Compile succeeds Additional info: I am not a C++ expert but to my understanding libc++ needs to be linked against libc++abi to work and this is not the case with current package. libc++-abi is also not packaged yet (https://bugzilla.redhat.com/show_bug.cgi?id=1332306 ?) so as far as I can understand it is not currently possible to effectively use libc++ on Fedora, unless someone can correct me on this. What I can't really understand is why libcxx was even included in this state as a package.
Upstream separates them. I am waiting on a review for 1332306 in order to get libcxxabi in to Fedora. I did not think it would take this long for that to happen.
There is now a libcxxabi package (https://admin.fedoraproject.org/pkgdb/package/rpms/libcxxabi/), but still the code in comment #1 can't compile maybe because issues raised by GCC developers here: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/UHWAP45O7DOWQ6QA5KL36T5D5YHTLE5K/
(In reply to E.N. from comment #2) > the code in comment #1 comment #0, I meant.
It seems to work if you append -lc++abi.
$ cat hello-world.cpp #include <iostream> #include <string> int main() { std::string a = "abc"; std::cout << a << std::endl; } $ clang++ -stdlib=libc++ -lc++abi -o bar hello-world.cpp hello-world.cpp:3:10: fatal error: 'iostream' file not found #include <iostream> ^ 1 error generated. $ cat /etc/os-release NAME=Fedora VERSION="26 (Rawhide)" … $ rpm --query llvm llvm-devel clang clang-devel libcxx libcxxabi llvm-3.9.0-7.fc26.x86_64 llvm-devel-3.9.0-7.fc26.x86_64 clang-3.9.0-4.fc26.x86_64 clang-devel-3.9.0-4.fc26.x86_64 libcxx-3.9.0-2.fc26.x86_64 libcxxabi-3.9.0-1.fc26.x86_64 Am I missing something? Is it related to versions' mismatches?
Try it with libcxx-3.9.0-3, which is built against libcxxabi. https://koji.fedoraproject.org/koji/buildinfo?buildID=863381 [spot@localhost ~]$ cat hello-world.cpp #include <iostream> #include <string> int main() { std::string a = "abc"; std::cout << a << std::endl; } [spot@localhost ~]$ clang++ -stdlib=libc++ -lc++abi -o bar hello-world.cpp [spot@localhost ~]$ cat /etc/os-release NAME=Fedora VERSION="26 (Workstation Edition)" … [spot@localhost ~]$ rpm --query llvm llvm-devel clang clang-devel libcxx libcxxabi llvm-3.9.0-7.fc26.x86_64 llvm-devel-3.9.0-7.fc26.x86_64 clang-3.9.0-4.fc26.x86_64 package clang-devel is not installed libcxx-3.9.0-3.fc26.x86_64 libcxxabi-3.9.0-1.fc26.x86_64
My error, my bad. After running koji download-build --arch=x86_64 libcxx-3.9.0-3.fc26 and installing the downloaded RPMs, I saw libcxxabi-devel being pulled as a dependency because it was not yet installed. The code compile well after downgrading libcxx and libcxx-devel to 3.9.0.2 while having libcxxabi-devel onto the box. For the record: $ rpm --query llvm llvm-devel clang clang-devel libcxx libcxx-devel libcxxabi libcxxabi-devel llvm-3.9.0-7.fc26.x86_64 llvm-devel-3.9.0-7.fc26.x86_64 clang-3.9.0-4.fc26.x86_64 clang-devel-3.9.0-4.fc26.x86_64 libcxx-3.9.0-2.fc26.x86_64 libcxx-devel-3.9.0-2.fc26.x86_64 libcxxabi-3.9.0-1.fc26.x86_64 libcxxabi-devel-3.9.0-1.fc26.x86_64 $ clang++ -stdlib=libc++ -lc++ -lc++abi -o bar hello-world.cpp $ ./bar abc Thanks for your time and all the packages you maintain, it's really amazing to realize the great stuff you do for the distro. My impression is this bug should now be closed.
Thanks for the kind words (and your patience).