Source code compilation GCC4.6.1

Source: Internet
Author: User
Tags gmp posix

Http://ftp.gnu.org/gnu/gcc/gcc-4.6.1/

If the download is gcc-g++-4.6.1.tar.bz2 compile, it will be an error, because gcc-g++ is only a subset of gcc4.6.4, the file is not complete:

[email protected]: ~/soft_libs/gcc-4.6.1/libstdc++-v3$./configure
Configure:error:cannot find Install-sh, install.sh, or Shtool in "." "./.." "./.. /.."

Found an error, because this config is required to use the Autoconf tool to build on the platform's Configure.ac,

GCC requires three libraries of GMP, MPFR and MPC:

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

The general tools are installed under/usr/local/and the application is installed under/opt/. When we use configure, we can use--prefix to specify the installation directory of the software.

If you do not configure this option, the post-installation executable is placed by default in/usr/local/bin, the library file is placed by default in/usr/local/lib, and the configuration file is placed by default in/usr/local/etc.

Other resource files are placed in the/usr/local/share, more messy.

GMP Compilation:

./configure--prefix=/usr/local/gmp-4.3.2

Make

sudo make install

MPFR Compile:

./configure--prefix=/usr/local/mpfr-2.4.2--with-gmp=/usr/local/gmp-4.3.2

Make

sudo make install

MPC compilation:

./configure--prefix=/usr/local/mpc-0.8.1--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/mpfr-2.4.2

./configure--prefix=/usr/local/mpc-0.8.2--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/mpfr-2.4.2

Make

sudo make install

Install libtool2.2.6a (but 2.2.7a required, version must match)

ftp://ftp.gnu.org/gnu/libtool/

./configure

Make

sudo make install

The installation path is:

/usr/local/bin/libtoolize

/usr/local/bin/libtool

Then copy the Libtool to the gcc-4.6.1/host-i686-pc-linux-gnu/lto-plugin below.

Test Discovery Download 2.2.8 version also not available.

However, although the 2.2.6a version of the error, but re-CP to the specified directory is no problem.

It should be best to download the 2.2.7a version:

ftp://ftp.linux.ee/pub/gnu/cygwin/release/libtool/libtool-2.2.7a-10-src.tar.bz2

Installing PPL0.11

./configure

Make

Make install

The installation path is:

/usr/local/include

/usr/local/lib

Polylib Download and install:

Http://icps.u-strasbg.fr/PolyLib/polylib_src/?C=M;O=D

Download the source code compiled however, there are errors. Need to change the source code:

Change to:

./configure

sudo make

sudo make install

The installation path is:

/usr/local/include

/usr/local/lib/

Installing cloog0.15.9

Here is the download link:

http://ftp.osuosl.org/pub/clfs/conglomeration/cloog-ppl/

Http://repo.or.cz/cloog.git/tags

However, there is no version of 0.15.* available in this area.

So I searched for the csdn above:

(Problem with 0.15.10 version)

Cloog relies on GMP and polylib (optional).

./configure--with-gmp=/usr/local/gmp-4.3.2--with-polylib=/usr/local--with-ppl=/usr/local/

Make

sudo make install

The installation path is:

/usr/local/include/

/usr/local/lib

Error 1:

[email protected]: ~/soft_libs/gcc4.6.1/ref/cloog-ppl-0.15.10$ make
Make: * * * No rule to do target ' m4/libtool.m4 ', needed by ' makefile.in '. Stop.

There is a problem with this version of 0.15.10. Change 0.15.11 version

Error 2:

Error:polylib/missing.h:no such file or directory

is the need for PPL support, plus--WITH-PPL parameters

GCC compilation:

1, configuration:

./configure--prefix=/usr/local/gcc-4.6.1-enable-threads=posix-disable-checking-disable-multilib- enable-languages=c,c++--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/mpfr-2.4.2--with-mpc=/usr/local/ mpc-0.8.1

./configure--prefix=/usr/local/gcc-4.6.1-enable-threads=posix-disable-checking-disable-multilib- enable-languages=c,c++--with-gmp=/usr/local/gmp-4.3.2--with-mpfr=/usr/local/mpfr-2.4.2--with-mpc=/usr/local/ mpc-0.8.2--with-ppl-include=/usr/local/include--with-ppl-lib=/usr/local/lib

