Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux upgrade GCC 4.8.1 clear and concise tutorials (Ubuntu 12.04 64-bit version as an example)     - DRBD Principle and Features Overview (Server)

- Oracle PL / SQL based cursor (Database)

- Linux kernel VLAN study notes (Programming)

- CentOS7 install and configure Nagios (Server)

- Ubuntu 14.10 Apache installation and configuration (Server)

- Static member variable modified (Programming)

- Ubuntu installed Komodo editor by PPA (Linux)

- How to Install Winusb in Ubuntu 14.04 (Linux)

- Java Concurrency - multiple threads of HelloWorld (Programming)

- 10 Codes of good practice PHP (Programming)

- MySQL backup tool to back up mydumper (Database)

- Logging information through the web GUI (LogAnalyzer) (Server)

- Android Service Lifecycle and usage (Programming)

- Java JDK has been able to compile without warning (Programming)

- Python pickle module for simple use notes (Programming)

- HBase vs Oracle (Database)

- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)

- Linux crontab (Linux)

- Nginx start, stop, smooth start, smooth upgrade (Server)

- Lua4.0 interpreter documents (Programming)

 
         
  Linux upgrade GCC 4.8.1 clear and concise tutorials (Ubuntu 12.04 64-bit version as an example)
     
  Add Date : 2018-11-21      
         
         
         
  I update on Ubuntu 12.04 LTS 64-bit version of gcc, found some original question, this time without any pressure of time, I am more careful to consult the official documentation, also made reference to some online posts, the entire upgrade process in the dependencies installed, Linux different genres, and the difference between 32 and 64 in common under a deeper understanding.

It is summarized as follows:

PS: do not label the source of reprint is shameful.

(I compiled Ubuntu 12.04 under the command shell, if you're busy, you can only copy out the inside of the shell code is executed)

Basic Course:
Here to do a summary of the whole process of presentation, so that we do everything in time be aware of.
 
1, dependent libraries and tools
According to official documents, if only to compile and install rather than to amend gcc, libraries, and tools needed so not a lot.
It should be emphasized two things:
1) the need for a c ++ compiler that is only if no gcc g ++, it is unable to complete the compilation;
2) If you want to compile a 32-bit program, then, you need to install the appropriate additional libraries on 64-bit systems (enabled by default).
 
2, the configuration (configure)
We compile the configuration language supported by gcc, the target environment (whether as a cross compiler), dependent library path (under certain conditions can be omitted, in detail), compiled the results ...... where to install the configuration program based on the information produced Makefile file for subsequent use.
 
3, compile (make)
According to configure the generated Makefile and gcc compile our respective lib as libstdc ++ and so on.
 
Process:
Please consult a lot of official documents: http: //gcc.gnu.org/install/

First, the dependent libraries and tools
tool:
Support c ++ 98 compiler (g ++), make, perl, decompression tool (tar, gzip, etc.), Binutils (part of the case requires only) and the like.
Here generally do not need to worry too much, because linux system after the installation is complete, and there's most of the tools already in place, the only caveat is c / c ++ environment.
If it is determined the unit has been installed gcc and g ++, you can skip this section.
 
Under Unbutu you can use:
 
apt-get install build-essential
Easy to get to, and it must be installed in a number of other libraries such as glibc (called the next Ubuntu libc).

Some other Linux platforms do not build-essential package, a little bit of trouble.

Because the installation g ++ and gcc, is bound to install libstdc ++ and glibc, it is advisable:

apt-get install gcc g ++ make libc6-dev

Way to install, in order to avoid some of the nausea problem, you can also install the appropriate tools to ensure that.


Library:
According to official documents, if only installation does not require modification, then only five dependent third-party libraries.
This 5-library sub-category 2, one (gmp, mpc, mpfr) is automatically compiled in gcc compilation process (first to download the source code and the right place), and the other is the need for stand-alone installation (isl, cloog ).
operating:
1, check whether they have been installed:
If you want to check XXX libraries have been installed, use:
locate libXXX

