Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install GMP,MPFR,MPC,ELF

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install GMP,MPFR,MPC,ELF". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install GMP,MPFR,MPC,ELF.

How do I install GCC (the GNU compiler collection) block by block using the current version, using the correct version of dependencies, without using a package manager such as yum,rpm,apt,dpkg, and without using shared libraries?

A typical developer may want to install GCC in a typical way, use your package manager (yum,rpm,apt,dpkg,port,brew, etc.) or follow the instructions here

My problem is how to install GCC piece by piece without shared libraries.

I want a completely stand-alone GCC that can move around my system without using any shared libraries and does not need to create any shared libraries.

This is what the Gulf Cooperation Council calls a "difficult way" and is not recommended for typical users.

GCC depends on:

GMP:GNU multi-precision arithmetic library

MPFR:GNU multi-precision floating-point rounding library

MPC:GNU multi-precision C library

ELF: executable and linkable format libraries

PPL: Parma polyhedron library (optional for memory optimization)

A simple method

If you are a typical developer, you can use the instructions in http://gcc.gnu.org/wiki/InstallingGCC or the system package manager to install simple methods, such as:

Apt install gcc # for Debian, Ubuntu, etc.yum install gcc # for RedHat, CentOS, etc.brew install gcc # for Mac OS X

The GCC says the answer here is "the difficult way" because it builds a piece of land and does not use shared libraries.

GCC Infrastructure

Get the GCC infrastructure:

Ftp://gcc.gnu.org/pub/gcc/infrastructure/

Put the download file in a temporary directory (you can use any directory you want).

/ opt/downloads

Build the infrastructure in a temporary directory different from the download directory or its subdirectories:

/ tmp/gcc

Configure the infrastructure using the following static libraries:

. / configure-- disable-shared-- enable-static-- prefix=/tmp/gcc

Depending on your needs, the disable-shared flag may be worth taking a closer look at. I use-- disable-shared because I only build static code, and I want to make sure that I don't build any shared code. My requirement is to easily move the results of the drive to my drive, so I need all the static code, and I don't need any shared code. If you prefer shared code, ignore the-- disable-shared flag.

Version

When you run any command in this answer, be sure to update the command to use the current GCC version number that meets your needs. The commands in this answer apply to GCC 4.6.2.

Note that the GCC documentation mentions: "while the required tools for any new version usually work, the library requirements are usually more stringent, and in some cases the new version may be valid, but it is safer to use the exact version of the record.

GMP

GMP is a GNU multi-precision arithmetic library.

Wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2bunzip2 gmp-4.3.2.tar.bz2tar xvf gmp-4.3.2.tarcd gmp-4.3.2./configure-disable-shared-enable-static-prefix=/tmp/gccmake & & make check & & make installMPFR

MPFR is a GNU multi-precision floating-point rounding library. It depends on GMP.

Wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2bunzip2 mpfr-2.4.2.tar.bz2tar xvf mpfr-2.4.2.tarcd mpfr-2.4.2./configure-- disable-shared-- enable-static-- prefix=/tmp/gcc-- with-gmp=/tmp/gccmake & & make check & & make installMPC

MPC is a GNU multi-precision C library. It depends on GMP and MPFR.

Wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gztar zxvf mpc-0.8.1.tar.gzcd mpc-0.8.1./configure-- disable-shared-- enable-static-- prefix=/tmp/gcc-- with-gmp=/tmp/gcc-- with-mpfr=/tmp/gccmake & & make check & & make installELF

ELF stands for executable and linkable formats. This library provides architecture-independent size and endian support.

Wget http://www.mr511.de/software/libelf-0.8.13.tar.gztar zxvf libelf-0.8.13.tar.gzcd libelf-0.8.13./configure-disable-shared-enable-static-prefix=/tmp/gccmake & & make check & & make installGCC

GCC is a collection of GNU compilers. It depends on GMP,MPFR,MPC and ELF.

Wget http://www.netgull.com/gcc/releases/gcc-4.6.2/gcc-4.6.2.tar.gztar zxvf gcc-4.6.2.tar.gz

Build gcc in a temporary directory of the same mount point. (building it in / tmp triggers cross-compilation host problems)

Mkdir-p / opt/downloads/gcc-4.6.2-scratchcd / opt/downloads/gcc-4.6.2-scratch

The configure command and its flags must all be on one command line (this article displays them on a separate line simply because of the width of the page).

Note: we use the full path for configuration, do not set the library path environment variable. We chose to disable boot and shared libraries because we don't want them (typical users may need both), and use posix threads and default flags that we need (typical users may want to use other threads or skip the default flags). YMMV and read about the flags here

/ opt/downloads/gcc-4.6.2/configure-disable-shared-- disable-bootstrap-- disable-libstdcxx-pch-- enable-languages=all-- enable-libgomp-- enable-lto-- enable-threads=posix-- enable-tls-- with-gmp=/tmp/gcc-- with-mpfr=/tmp/gcc-- with-mpc=/tmp/gcc-- with-libelf=/tmp/gcc-- with-fpmath=ssemake & & make install

Make it far more complex than necessary and does not apply to all versions of the correct version. Building the Gulf Cooperation Council (GCC)-disable-shared is usually a very bad idea. For a simpler method, see http://gcc.gnu.org/wiki/InstallingGCC.

There should be nothing more difficult in the whole process (replacing 4.6.2 with the version you want to build):

Tar xzf gcc-4.6.2.tar.gzcd gcc-4.6.2./contrib/download_prerequisitescd.. mkdir objdircd objdir$PWD/../gcc-4.6.2/configure-- prefix=$HOME/GCC-4.6.2 makemake install

Obviously, some people on Ubuntu set up a lot of garbage in their environment, which interferes with the GCC build process, and they need to delete them first:

Unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE LD_LIBRARY_PATH thank you for reading, the above is the content of "how to install GMP,MPFR,MPC,ELF", after the study of this article, I believe you have a deeper understanding of how to install GMP,MPFR,MPC,ELF, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report