Problem with clang compiler with libc++ on Ubuntu - c++

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

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.

Related

Can't build Firebird SQL on Oracle Linux 8 Ampere V1 (arm64) [duplicate]

I'm following the Matlab coder kalman tutorial in Matlab help. When using codegen, there's an error as below:
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
But there is libstdc++.so.6 in /lib/ and /usr/lib
For Fedora 16 use:
sudo yum install libstdc++-static
You can soft link the library to the name that is being sought
ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so
i did sudo apt-get install g++-4.7 it work for me for matlab .
If you're compiling a 32-bit application on a 64-bit CentOS 7:
sudo yum install libstdc++-devel.i686
For CentOS, be sure you have installed gcc-c++ package (it includes libstdc++-devel dependency):
sudo yum install gcc-c++

Update g++ but still old version

I installed g++ using those commands line:
sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
Then
sudo apt-get install gcc-7 g++-7
When it was done I tried g++ -v but still shows me the old version
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Am I not upgrading it correctly?
Edit
:~$ dpkg -L g++-7
/.
/usr
/usr/lib
/usr/lib/gcc
/usr/lib/gcc/x86_64-linux-gnu
/usr/lib/gcc/x86_64-linux-gnu/7
/usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
/usr/share
/usr/share/doc
/usr/share/doc/gcc-7-base
/usr/share/doc/gcc-7-base/C++
/usr/share/doc/gcc-7-base/C++/README.C++
/usr/share/doc/gcc-7-base/C++/changelog.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/x86_64-linux-gnu-g++-7.1.gz
/usr/bin
/usr/bin/x86_64-linux-gnu-g++-7
/usr/share/doc/g++-7
/usr/share/man/man1/g++-7.1.gz
/usr/bin/g++-7
:~$ which g++
/usr/bin/g++
Installing a newer (or older) version of GCC than the Ubuntu default version via the package manager
does not delete the default version. You get both. You can install as many
versions as you like. gcc/g++ will continue
to run the default version. If you have installed GCC 7, then you run
the new compilers with gcc-7 or g++-7. For most build systems, it is sufficient to set the environment variables CC=gcc-7 CXX=g++-7 before starting the build.
I installed the gcc-7 using the directions given in Ubuntu Forum, rebooted the system (to make sure all environment variables are loaded) and to compile with C++ 17, type the following on the shell :
g++-7 -std=c++17 program_name.cpp -o program.out
Hope this helps.

CUDA 7.0 complains about not supporting gcc 4.9

I have installed gcc-4.7, gcc-4.8, gcc-4.9
When I try to do:
luarocks install cutorch
I get an error:
In file included from /usr/include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/include/host_config.h:82:2: error: #error -- unsupported GNU version! gcc 4.9 and up are not supported!
#error -- unsupported GNU version! gcc 4.9 and up are not supported!
I found a similar problem
But when I try to run the command:
nvcc --compiler-bindir /usr/bin/gcc-4.7
I get an error:
nvcc fatal: No input files specified; use option --help for more information
I'm new and installed linux day ago. Please help me
Run the following commands before the installation:
export CXX=/usr/bin/g++-4.8
export CC=/usr/bin/gcc-4.8
this should set the compiler to gcc-4.8 for the compilation.

compiling fileZilla on ubuntu 14.04 LTS

I am trying to compiler FileZilla from its source code.
It requires C++ 14 support for which gcc4.9 is required.
Whatever higher version than 4.8, I try to install, there's no change.
Is gcc4.9 not available for the above ubuntu version?
The error I get is:
checking whether g++ supports C++14 features by default... no
checking whether g++ supports C++14 features with -std=gnu++14... no
checking whether g++ supports C++14 features with -std=gnu++1y... no
checking whether g++ supports C++14 features with -std=c++14... no
checking whether g++ supports C++14 features with -std=c++1y... no
configure: error: *** A compiler with support for C++14 language features is required
Can someone help ?
To install gcc-4.9 g++-4.9 may be helpful, and set it as your default gcc.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
Then gcc-4.9 will be available in your ubuntu version.
Notes : my version is ubuntu 14.04

Installing gevent on Mavericks (Enthought Canopy python)

Has anyone had any luck building gevent 1.0 in Mavericks?
I've tried the following:
pip (as recommended on the gevent package index)
easy_install
compiling from source
I keep getting the same error when building 'gevent.core':
...
building 'gevent.core' extension
creating build/temp.macosx-10.6-i386-2.7/gevent
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -U__llvm__ -
DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0
-DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.6-i386-2.7/libev -Ilibev -
I/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-
10.6-i386-2.7/gevent/gevent.core.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from gevent/gevent.core.c:17:
/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
Seems to be a problem with XCode. I made sure I have the XCode (v. 5.0.2) command line tools installed with:
xcode-select --install
But that didn't seem to change anything. Apparently I'm not alone with this problem (a missing /Developer/SDKs/MacOSX10.6.sdk), but I'd like to stick with Enthought's Canopy version of python if I can (and have already spent too much time combing the Apple Developer site to try download MacOSX10.6.sdk directly).
Any suggestions that don't involve starting over with a macport'ed python? Thanks!
IIUC, Apple pulled a fast one on the latest XCode, such that gcc is no longer actually gcc, but is symlinked to clang, which is not compatible with standard Pythons, including Canopy's.
It should work better if you install Xcode 3.2.1 Developer Tools from https://developer.apple.com/downloads/index.action
For me the hint on gevent website helped:
pip install cython git+git://github.com/gevent/gevent.git#egg=gevent