When using Cloud 9 (now owned by Amazon and run as part of their AWS service) as an onlinet IDE for C and C++, and other compiled languages, it seems to create a virtual machine that uses version 4.8.5 of GCC. How do I use a more modern version of GCC, in order to utilize the C11 standard (and C18 revisions) and C++11 (and C++17 revisions) and to better utilize the more comprehensible and more friendly compiler error messages of more recent GCC, and Clang, versions.
How do I "request" or install a more modern version of GCC or possibly use a recent version of Clang as the compiler from within the Cloud 9 AWS instance/virtual machine?
The following command got my Cloud 9 IDE up to gcc version 7.2.1
sudo yum -y groupinstall "Development Tools"
gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Related
I have a MacBook Pro with an M1 chip. I need to update to the latest version of bioconductor (v3.15). As the documentation says this version is built/requires R v4.2
As such I updated and my current R set-up is:
R version 4.2.0 (2022-04-22)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.3.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0
However, when I then tried to install bioconductor I ran into a number of compiler errors.
To overcome I first updated my gcc/gfortran via homebrew to the following:
gcc --version
\Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
gfortran --version
GNU Fortran (Homebrew GCC 11.3.0) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
However I still get the compiler issues, specifically due to the location of gcc/gfortran. I installed gfortran via homebrew
I have read this post here and wanted to know if I could adapt this line sudo ln -sfn $(xcrun --show-sdk-path) /opt/R/arm64/gfortran/SDK so that it points to my homebrew installation of gfortran (/opt/homebrew/bin/gfortran)?
I am currently in a CS class where we use C++, and I run Linux on my laptop. So the problem is that I think I don't have the most up to date version of C++. I've read online for several commands to get the version and this is my result. Also my Linux version is 16.04, and I am compiling in my terminal
tom#TBT-XPS-13-9360:~/Documents/Subjects/CS/OOP$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
I don' know what part of this is my actual version of C++. If my version is not the most up to date, can someone please give me DETAILED instructions on how to do it. Still getting my Linux legs.
C++ version (Or usually called c++ standard) is different than compiler version.
g++ is your compiler, and your current version is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
You can use different command to compile your program using different C++ version.
g++ -std=c++11 yourFile .....
g++ -std=c++14 yourFile .....
As mentioned in the comments, this version of compiler may not support c++17 features yet
Use this command in terminal (for linux only)
cpp --version
I am trying to downgrade gcc/g++ to 4.8.1. I tried two options, both with problems.
use sudo apt install gcc-4.8 g++-4.8. This option will install 4.8.5 etc. I wonder if there is any way to specify 4.8.1. sudo apt install gcc-4.8.1 g++-4.8.1 does not work as it will complain that "unable to locate package gcc-4.8.1".
Download "gcc-4.8.1" and follow the official steps ("configure, make, make install") but it fails at the make step with errors "CXXABI_1.3.8" not found.
I found another solution but I am not sure whether it is desirable (" install gcc-4.8.1 from source code on Ubuntu-16.04").
How do I downgrade gcc/g++ to 4.8.1 in Ubuntu?
Many thanks.
How do I downgrade gcc/g++ to 4.8.1 in Ubuntu?
I think you want look into the command "update-alternatives" (instead of 'downgrade').
To learn some more browse "https://askubuntu.com/questions/529687/how-to-use-update-alternatives-to-manage-multiple-installed-version-of-the-sam"
The update-alternatives works by changing what the command g++ points at. Currently on my system, g++ points to g++-6.
I have sometimes experienced an install that simply does not work. My recent g++ v6.2 install is broken, I don't know why.
But because my ubuntu is out of date, I plan to upgrade to the latest ubuntu. I might as well wait to install the latest compiler.
In the mean time I have 6.2.0, which does not 'work' (cause unknown). g++ points to this:
~$ g++ --version
g++ (GCC) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Since I seldom remove (un-install) the previous version in use, it turns out that with a simple search to identify what is available, I can access an older compiler using a suffix. For example
~$ g++-5 --version
g++-5 (Ubuntu 5.2.1-23ubuntu1~15.10) 5.2.1 20151028
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So, I continue more or less the same as before the failed 6.2.0 install.
For you, I think this means that you can use your package manager to install your desired earlier compiler, but remember to search for it in case it already exists on your system. Then use update-alternatives to make it the default, or just learn the new command name to invoke, i.e. g++-5, and continue developing with both commands easily available.
In file included from /usr/include/c++/4.8.2/locale:41:0,
from /usr/include/c++/4.8.2/iomanip:43,
from [...omitted by myself as it is irrelevant]
/usr/include/c++/4.8.2/bits/locale_facets_nonio.h:59:39: error: ‘locale’ has not been declared
struct __timepunct_cache : public locale::facet
Above is the first error in my build log.
I didn't try to compile glibc/gcc myself, and I installed them via yum.
One fishy thing I found is:
$ ll /usr/include/c++/
total 4
drwxr-xr-x. 12 root root 4096 Dec 17 14:16 4.8.2
lrwxrwxrwx 1 root root 5 Dec 17 14:16 4.8.5 -> 4.8.2
$
And yum showed only 1 version of gcc:
$ yum info gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.uhost.hk
* epel: mirrors.hustunique.com
* extras: centos.uhost.hk
* updates: centos.uhost.hk
Installed Packages
Name : gcc-c++
Arch : x86_64
Version : 4.8.5
Release : 4.el7
Size : 16 M
Repo : installed
From repo : base
Summary : C++ support for GCC
URL : http://gcc.gnu.org
License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
: It includes support for most of the current C++ specification,
: including templates and exception handling.
Any idea how to verify the headers in /usr/include/c++/4.8.2 is indeed from 4.8.5 package?
Thanks in advance.
P.S. I think probably glibc is irrelevant but here is the info:
$ ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
The symlink to the 4.8.2 directory is nothing to worry about, it's normal for the libstdc++ headers on Red Hat Enterprise Linux (and therefore CentOS) to be arranged like that.
gcc --version will tell you the version of the gcc executable in your path.
rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers.
rpm -ql libstdc++-devel will list the files installed by that package, which will include the files under /usr/include/c++/4.8.2
rpm --verify libstdc++-devel will check that you haven't messed up the C++ headers by replacing them with something else.
The error is more concerning, that implies you have messed something up. My guess would be it's in the from [...omitted by myself as it is irrelevant] part, which may actually be very relevant. std::locale should be declared in <bits/locale_classes.h> which is included before <bits/locale_facets_nonio.h>, so if it wasn't declared my guess is that you have some header that defines _LOCALE_CLASSES_H and prevents the standard library header from being read. Do not define include guards that start with underscores, they are reserved names.
I am not quite sure but below is more information
Stackoverflow: version of libc
$ /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 3.13.9 system on 2014-04-12.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/eglibc/+bugs>.
mandar#ubuntu:~/Desktop$
Since you are using Linux you can try
ldd --version
I downloaded the disruptor sources from here:
https://github.com/fsaintjacques/disruptor--
I then tried but get the given error. Is there something that I am missing?
autoconf configure.ac > configure
configure.ac:9: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:19: error: possibly undefined macro: AC_CXX_COMPILE_STDCXX_0X
gcc version
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
autoconf version
autoconf --version
autoconf (GNU Autoconf) 2.63
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
<http://gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
Ask the developer to provide a bootstrap script and/or build instructions. Most likely you need:
aclocal
autoconf
automake -a
./configure
make
With possibly some non-default options (e.g. add --foreign to the automake invocation).