Problem Compiling with Clang 16.0.0 in Ubuntu 20.04

Problem Compiling with Clang 16.0.0 in Ubuntu 20.04

I encountered a problem when compiling a C program with Clang compiler version 16.0.0 , in Ubuntu 20.04

Here is the error message:


clang -pipe -Wall -O3 -fomit-frame-pointer -march=native -fopenmp=libiomp5 -D_FILE_OFFSET_BITS=64 -I/usr/include/apr-1.0 binarytrees.gcc-3.c -lapr-1 -lm -o binarytrees
clang: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by clang)
make[1]: *** [Makefile:7: binarytrees] Error 1
make[1]: Leaving directory '/home/waskita/energy-languages-internal/bench-clbg/Cclang/binarytrees'
make: *** [Makefile:2: compile] Error 2

Most likely reason: clang version 16.0.0 need GLIBCXX_3.4.30 , which is not available in Ubuntu 20.04

Solution: find newer libstdc++.so.6. In my case, I obtained it from gcc 12.1.0 in other directory.

Command to change:

cd /usr/lib/x86_64-linux-gnu
rm libstdc++.so.6
ln -s /usr/local/gcc-12.1/lib64/libstdc++.so.6.0.30 libstdc++.so.6 

Leave a Reply

Your email address will not be published. Required fields are marked *