how to install g++ 4 on CentOS 8 - g++

Have some legacy C++ software that can only be compiled using g++ 4. How to install g++ 4 on CentOS 8 machine?
Found a lot of references to upgrade g++ in CentOS 6/7. But CentOS 8 seems totally different. E.g. can't find ways to access centos-release-scl and devtoolset-4 yum package.

Found a workaround for the legacy software issue.
Used the new default g++ compiler with option: -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++98
The resulting objects are ABI compatible with old libraries.

Related

cmake 3.11 installation in solaris11

I am new to solaris 11 machine. I have a vitual box and I can only interact via command promt. I am trying to install cmake 3.11 version. I tried downloading cmake source code and building it. But failed at one point where in code uses c++11 and the our gcc compiler is not able to compile it.
It will be very greatfull if anyone can give me steps for installing and using cmake in solaris11.
Thanks in advance.
Solaris 11 offers a cmake package in its package repos, so pkg install cmake as root should do it.

cuda install error on Ubuntu 17.04

abigail#abilina:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 205999 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.61-1) ...
Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...
Warning: The postinst maintainerscript of the package cuda-repo-ubuntu1604
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package cuda-repo-ubuntu1604)
OK
abigail#abilina:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cuda : Depends: cuda-8-0 (>= 8.0.61) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
My ubuntu version is 17.04. Does this mean my Linux currently can't install CUDA? I want to install TensorFlow with GPU support.
Per suggestion:
abigail#abilina:~/Downloads$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
https://launchpad.net/ubuntu/zesty/amd64/nvidia-cuda-toolkit
above is the correct one.
apt-get install nvidia-cuda-toolkit
but remember the cuda installed through apt were installed in different location. manually create ln -s at /usr/local/cuda for include,lib64,and bin
I have successfully installed CUDA 8.0 + the latest patch from NVIDIA on Ubuntu 17.04:
Download the .run file from https://developer.nvidia.com/cuda-downloads, choosing Ubuntu 16.04 (Base Installer)
You will not be able to install it by just running, because it is looking for a file called InstallUtils.pm which is not present in Ubuntu 17.04, but curiously, is present in the .run file - so: unpack the .run file using ./cuda*.run --tar mxvf
copy InstallUtils.pm (should be in the /bin path) to /usr/lib/x86_64-linux-gnu/perl-base
Run the installer (You may want to say no to the driver install step to keep the one you install through apt - I'm using 381.22, because 375.26, which is provided by the .run file does not support my 1080ti)
gcc 6 is incompatible with CUDA, but this is easily remedied for compiling the sample files: just add export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98" to your bashrc file, and comment out
from one of the headers (I think it was host_config.h, but you'll see it once you try to compile) - comment out these lines:
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)
#error -- unsupported GNU version! gcc versions later than 5.3 are not supported!
This is all from memory, so hopefully it's accurate enough.
I managed to find this solution thanks to these useful posts:
https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/
https://devtalk.nvidia.com/default/topic/949770/cuda-8-0rc-supporting-gcc6-/
For ubuntu 17.04, I had to use cuda 9.0 (deb version)
https://developer.nvidia.com/cuda-release-candidate-download
I couldn't get it to work otherwise. Cuda 8.0 needs gcc 5.3.1 but cuda 9.0 is compatible with gcc 6.3.0 which is installed on ubuntu 17.04 automatically.
More precisely, this is what I did:
On Ubuntu 17.04, install CUDA 9.0 — you can currently download the beta version 
https://developer.nvidia.com/cuda-release-candidate-download
I downloaded the .deb file and haven’t had any problems — follow the steps they recommend when you download cuda 9.0 
sudo dpkg -i cuda-repo-ubuntu1704-9-0-local-rc_9.0.103-1_amd64.deb
sudo apt-key add /var/cuda-repo-9.0-local-rc/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Then follow the post installation steps from the nvidia instructions (i.e., setting PATH and LD_LIBRARY_PATH) 
 http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Cuda 9 is compatible with gcc 6.3.0 (which comes with 17.04). I used arch=sm_52 and sometimes for my make files have to go ‘make clean’.
Installing Cuda 9.0 was the simplest solution in my case.
Alternatively, if you'd prefer cuda 8, you can download the deb file and then use the command
dpkg-deb -x cuda_8.*.deb /usr/local/cuda-8.0
to extract the contents from the deb file and have them placed in the desired directory.
Source: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#advanced-setup)

No g++ is found after installing a g++ package in Cygwin

I have installed mingw64-x86_64-gcc-g++ package in Cygwin. However, which g++ does not show any installed g++. Where is the installed compiler?
/bin/g++ is part of the gcc-g++ package.
/bin/x86_64-w64-mingw32-g++ is part of the mingw64-x86_64-gcc-g++ package.
Example

How to install and use libnet in mac os?

I want to program in C with libnet in Mac OS.
When I type in gcc *.o -o network -lnet, there's an error:
library not found for -lnet.
And when I use homebrew install linnet, is says:
Warning: libnet-1.1.6 already installed.
It is the problem of library PATH.Flow the steps to solve this problem.
First, find where you install the library. For my case, the libnet is located in /usr/local/Cellar/libnet/1.1.6.
Second, run /usr/local/Cellar/libnet/1.1.6/bin/libnet-config.
Third, use -L to add the path when you link.
gcc *.o -L/usr/local/Cellar/libnet/1.1.6/lib -lnet.

Running boomerang

I am on Ubuntu 8.04 and I have just downloaded Boomerang and unzip the files into a folder on my desktop.
I cd into that folder where the exe boomerang file resides, and typed ./boomerang and boomerang.
However I got the error message:
unable to execute ./boomerang: No such file or directory.
Why does this happen?
I guess, you're on a 64 bit system, which mean you must install some x86 libraries to run the program,
to list the libraries the binary is linked against, run readelf -d | grep NEEDED
once you know the libraries, just install it for x86 architecture: here are some common and necessary libraries for x86
sudo apt-get install libgc1c2:i386 libexpat1-dev:i386 lib32stdc++6 lib32z1 lib32z1-dev
now the program should start normally,
but if it persists, you should see a different kind of error,
try to install those libraries for x86
make sure you have Qt installed for the GUI version.
The error is most likely because you have a 64-bit system, but the boomerang binaries are 32-bit, and many newer 64-bit systems no longer ship with 32-bit support.
The solution is to install 32-bit support for your system; the method for doing this may differ, however the procedure I used was:
sudo apt-get install -y lib32z1 lib32ncurses5 lib32bz2-1.0
Which should be compatible with Ubuntu and many derivatives, though you should look up the correct procedure for your particular OS version, rather than simply running this command.
However, there may also be a number of other 32-bit libraries that are still required before boomerang will run on a 64-bit linux distribution, but at least once you have 32-bit support installed it can tell you what these are!
Are you sure you unpacked it ??
weewee#ubuntu:~/Downloads$ tar xzf boomerang-linux-alpha-0.3.tar.gz
weewee#ubuntu:~/Downloads$ cd boomerang-linux-alpha-0.3/
weewee#ubuntu:~/Downloads/boomerang-linux-alpha-0.3$ ls -l boomerang
-rwxr-xr-x 1 weewee weewee 2376620 Jun 13 2006 boomerang
weewee#ubuntu:~/Downloads/boomerang-linux-alpha-0.3$ ./boomerang
Boomerang alpha 0.3 13/June/2006
Usage: boomerang [ switches ] <program>
boomerang -h for switch help