How to Install Gcc 4.9.2 on Rhel 7.4

how to install gcc 4.9.2 on RHEL 7.4

RHEL comes with preconfigured repo, you can search for the desired packages and install them using yum package manager.

To do so, first run ( to search gcc )

$ sudo yum search gcc 

which will show you a list of available packages with the matching name

============================ Name Exactly Matched: gcc =============================
gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
gcc.i686 : Various compilers (C, C++, Objective-C, ...)
=========================== Name & Summary Matched: gcc ============================
gcc-c++.x86_64 : C++ support for GCC
gcc-c++.i686 : C++ support for GCC
gcc-gdb-plugin.x86_64 : GCC plugin for GDB
gcc-gdb-plugin.i686 : GCC plugin for GDB
gcc-gdb-plugin.x86_64 : GCC plugin for GDB
gcc-objc.x86_64 : Objective-C support for GCC
...

Install the package you need by running ( to install gcc-c++ )

$ sudo yum install gcc-c++

It will the packages to be installed and ask for confirmation.

Dependencies resolved.
====================================================================================
Package Architecture Version Repository Size
====================================================================================
Installing:
gcc-c++ x86_64 8.3.1-2.fc29 updates 12 M

Transaction Summary
====================================================================================
Install 1 Package

Total download size: 12 M
Installed size: 29 M
Is this ok [y/N]:

NOTE: Steps mentioned above will install latest available version of the package.


Install a particular Version of a Package

Install all development tools

compile gcc4.9.2 from source on centos7

I have searched a lot for this error.
Since no one answer, I answer myself, in case someone else has the same error.
In conclusion, this is an error related to a variable called pthread_mutex_t.
The definition and the initialization of this variable are incompatible.

First, check the location of pthread.h and pthreadtypes.h

locate pthread.h
locate pthreadtypes.h

In my case, I have two pthread.h files in different locations.
Usually, the one under /usr/include is the file used during the compiling process.
check the definition of PTHREAD_MUTEX_INITIALIZER.
It should be like:

{{0, 0, 0, 0, 0, 0, {0, 0}}}

or a definition with #ifdef, but they are almost the same thing.

Then check the pthreadtypes.h. Usually, it is under /usr/include/bits.
Find the definition of pthread_mutex_t.
One version (ver1.0) maybe looks like this:

typedef union

{

struct __pthread_mutex_s __data;

char __size[__SIZEOF_PTHREAD_MUTEX_T];

long int __align;

} pthread_mutex_t;

Another version (ver2.0):

typedef union

{

struct __pthread_mutex_s

{

int __lock;

unsigned int __count;

int __owner;

#if __WORDSIZE == 64

unsigned int __nusers;

#endif

/* KIND must stay at this position in the structure to maintain

binary compatibility. */

int __kind;

#if __WORDSIZE == 64

int __spins;

__pthread_list_t __list;

# define __PTHREAD_MUTEX_HAVE_PREV 1

#else

unsigned int __nusers;

__extension__ union

{

int __spins;

__pthread_slist_t __list;

};

#endif

} __data;

char __size[__SIZEOF_PTHREAD_MUTEX_T];

long int __align;

} pthread_mutex_t;

You can see that the second one is much longer, and define a struct with '{}' in the union. That's why the error information keep saying cannot convert ‘’ to ‘short int’ in initialization. The reason is that the PTHREAD_MUTEX_INITIALIZER initialized the pthread_mutex_t with {} in the union.
However, if you have the definition that looks like ver1.0, then here is the conflict. Then you may just replace the definition with ver2.0.

This may also be related to your GNU version. The ver1.0 definition seems for a newer version.

how to install C++14 on RHEL 7.4

The issue is that devtoolset-3 contains the c++11 standard. Making and installing GCC from source caused two GCC versions to exist together. The default being the c++11 version. In order to get the correct version of gcc I needed to install devtoolset-7 and make sure devtoolset-3 was superseded or removed.

Here is how I enabled it:

1. Install a package with repository for your system:

On RHEL, enable RHSCL repository for your system:

$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms

2. Install the collection:

$ sudo yum install devtoolset-7

3. Start using software collections:

$ scl enable devtoolset-7 bash



Related Topics



Leave a reply



Submit