[Memo] Exécutez Node.js v4.4.5 sur CentOS 4.9 / RHEL4 (i386) pour le moment (gcc-4.8 et glibc2.11 sur LinuxKernel 2.6.9)

[mt08@centos4 node-v4.4.5]$ uname -a Linux centos4.local 2.6.9-103.ELsmp #1 SMP Fri Dec 9 04:31:51 EST 2011 i686 i686 i386 GNU/Linux [mt08@centos4 node-v4.4.5]$ PATH=HOME/482/usr/bin:PATH node

console.log('Hello Node.js!') Hello Node.js! undefined [mt08@centos4 node-v4.4.5]$ PATH=HOME/482/usr/bin:PATH node -v v4.4.5 [mt08@centos4 node-v4.4.5]$


## Objectif
 Déplacez les nœuds récents sur un système Linux tamisé. <br> (Le serveur de location, série RHEL4, n'est-il pas toujours actif ??)

 --Référence
 - [RHEL](https://ja.wikipedia.org/wiki/Red_Hat_Enterprise_Linux) 4 Première édition: 15 février 2005 --Support: -30 janvier 2014 (étendu)
 - [CentOS](https://ja.wikipedia.org/wiki/CentOS) 4 Première édition: 9 mars 2005 Mise à jour de maintenance: -29 février 2012

 - (Prévu) Je téléchargerai bientôt le binaire. github ??
 
## Aperçu
 -Construire Node.js v4.4.5 avec [CentOS 4.9 activé](http://qiita.com/mt08/items/708dbd29eb8a25587100).
 <br> Mais les outils sont vieux et en colère, alors je vais commencer par là.
    - Python 2.3.4 => 2.7.12
    - make 3.80 => make 4.21
    - binutils 2.15.92 => 2.24
    - gcc 3.4.6 => 4.8.2
 --glibc 2.3 => 2.11.3 (S'il est trop récent, il sera rejeté par la version du noyau Linux)
 - Celui généré par gcc (4.8.2) créé ici est conçu pour utiliser `/ tools / lib` etc. avec <font color = 'red'> * fixed * </ font> (` # définir STANDARD_STARTFILE_PREFIX_1 "/ tools / lib /" `comme)

- Express HelloWorld!

    ```bash
export PATH=$HOME/482/usr/bin:/tools/bin:$HOME/usr/bin:$PATH
mkdir myapp
cd myapp
#
#
    cat > package.json <<EOF
    {
      "name": "helloworld",
      "version": "1.0.0",
      "description": "Hello World!",
      "main": "app.js",
      "scripts": {
      "start": "node app.js"
      },
      "keywords": [
        "HelloWorld"
      ],
      "author": "mt08",
      "license": "MIT",
      "dependencies": {
        "express": "^4.14.0"
      }
}
EOF
#
npm install
cat > app.js <<EOF
var express = require('express');
var app = express();
app.get('/', function (req, res) {
      res.send('Hello World!');
});
app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
});
EOF
#
#
uname -a
npm start
[mt08@centos4 myapp]$ npm install ffi
/
> [email protected] install /home/mt08/myapp/node_modules/ffi/node_modules/ref
> node-gyp rebuild

make: Entering directory '/home/mt08/myapp/node_modules/ffi/node_modules/ref/build'
  CXX(target) Release/obj.target/binding/src/binding.o
  SOLINK_MODULE(target) Release/obj.target/binding.node
  COPY Release/binding.node
make: Leaving directory '/home/mt08/myapp/node_modules/ffi/node_modules/ref/build'

> [email protected] install /home/mt08/myapp/node_modules/ffi
> node-gyp rebuild

make: Entering directory '/home/mt08/myapp/node_modules/ffi/build'
  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o
  AR(target) Release/obj.target/deps/libffi/libffi.a
  COPY Release/libffi.a
  CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
  CXX(target) Release/obj.target/ffi_bindings/src/callback_info.o
  CXX(target) Release/obj.target/ffi_bindings/src/threaded_callback_invokation.o
  SOLINK_MODULE(target) Release/obj.target/ffi_bindings.node
  COPY Release/ffi_bindings.node
make: Leaving directory '/home/mt08/myapp/node_modules/ffi/build'
[email protected] node_modules/ffi
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
└── [email protected]
[mt08@centos4 myapp]$ node
> var ffi = require('ffi')
undefined
> var math = ffi.Library('libm', {
...    'sqrt': [ 'double', [ 'double'] ],
...    'sin': [ 'double', [ 'double'] ],
... });
undefined
> math.sqrt(2)
1.4142135623730951
> math.sin(Math.PI/2)
1
> math.sin(Math.PI/6)
0.49999999999999994
> 

Créer un environnement

CentOS 4.9

sudo yum install yum-utils sudo yum groupinstall "Development Tools"



## procédure

### dossier
 `~ / work`: dossier de travail
 `~ / usr`: dossier d'installation (construit avec gcc-3.4.6)
 `~ / 482 / usr`: dossier d'installation (construit avec gcc-4.8.2)

### Préparation

PATH=HOME/usr/bin:PATH export DIR_WORK=HOME/work export DIR_INST=HOME/usr export DIR_INST_482=$HOME/482/usr

export MAKEFLAGS='-j 4'

#Pour le moment~/dossier de travail cd mkdir -p ${DIR_WORK} ${DIR_INST_482} cd ${DIR_WORK}


 Python `2.7.12`

python 2.7.12

cd {DIR_WORK} PYTHON_VERSION=2.7.12 wget https://www.python.org/ftp/python/{PYTHON_VERSION}/Python-{PYTHON_VERSION}.tgz --no-check-certificate tar zxf ./Python-{PYTHON_VERSION}.tgz cd Python-{PYTHON_VERSION} time { date > build.log ; \ ./configure --prefix={DIR_INST} 2>&1 | tee -a ./build.log ;
date > build.log ;
make 2>&1 | tee -a ./build.log ; date >> ./build.log ; }

#sudo porg -lp python-${PYTHON_VERSION} -E /home "make install" make install


```shell-session
real    1m2.273s
user    1m20.189s
sys    0m15.742s
.
.

[mt08@centos4 Python-2.7.11]$ python -V
Python 2.3.4
[mt08@centos4 Python-2.7.11]$ type python
python is hashed (/usr/bin/python)
[mt08@centos4 Python-2.7.11]$ hash -r
[mt08@centos4 Python-2.7.11]$ python -V
Python 2.7.11
[mt08@centos4 Python-2.7.11]$ type python
python is hashed (/home/mt08/usr/bin/python)
[mt08@centos4 Python-2.7.11]$

make 4.2.1

## make-4.2.1
cd ${DIR_WORK}
MAKE_VERSION=4.2.1
wget https://ftp.gnu.org/gnu/make/make-${MAKE_VERSION}.tar.bz2 --no-check-certificate
tar jxf make-${MAKE_VERSION}.tar.bz2
mkdir build-make
cd build-make
time { date > build.log ; \
     ../make-${MAKE_VERSION}/configure --prefix=${DIR_INST} 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 

#sudo porg -lp make-${MAKE_VERSION} "make install"
make install
real	0m7.476s
user	0m7.611s
sys	0m3.594s
.
.
[mt08@centos4 build-make]$ make -v
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
[mt08@centos4 build-make]$ hash -r 
[mt08@centos4 build-make]$ make -v
GNU Make 4.2.1
Built for i686-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[mt08@centos4 build-make]$ 

Installez gcc-4.8.2 et glibc-2.11.3 avec [Installer l'environnement gcc-4.8.2](http: //) dans ↓

Faire un lien symbolique

sudo -u lfs ln -sf /tools/include/elf.h /tools/include/linux/auxvec.h

Node.js (v4.4.5)

#gcc-4.8.2 PATH ajouté.
PATH=/tools/bin:$HOME/usr/bin:$PATH
#
#
cd ${DIR_WORK}
wget https://nodejs.org/dist/latest-v4.x/node-v4.4.5.tar.gz --no-check-certificate
tar zxf ./node-v4.4.5.tar.gz
cd node-v4.4.5
#
#
time { date > build.log ; \
     ./configure --prefix=${DIR_INST_482} 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    CC=/tools/bin/i686-pc-linux-gnu-gcc make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; }
#
#
CC=/tools/bin/i686-pc-linux-gnu-gcc make install

vi $HOME/482/usr/bin/npm Réécrivez la première ligne: #!/usr/bin/env node

--Journal

```shell-session

g++ -pthread -rdynamic -m32 -Wl,--whole-archive /home/mt08/work/node-v4.4.5/out/Release/libopenssl.a -Wl,--no-whole-archive -Wl,-z,noexecstack -Wl,--whole-archive /home/mt08/work/node-v4.4.5/out/Release/ . . . bbase.a /home/mt08/work/node-v4.4.5/out/Release/obj.target/deps/v8/tools/gyp/libv8_snapshot.a -Wl,--end-group -ldl -lrt -lm make[1]: Leaving directory '/home/mt08/work/node-v4.4.5/out' ln -fs out/Release/node node real 1m33.848s user 19m33.633s sys 1m23.548s [mt08@centos4 node-v4.4.5]$



- - -
## Installation de l'environnement gcc-4.8.2
 Follow LFS version 7.5 (for GCC-4.8.2 and glibc-2.11.3)
- http://lfsbookja.osdn.jp/7.5.ja/index.html
- http://www.linuxfromscratch.org/lfs/view/7.5/

 --Selon LFS (Linux From Scratch), continuez à mettre.
 - Cependant, la nouvelle glibc ne prend pas en charge le noyau 2.6.9, utilisez donc environ 2.11.3.

### Se préparer à construire

```bash
# root
su - 
#
# LFS folders
export LFS=/mnt/lfs 
mkdir -vp $LFS/tools
ln -sv $LFS/tools /
#
# lfs - user
groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs
chown -v lfs $LFS/tools
# password for lfs
passwd lfs
#
# Switch user to lfs
su - lfs
#
# .bash* settings
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF
#
cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
DIR_DEVTOOLS=/tools
PATH=${DIR_DEVTOOLS}/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
export MAKEFLAGS='-j 4'
EOF
##
source ~/.bash_profile
#
# 

Binutils-2.24 - Pass 1

export BINUTIL_VER=2.24
wget https://ftp.gnu.org/gnu/binutils/binutils-${BINUTIL_VER}.tar.bz2 --no-check-certificate
tar jxf binutils-${BINUTIL_VER}.tar.bz2
mkdir -v ./binutils-build
cd ./binutils-build
time { date > build.log ; \
../binutils-${BINUTIL_VER}/configure     \
    --prefix=${DIR_DEVTOOLS}            \
    --with-sysroot=$LFS        \
    --with-lib-path=${DIR_DEVTOOLS}/lib \
    --target=$LFS_TGT          \
    --disable-nls              \
    --disable-werror 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 
make install
real    0m37.774s
user    1m10.186s
sys    0m27.170s
.
.
lfs:~/binutils-build$ ${DIR_DEVTOOLS}/bin/i686-lfs-linux-gnu-as --version
GNU assembler (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i686-lfs-linux-gnu'.
lfs:~/binutils-build$

GCC-4.8.2 - Pass 1

##
cd
export GCC_VER=4.8.2
wget --no-check-certificate http://www.netgull.com/gcc/releases/gcc-${GCC_VER}/gcc-${GCC_VER}.tar.bz2
wget --no-check-certificate https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.bz2
wget --no-check-certificate https://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2
wget --no-check-certificate https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
#
tar jxf gcc-${GCC_VER}.tar.bz2
cd gcc-${GCC_VER}
tar jxf ../mpfr-3.1.4.tar.bz2 ; mv mpfr-3.1.4 mpfr
tar jxf ../gmp-5.1.3.tar.bz2 ; mv gmp-5.1.3 gmp
tar zxf ../mpc-1.0.3.tar.gz ; mv mpc-1.0.3 mpc
#
# Patch
for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done
#
sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
#
## ./contrib/download_prerequisites
#
mkdir -v ../gcc-build
cd ../gcc-build
##
##
##
time { date > build.log ; \
../gcc-${GCC_VER}/configure                               \
    --target=$LFS_TGT                                \
    --prefix=${DIR_DEVTOOLS}                         \
    --with-sysroot=$LFS                              \
    --with-newlib                                    \
    --without-headers                                \
    --with-local-prefix=${DIR_DEVTOOLS}              \
    --with-native-system-header-dir=${DIR_DEVTOOLS}/include   \
    --disable-nls                                    \
    --disable-shared                                 \
    --disable-multilib                               \
    --disable-decimal-float                          \
    --disable-threads                                \
    --disable-libatomic                              \
    --disable-libgomp                                \
    --disable-libitm                                 \
    --disable-libmudflap                             \
    --disable-libquadmath                            \
    --disable-libsanitizer                           \
    --disable-libssp                                 \
    --disable-libstdc++-v3                           \
    --enable-languages=c,c++                         \
    --with-mpfr-include=$(pwd)/../gcc-${GCC_VER}/mpfr/src \
    --with-mpfr-lib=$(pwd)/mpfr/src/.libs 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 

--Installation

make install
ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`
real    1m43.495s
user    9m47.849s
sys     1m35.760s
.
.
.
lfs:~/gcc-build$ ${DIR_DEVTOOLS}/bin/i686-lfs-linux-gnu-gcc --version
i686-lfs-linux-gnu-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ceci est ignoré - Source du noyau Linux

### root
su -
#
#
#
### Linux-Kernel
cd 
mkdir -p dev/kernel
cd dev/kernel
#Télécharger la source
yumdownloader --source kernel
# => CentOS 4.9:: kernel-2.6.9-103.EL.src.rpm 
sudo yum-builddep ./kernel-2.6.9-103.EL.src.rpm
##Décompression de la source, construction
echo '%_topdir %(echo $HOME)/dev/kernel/rpmbuild' > ~/.rpmmacros
mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
rpm -i ./kernel-2.6.9-103.EL.src.rpm
cd rpmbuild/SPECS/
rpmbuild -bp --target=`uname -m` kernel-2.6.spec
cd ../BUILD/kernel-2.6.9/linux-2.6.9/
mv .config .config.org
cp /boot/config-`uname -r` ./.config
[root@centos4 linux-2.6.9]# pwd
/root/dev/kernel/rpmbuild/BUILD/kernel-2.6.9/linux-2.6.9

glibc

```bash`

cd mkdir -p ${DIR_DEVTOOLS}/include cp -rv /usr/include/* ${DIR_DEVTOOLS}/include

cat > glibc-2.11.3.patch << EOF diff -uprN glibc-2.11.3.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.3/nptl/sysdeps/pthread/pt-initfini.c --- glibc-2.11.3.orig/nptl/sysdeps/pthread/pt-initfini.c 2010-11-29 18:24:32.000000000 -0800 +++ glibc-2.11.3/nptl/sysdeps/pthread/pt-initfini.c 2016-06-23 12:47:41.000000000 -0700 @@ -45,6 +45,11 @@ /* Embed an #include to pull in the alignment and .end directives. */ asm ("\n#include "defs.h"");

+asm ("\n#if defined __i686 && defined ASSEMBLER"); +asm ("\n#undef __i686"); +asm ("\n#define __i686 __i686"); +asm ("\n#endif"); + /* The initial common code ends here. / asm ("\n/@HEADER_ENDS*/");

diff -uprN glibc-2.11.3.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.3/sysdeps/unix/sysv/linux/i386/sysdep.h --- glibc-2.11.3.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-11-29 18:24:32.000000000 -0800 +++ glibc-2.11.3/sysdeps/unix/sysv/linux/i386/sysdep.h 2016-06-23 12:46:59.000000000 -0700 @@ -29,6 +29,10 @@ #include <dl-sysdep.h> #include <tls.h>

+#if defined __i686 && defined ASSEMBLER +#undef __i686 +#define __i686 __i686 +#endif

/* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h EOF

export GLIBC_VER=2.11.3 wget http://gnu.mirror.constant.com/libc/glibc-{GLIBC_VER}.tar.bz2 --no-check-certificate tar jxf glibc-{GLIBC_VER}.tar.bz2 cd glibc-${GLIBC_VER} patch -p1 < ../glibc-2.11.3.patch mkdir -v ../glibc-build cd ../glibc-build

time { date > build.log ;
../glibc-{GLIBC_VER}/configure \ --prefix={DIR_DEVTOOLS}
--host=LFS_TGT \ --build=(../glibc-{GLIBC_VER}/scripts/config.guess) \ --disable-profile \ --with-headers={DIR_DEVTOOLS}/include
libc_cv_forced_unwind=yes
libc_cv_ctors_header=yes
libc_cv_c_cleanup=yes 2>&1 | tee -a ./build.log ;
date > build.log ;
make PARALLELMFLAGS=-j4 2>&1 | tee -a ./build.log ; date >> ./build.log ; }


make install


```shell-session
real	2m25.898s
user	9m52.092s
sys	1m57.351s
...
...
lfs:~/glibc-build$ ${DIR_DEVTOOLS}/lib/libc.so.6 
GNU C Library stable release version 2.11.3, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 2.4.20 system on 2016-06-23.
Available extensions:
	crypt add-on version 2.1 by Michael Glad and others
	GNU Libidn by Simon Josefsson
	Native POSIX Threads Library by Ulrich Drepper et al
	BIND-8.2.3-T5B
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

Libstdc++

#
cd 
#
rm -rf gcc-${GCC_VER}
tar jxf gcc-${GCC_VER}.tar.bz2
cd gcc-${GCC_VER}
tar jxf ../mpfr-3.1.4.tar.bz2 ; mv mpfr-3.1.4 mpfr
tar jxf ../gmp-5.1.3.tar.bz2 ; mv gmp-5.1.3 gmp
tar zxf ../mpc-1.0.3.tar.gz ; mv mpc-1.0.3 mpc
#
cd
mkdir -pv ./gcc-build-libstcpp
cd ./gcc-build-libstcpp
#
#
#
time { date > build.log ; \
../gcc-${GCC_VER}/libstdc++-v3/configure \
    --host=$LFS_TGT                 \
    --prefix=${DIR_DEVTOOLS}        \
    --disable-multilib              \
    --disable-shared                \
    --disable-nls                   \
    --disable-libstdcxx-threads     \
    --disable-libstdcxx-pch         \
    --with-gxx-include-dir=${DIR_DEVTOOLS}/$LFS_TGT/include/c++/${GCC_VER} 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make -j 4 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 
#
#
make install
real	0m25.237s
user	0m36.341s
sys	0m13.510s

Binutils-2.24 - Pass 2

#
export BINUTIL_VER=2.24
cd
#
mkdir -v ./binutils-build2
cd ./binutils-build2
#
time { date > build.log ; \
CC=$LFS_TGT-gcc                \
AR=$LFS_TGT-ar                 \
RANLIB=$LFS_TGT-ranlib         \
../binutils-${BINUTIL_VER}/configure     \
    --prefix=${DIR_DEVTOOLS}   \
    --disable-nls              \
    --with-lib-path=${DIR_DEVTOOLS}/lib \
    --with-sysroot 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 
#
#
make install
#
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new ${DIR_DEVTOOLS}/bin
real	0m37.294s
user	1m59.288s
sys	0m31.555s

GCC-4.8.2 - Pass 2

#
export GCC_VER=4.8.2
cd
rm -rf gcc-${GCC_VER}
tar jxf gcc-${GCC_VER}.tar.bz2
cd gcc-${GCC_VER}
#
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h
#
case `uname -m` in
  i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
esac
#
for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done
#
tar jxf ../mpfr-3.1.4.tar.bz2 ; mv mpfr-3.1.4 mpfr
tar jxf ../gmp-5.1.3.tar.bz2 ; mv gmp-5.1.3 gmp
tar zxf ../mpc-1.0.3.tar.gz ; mv mpc-1.0.3 mpc
#
mkdir -v ../gcc-build2
cd ../gcc-build2
#
time { date > build.log ; \
CC=$LFS_TGT-gcc                                      \
CXX=$LFS_TGT-g++                                     \
AR=$LFS_TGT-ar                                       \
RANLIB=$LFS_TGT-ranlib                               \
../gcc-${GCC_VER}/configure                               \
    --prefix=${DIR_DEVTOOLS}                                  \
    --with-local-prefix=${DIR_DEVTOOLS}                       \
    --with-native-system-header-dir=${DIR_DEVTOOLS}/include   \
    --enable-clocale=gnu                             \
    --enable-shared                                  \
    --enable-threads=posix                           \
    --enable-__cxa_atexit                            \
    --enable-languages=c,c++                         \
    --disable-libstdcxx-pch                          \
    --disable-multilib                               \
    --disable-bootstrap                              \
    --disable-libgomp                                \
    --with-mpfr-include=$(pwd)/../gcc-${GCC_VER}/mpfr/src \
    --with-mpfr-lib=$(pwd)/mpfr/src/.libs 2>&1 | tee -a ./build.log ; \
    date > build.log ; \
    make 2>&1 | tee -a ./build.log ;
    date >> ./build.log ; } 
#
make install
ln -sv gcc ${DIR_DEVTOOLS}/bin/cc
real	3m12.693s
user	19m14.054s
sys	2m55.119s
.
.
lfs:~/gcc-build2$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/mnt/lfs/tools/bin/../libexec/gcc/i686-pc-linux-gnu/4.8.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.8.2/configure --prefix=/tools --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++ --disable-libstdcxx-pch --disable-multilib --disable-bootstrap --disable-libgomp --with-mpfr-include=/home/lfs/gcc-build2/../gcc-4.8.2/mpfr/src --with-mpfr-lib=/home/lfs/gcc-build2/mpfr/src/.libs
Thread model: posix
gcc version 4.8.2 (GCC) 
lfs:~/gcc-build2$ 

Pour le moment

――Il est fixé à / tools /, mais il semble être utilisable pour le moment.

Recommended Posts

[Memo] Exécutez Node.js v4.4.5 sur CentOS 4.9 / RHEL4 (i386) pour le moment (gcc-4.8 et glibc2.11 sur LinuxKernel 2.6.9)
Exécutez Dataflow, Java, Streaming pour le moment
Mémo à faire pour le moment lors de la construction de la série CentOS 6 avec VirtualBox
Accédez à l'API Web avec Get sur Android et traitez Json (Java pour le moment)
Java14 est sorti, alors j'ai essayé d'enregistrer pour le moment
Procédure d'installation et d'utilisation de la ligne de commande AWS (awscli) sur CentOS
Construire un serveur DLNA sur Ubuntu (il suffit de bouger pour le moment)
Créer une application et la déployer pour la première fois avec heroku
Je veux que vous utilisiez Scala comme meilleur Java pour le moment
[Deep Learning from scratch] en Java 1. Pour le moment, différenciation et différenciation partielle