brfh
brfh

Reputation: 344

Problem with clang compiler with libc++ on Ubuntu

I wrote a program (using coroutines), and tried to compile it with clang 9 on Ubuntu 18.04.4 LTS, but I get this error:

$ clang++-9 -stdlib=libc++ -std=c++2a coroutins_iterator.cpp 
/usr/bin/ld: cannot find -lc++abi
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I compile my program? What is going wrong?

I installed libc++ with

sudo apt-get install libc++-dev

Upvotes: 1

Views: 1702

Answers (1)

walnut
walnut

Reputation: 22162

You installed the wrong version of libc++, it seems. From what I can tell libc++-dev refers to version 6, not 9, in the Ubuntu 18.08 repositories. For Clang 9 you would want to install the corresponding version of libc++:

sudo apt-get install libc++-9-dev

This should also install the matching version of libc++abi.

Upvotes: 3

Related Questions