2. Specify the LIB path

Export Ld_library_path= $LD _library_path:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2 /lib

Export Ld_library_path= $LD _library_path:/usr/local/mpc-0.8.2/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2 /lib

sudo ln-s/usr/local/mpc-0.8.2/lib/libmpc.so.2/lib/libmpc.so.2 (avoid the bug that the library is not found later)

sudo ldconfig

3. Add Libtool:

$/usr/local/bin/libtoolize--force

4. Compiling:

sudo make

#为了加快编译, compiled with 4 threads

#sudo Make-j4

5.check

sudo apt-get install Autogen

sudo apt-get install Dejagnu (because you want to use Runtest)

sudo make check

Note that in Running/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/gcc/testsuite/gcc.c-torture/compile/compile.exp ... Will take a long time.

6. Installation

The original GCC and gdb paths are/usr/bin/gcc/usr/bin/gdb, and our GCC installation path will be in/usr/local/gcc-4.6.1

sudo make install

Create a soft connection below/usr/bin

Compile error Answer:

Error 1:

MAKE[4]: Entering directory '/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/lto-plugin '

/bin/sh./libtool--tag=cc--tag=disable-static--mode=compile gcc-dhave_config_h-i.-I.. /.. /./lto-plugin-i. /.. /./lto-plugin/. /include-dhave_config_h-wall-werror-g-fkeep-inline-functions-c-O lto-plugin.lo. /.. /./lto-plugin/lto-plugin.c

/bin/sh:./libtool:no such file or directory

But we are installing the Libtool: Whereis libtool:

Libtool:/usr/bin/libtool/usr/share/libtool/usr/share/man/man1/libtool.1.gz

Because he is calling directly using the./libtool method, our Libtool is installed directly below/usr/bin, so the workaround is as follows:

Method 1:) Copy the Libtool to the directory

/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/lto-plugin

Can

Method 2:)

Libtool Introduction:

It can be thought that Libtool is an abstraction of GCC, which wraps gcc (or other compilers), the user does not need to know the details, just tell libtool what libraries need to be compiled, Libtool will handle the library dependencies and other details. Libtool only deals with libtool files with the suffix named Lo and La.

Error 2:

MAKE[5]: Entering directory '/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/i686-pc-linux-gnu/libgomp '

/bin/sh./libtool--tag=cc--mode=compile/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/xgcc-b /home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/-b/usr/local/gcc-4.6.1/i686-pc-linux-gnu/bin /-b/usr/local/gcc-4.6.1/i686-pc-linux-gnu/lib/-isystem/usr/local/gcc-4.6.1/i686-pc-linux-gnu/include-isystem/ Usr/local/gcc-4.6.1/i686-pc-linux-gnu/sys-include-dhave_config_h-i.-I.. /.. /./libgomp-i. /.. /./libgomp/config/linux/x86-i. /.. /./libgomp/config/linux-i. /.. /./libgomp/config/posix-i. /.. /./libgomp-wall-werror-ftls-model=initial-exec-march=i486-mtune=i686-wc,-pthread-g-o2-mt ALLOC.LO-MD-MP-MF. D Eps/alloc. Tpo-c-O Alloc.lo. /.. /./libgomp/alloc.c

Libtool:version mismatch error. This was Libtool 2.2.6b DEBIAN-2.2.6B-2UBUNTU1, but the

Libtool:definition of this lt_init comes from Libtool 2.2.7a.

Libtool:you should recreate ACLOCAL.M4 with macros from Libtool 2.2.6b DEBIAN-2.2.6B-2UBUNTU1

Libtool:and run autoconf again.

MAKE[5]: * * * [Alloc.lo] Error 63

Need to download a corresponding version of libtool:ftp://ftp.gnu.org/gnu/libtool/

Error 3:

Error while loading shared Libraries:libmpc.so.2:cannot open Shared object file:no such file or directory

Need to change mpc0.8.1 to 0.8.2.

Error 3.1

We've switched the MPC to 0.8.2, and then the error begins:

[email protected]: ~/soft_libs/gcc4.6.1/gcc-4.6.1/i686-pc-linux-gnu/libgcc$ cat Config.log | grep error
xgcc:error:unrecognized option '-V '
Xgcc:fatal Error:no Input Files
xgcc:error:unrecognized option '-qversion '
Xgcc:fatal Error:no Input Files
/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/cc1:error while loading shared libraries: Libmpc.so.2:cannot open Shared object file:no such file or directory
/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/cc1:error while loading shared libraries: Libmpc.so.2:cannot open Shared object file:no such file or directory

Because the variable has been canceled: Ld_library_path, so the system cannot automatically find libmpc.so.2, took a flexible way to establish a soft link:

sudo ln-s/usr/local/mpc-0.8.2/lib/libmpc.so.2/lib/libmpc.so.2

Error 4:

Detailed error causes seen through Config.log: Conftest.c:10:19:error:ppl_c.h:no such file or directory

Need to install the PPL and Cloog library, the PPL is:

ftp://ftp.cs.unipr.it/pub/ppl/releases/

We need to download ppl greater than or equal to 0.11, but the main version doesn't change, only 0

and specify--with-ppl-include--with-ppl-lib when configure.

$ sudo apt-get install Libppl0.10-dev

$ sudo apt-get install Libcloog-ppl-dev (this is version 0.15.8, not available)

Cloog is:

Http://gcc.gnu.org/wiki/CLooG-PPL

Error 5:

Conftest.c:16:error: ' Choke ' undeclared (first use of this functio

Looking at Config.log, you can see:

Configure:failed program was:

| /* Confdefs.h */

| #define PACKAGE_NAME ""

| #define PACKAGE_TARNAME ""

| #define Package_version ""

| #define Package_string ""

| #define Package_bugreport ""

| #define PACKAGE_URL ""

| #define LT_OBJDIR ". libs/"

|  /* End confdefs.h. */

| #include "ppl_c.h"

| Int

| Main ()

| {

|

| #if ppl_version_major! = 0 | | Ppl_version_minor < 11

| Choke Me

| #endif

|

| ;

| return 0;

| }

That is, Ppl_version_major is not 0 or ppl_version_minor less than 11 is not supported.

So ppl need to download a version greater than or equal to 0.11.

Error 6:

Conftest.c:15:error: ' Choke ' undeclared (first use of this function)

Configure:failed program was:

| /* Confdefs.h */

| #define PACKAGE_NAME ""

| #define PACKAGE_TARNAME ""

| #define Package_version ""

| #define Package_string ""

| #define Package_bugreport ""

| #define PACKAGE_URL ""

| #define LT_OBJDIR ". libs/"

|  /* End confdefs.h. */

| #include "Cloog/cloog.h"

| Int

| Main ()

| {

| #if cloog_version_major! = 0 | | Cloog_version_minor! = 15 | | Cloog_version_revision < 9

| Choke Me

| #endif

| ;

| return 0;

| }

That is, you need to add--with-cloog, and ensure that the downloaded version is 0.15. More than 9 of

ERROR 7:

Checking for I686-PC-LINUX-GNU-GCC .../home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/xgcc-b/ home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/host-i686-pc-linux-gnu/gcc/-b/usr/local/gcc-4.6.1/i686-pc-linux-gnu/bin/ -b/usr/local/gcc-4.6.1/i686-pc-linux-gnu/lib/-isystem/usr/local/gcc-4.6.1/i686-pc-linux-gnu/include-isystem/ Usr/local/gcc-4.6.1/i686-pc-linux-gnu/sys-include

Checking for suffix of object files ... configure:error:in '/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/i686-pc-linux-gnu/ LIBGCC ':

Configure:error:cannot compute suffix of object Files:cannot compile

See ' Config.log ' for more details.

MAKE[2]: * * * [CONFIGURE-STAGE1-TARGET-LIBGCC] Error 1

To view the error message:

Cat/home/fdr/soft_libs/gcc4.6.1/gcc-4.6.1/i686-pc-linux-gnu/libgcc/config.log | grep error

The reasons are:

Error while loading shared Libraries:libmpc.so.2:cannot open Shared object file:no such file or directory

Need libmpc.so to create a soft connection to/usr/lib below, because Ld_library_path was canceled

=====================================================================================

=====================================================================================

Resources:

1 compiling the JDK on Redhat 5

1.1 Error occurred: Configure:error:cannot compute suffix of object Files:cannot compile

The MPC, GMP, and MPFR directories need to be added to the environment variable and added at the end of the/etc/profile file: Export ld_library_path= $LD _library_path:/usr/local/mpc-0.8.1/lib :/usr/local/gmp-5.0.1/lib:/usr/local/mpfr-3.0.0/lib, note modify the directory, and then run #source/etc/profile to make it effective.

1.2 FreeType version 2.3.0 or higher is required.

Forced uninstallation of freetype-2.2.1-28.el5_7.2

Rpm–e–nodeps freetype-2.2.1-28.el5_7.2

Should be the effect of the FreeType version before the value.

1.3 Error while loading shared Libraries:libmpc.so.2:cannot open Shared object file:no such file or directory

Because the variable has been canceled: Ld_library_path, so the system cannot automatically find libmpc.so.2, took a flexible way to establish a soft link:

Ln-s/usr/local/mpc-0.8.1/lib/libmpc.so.2/lib/libmpc.so.2

1.4/usr/local/gcc-4.8.1/libexec/gcc/i686-pc-linux-gnu/4.8.1/cc1plus:error while loading shared libraries: Libmpfr.so.1:cannot open Shared object file:no such file or directory

Similar to error 3.

1.5/opt/jdkbuild/jdk7/hotspot/src/share/vm/oops/constantpooloop.cpp:272:39:error:converting ' false ' to pointer Type ' Methodoop ' [-werror=conversion-null]

if (cpool->cache () = = NULL) return false; Nothing to load yet

^

Cc1plus:all warnings being treated as errors

Hit a patch:

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/f457154eee8b

See note:

Http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-July/006243.html

1.6/lib/libmpfr.so.1:undefined reference to ' __gmp_get_memory_functions '

See: Http://www.mpfr.org/faq.html#undef_ref1

, this error is often seen when upgrading GMP 4.1.4 to a higher version, or installing multiple versions of GMP on the same machine. This error may mean that you have applied a GMP 4.2.x header, but the library with GMP 4.1.4 is applied. So the original GMP uninstall:

Rpm–e–nodeps Gmp-4.1.4-10.el5

1.7 Libgmp.so.3:cannot open Shared object file:no such file or directory

Similar to error 1.3.

2 compiling the JDK on Ubuntu 12

Resources:

1. http://www.kaifajie.cn/ubuntu/10272.html

2. http://hadwinzhy.gitcafe.com/blog/2013/01/21/compile-jdk/

2.1 Error:you seem to not having installed ALSA 0.9.1 or higher

No need to download Alsa-dev and alsa-drive from ALSA official website, Ubuntu offers packages of
sudo apt-get install Libasound2-dev

2.2/usr/bin/gawk:not found

Apt-get Install Gawk

2.3 Error:echo "* * * This OS isn't supported:" ' uname-a '; Exit 1;

Comment out the Checkos inside the hotspot/make/linux/makefile.

Check_os_version:

#ifeq ($ (Disable_hotspot_os_version_check) $ (empty_if_not_supported),)
# $ (quietly) >&2 echo "* * * This OS was not supported:" ' uname-a '; Exit 1;
#endif

The best way to do this is to add it after the make parameter:

Disable_hotspot_os_version_check=ok

2.4/opt/jdkbuild/jdk7/hotspot/src/share/vm/runtime/interfacesupport.hpp:430:0: Error: "__LEAF" redefined [-Werror]

Patching:

Http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/a6eef545f1a2

2.5 undefined reference to ' snd_pcm_* '

See note:

http://comments.gmane.org/gmane.comp.java.openjdk.build.devel/5311

Patching:

Http://mail.openjdk.java.net/pipermail/build-dev/2011-November/005188.html

It is also explained in this article.

2.6 Cannot find-lx11

Apt-get Install Libx11-dev

2.7.. /.. /.. /src/solaris/native/sun/awt/awt.h:38:27:fatal error:x11/intrinsic.h:no such file or directory

Apt-get Install Libxt-dev

2.8 X11/extensions/shape.h:no such file or directory

Apt-get Install Libxtst-dev

See note:

http://www.csdnjava.com/forum.php?mod=viewthread&tid=147509

2.9.. /.. /.. /src/solaris/native/sun/awt/awt_p.h:51:36:fatal error:x11/extensions/xrender.h:no such file or directory

Apt-get Install Libxrender-dev

Source code compilation GCC4.6.1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.