To find, if you find libXXX.so file, it means that the library has been installed.

2, the installation (if the first step has already been installed in a library found naturally do not have to install it):

For gmp, mpc, mpfr three libraries can be run under the root directory of gcc decompression

./contrib/download_prerequisites

To download and unzip, and create a symbolic link. (If the download is slow, you can modify the script to another Download gnu mirror, pay attention to modify the version number, according to the instructions of the official website of the higher version will not lead to other problems)

According gcc compiler rules: If there is at the root of gcc gmp, mpc, mpfr these directories, then make gcc time, they automatically make, do not need to be installed manually.

For isl and cloog the two libraries (compile time, please read the official document) can compile your own, but it is recommended to download directly from the source above. (Because cloog relied gmp and isl, which means that if you want to compile will be very troublesome.)

E.g:

apt-get intall libisl-dev libcloog-isl3

In particular environment may need to modify the name of the library, which can be verified by After entering libisl or libcloog double-Tab keys to view, after the same.

3, install other libraries:

If you want 64-bit system can also compile a 32-bit program, you will also need a 32-bit runtime, and these libraries in 64-bit system default is not installed.

Ubuntu under simple ways you can use:

apt-get install gcc-multilib g ++ - multilib

Under Fedora can use:

apt-get install glibc-devel.i686 libstdc ++ - devel.i686

Ubuntu can learn under this mode, modify the package name to install the appropriate package.

Second, the configuration (configure)
1, the establishment of build directory
Created in the root directory of a decompression gcc directory is where the compiler produce .o files.

mkdir build
cd build

2, the configuration
In the temporary directory just created it, calling configure the root directory under, and other input parameters, and here I just introduce a few commonly used.
--prefix
Is used to configure make install after the production of the executable files, libraries, into which the root directory, such as --prefix = / usr, then the production of gcc and g ++ will be placed in the / usr / bin, lib production will put in the / usr / lib. If you want to replace the original gcc and lib, then use by "which gcc" command to find the root path. By default --prefix to / usr / local. Update-alternatives can be configured with multiple default gcc which (described later).
--program-prefix
--program-suffix
The gcc compiler to add the prefix and suffix. For example --program-prefix = my- --program-suffix = -4.8.1, then gcc names generated would be: "my-gcc-4.8.1"
--disable-multilib
So that the gcc compiler become native compiler (native compiler), namely, the production of object code only guaranteed to run in the native default.
For 64-bit systems, this option is off by default, that is, by default, can be obtained by gcc compile-time option (-m32) is determined to generate a 64-bit or 32-bit object code. So you need to install gcc-multilib (glibc-devel.i686). For 32-bit systems is enabled by default, that is not to generate 64 programs.
--enable-languages
This is the need to make the language gcc compiler support. Like most people, I only use it for gcc's c and c ++, other languages ​​is not configured, there is no guarantee of this document for other compiled languages ​​situation is correct.
--with-gmp
--with-mpfr
--with-mpc
--with-isl
--with-cloog
--with-gmp-include
--with-gmp-lib

If you have installed one of these libraries, and is no longer the standard library search path (automatic installation is generally no problem), you need to specify the path manually.
--with-XXX = YYY is equivalent to --with-XXX-include = YYY / include and --with-XXX-lib = YYY / lib


Assume that the system is 64-bit, current gcc installed in / usr / bin directory:
For example (as a local compiler, coexist two gcc, supports c and c ++):

../configure --prefix = / usr / local --disable-multilib --enable-languages ​​= c, c ++

Or (32-bit executable files can be generated, overwrite the original gcc, supports c and c ++, to compile the gmp to /usr/gmp-5.1.3/ below):

../configure --prefix = / usr --enable-languages ​​= c, c ++ --with-gmp = / usr / gmp-5.1.3

