Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to build simple C++ app using clang++ on ubuntu

Tags:

clang++

I am unable to build a simple hello world application using clang-6.0 on bionic beaver, the build command fails with below error.

 clang++-6.0 -std=c++17 -stdlib=libc++ hello.cc -o hello 
/usr/bin/ld: cannot find -lc++abi
clang: error: linker command failed with exit code 1 (use -v to see invocation)

what is this c++abi library and where can i find it ?? Please advise.

like image 882
Ravikumar Tulugu Avatar asked Mar 19 '18 04:03

Ravikumar Tulugu


People also ask

Can I compile Clang 13 from the source on Ubuntu?

There are circumstances that you don’t have an admin account on a machine and you need to install the latest Clang. Here, I explain how you can compile Clang 13 from the source on Ubuntu. I use Ubuntu 20.04 installed on Windows 10 via Windows Subsystem for Linux (WSL).

What is the Clang compiler?

The Clang compiler is an alternative to GCC. It can be used to compile code into runnable binary programs. If you’re a developer on Ubuntu, you’ve likely dealt with a compiler like this before. While most Ubuntu developers stick with GCC, they also make it possible to get going with the Clang compiler.

How to install Clang in universe?

So, you just enable the universe repository and then install clang - either from the software store or from the command line using Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed.

Where can I download clang-14?

clang-14 is not available for your release ... but available as of Ubuntu 22.04 So, upgrading to 22.04 is what you might want to consider. You can download clang 14 for with the instructions on the llvm page here:


1 Answers

sudo apt-get install libc++abi-dev command will fix the problem

like image 88
Ravikumar Tulugu Avatar answered Sep 18 '22 20:09

Ravikumar Tulugu