3, Check
Even if there are some problems, confiure also can successfully generate the Makefile, but these problems can lead to later make the process go wrong. And many people (including me) ignore this step, caused some headaches.
Open config.log file Makefile file is created, search inside the "error", under normal circumstances, would be found to a number of conditions, such as inside information error -Werror, and used to obtain information "gcc -V" but gcc does not support -V category mistake, these innocuous. But if there is an include file does not exist, it would need to pay attention. For example #include < isl / xxx.h> error, it is not installed libisl-dev package.
Third, compile (make)
To this point, nothing so much trouble:

sudo make -j4

For better machine -j behind the numbers could be larger.
No problem, execute:

sudo make install

Install path is to configure the allocation of time.


It should be noted:
1, gcc does not support make unintall, cover with caution.
2, please use this step as root, otherwise it will be a tragedy.


Fourth, the subsequent work
If you want to co-exist two versions of gcc, when used naturally by entering the complete path to the fatal call which gcc, but this is more complicated.

It recommends the adoption of update-alternatives to allow the system to know when we only enter when gcc, which is to call a (detailed usage of update-alternatives please Baidu):

For example, I gcc path to the / usr / local / bin / gcc, I'll give it a priority of 100:

sudo update-alternatives --install / usr / bin / gcc gcc / usr / local / bin / gcc 100

Then

sudo update-alternatives --config gcc

Gcc to view two systems selected in which (under the auto case is selected high priority), if auto selected not what we want, you can increase the priority to develop a default or manually.

Ubuntu shell command summary:
It assumes that you have unpacked the gcc and into the appropriate directory.

sudo apt-get install gcc g ++ make
sudo apt-get install libisl-dev libcloog-isl-dev
# If you want to compile a 64-bit system, 32-bit applications (and vice versa), you need to execute the following command
sudo apt-get install gcc-multilib g ++ - multilibsudo ./contrib/download_prerequisitessudo mkdir buildcd buildsudo ../configure --enable-languages ​​= c, c ++ sudo make -j4sudo make install

In other versions of Linux:
 
Gcc upgrade in a process, the main difference lies in the different names and Package Manager package.

Ubuntu system (Debian) package name and RedHat system (CentOS, Fedora) in the naming rules are not the same. Wash prefix plus the version number, Developer Edition is abbreviated as "dev", use "-" connection architecture; the latter Developer Edition is abbreviated as "devel", connected with architecture. "."
 
For example, in 32-bit installation of glibc when used Registration:
 
On Ubuntu: libc6-dev-i386.
 On Red Hat distros: glibc-devel.i686
 On CentOS 5.8: glibc-devel.i386
 On CentOS 6.3: glibc-devel.i686

Secondly, there are many Ubuntu-based integrated package, such as g ++ - multilib, build-essential and so on, but no ReadHat Department.
     
         
         
         
  More:      
 
- How to achieve SSH without password login (Server)
- A step by step teach have to install multi-node cluster configuration Hadoop (Server)
- Ubuntu rights management common commands (Linux)
- Install RAID 6 (Striping double distributed parity) (Linux)
- Windows Server 2012 R2 Datacenter install SQL Server 2016 CTP (Database)
- Linux Kernel 4.2.2 compiler installation tutorial (Linux)
- Java development specifications summary (Programming)
- Oracle through the alarm log view and inspect the main library, physical and snapshot standby database (Database)
- Computer security perimeter recommendations (Linux)
- Virtual Judge environment to build and configure under Ubuntu (Server)
- Windows SmartGit installation (Linux)
- Ubuntu study notes and related problem solving (Linux)
- Linux C source code (Ascii HexToBinary: Converts hexadecimal string format ASCII codes) (Programming)
- Grading defense against Linux server attacks (Linux)
- Ubuntu Backup and Recovery (Linux)
- Java heap (Heap) and stack difference (Programming)
- Ubuntu How to install and upgrade Linux Kernel 3.15 (Linux)
- Analysis of Java in the deep copy and shallow copy (Programming)
- Enterprise-class GitHub warehousing environment build (Server)
- OpenWRT environment to build (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.