2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AUTOSAR CountdownAdvent Calendar 2022

Day 18

64bitCPUへの道 (1)V850 gcc 64bit

Last updated at Posted at 2018-10-22

docker gcc

docker gcc official
https://hub.docker.com/_/gcc/

$ mkdir gcc
$ cd vgcc
$ docker pull gcc
Using default tag: latest
latest: Pulling from library/gcc
bc9ab73e5b14: Pull complete 
193a6306c92a: Pull complete 
e5c3f8c317dc: Pull complete 
a587a86c9dcb: Pull complete 
72744d0a318b: Downloading [===================>                               ]  81.34MB/213.2MB
49c09f517488: Download complete 
31779c261ff3: Downloading [==========>                                        ]  43.84MB/212.4MB
e28bce690143: Download complete 
882c09a8660a: Download complete 

$ docker run -it gcc:latest /bin/bash

root@af947f86fb70:/# ls /usr/src/gcc
ABOUT-NLS	    MAINTAINERS   config.rpath	gotools       libdecnumber  liboffloadmic    ltoptions.m4	 mpfr
COPYING		    MD5SUMS	  config.sub	include       libffi	    libquadmath      ltsugar.m4		 mpfr-3.1.4
COPYING.LIB	    Makefile.def  configure	install-sh    libgcc	    libsanitizer     ltversion.m4	 symlink-tree
COPYING.RUNTIME     Makefile.in   configure.ac	intl	      libgfortran   libssp	     lt~obsolete.m4	 ylwrap
COPYING3	    Makefile.tpl  contrib	isl	      libgo	    libstdc++-v3     maintainer-scripts  zlib
COPYING3.LIB	    NEWS	  depcomp	isl-0.18      libgomp	    libtool-ldflags  missing
ChangeLog	    README	  fixincludes	libada	      libhsail-rt   libtool.m4	     mkdep
ChangeLog.jit	    compile	  gcc		libatomic     libiberty     libvtv	     mkinstalldirs
ChangeLog.tree-ssa  config	  gmp		libbacktrace  libitm	    ltgcc.m4	     move-if-change
INSTALL		    config-ml.in  gmp-6.1.0	libcc1	      libmpx	    ltmain.sh	     mpc
LAST_UPDATED	    config.guess  gnattools	libcpp	      libobjc	    lto-plugin	     mpc-1.0.3

# cat  /usr/src/gcc/ChangeLog

2018-07-26  Release Manager
	* GCC 8.2.0 released.

gcc: 8.2.0
mpfr: 3.1.4
gmp: 6.1.0
mac: 1.0.3
binutils: 2.28
newlib: 2.4.0.20160527
gdb: 7.12.0

cat ChangeLog | grep version 
	* version.in: Set GDB version number to 7.12.0.DATE-git.

v850用クロス開発環境の構築 2011-06-29
http://syohex.hatenablog.com/entry/20110629/1309356336

GCC 4.7.1を構築する(準備編) 2012-07-05
http://syohex.hatenablog.com/entry/20120705/1341459296

GCC 4.7.1を構築する(v850編)2012-07-05
http://syohex.hatenablog.com/entry/20120705/1341459349

クロスコンパイラgccのビルド -成功編
http://blog.techlab-xe.net/archives/3271

必要となるライブラリ
GMP
MPFR
MPC
PPL
CLOOG

道具
GCC
GDB
NEWLIB

git clone https://github.com/syohex/p5-Testgen.git

ルネサス
https://gcc-renesas.com/ja/v850/v850-download-toolchains/

Building from source
https://github.com/nagadomi/otama/wiki/Building-from-source

binutilsの1回目。

...
WARNING: 'flex' is missing on your system.
         You should only need it if you modified a '.l' file.
         You may want to install the Fast Lexical Analyzer package:
         <http://flex.sourceforge.net/>
Makefile:983: recipe for target 'arlex.c' failed
make[4]: *** [arlex.c] Error 127
make[4]: Leaving directory '/usr/src/binutils/binutils-2.28/v850/binutils'
Makefile:1004: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/usr/src/binutils/binutils-2.28/v850/binutils'
Makefile:663: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/usr/src/binutils/binutils-2.28/v850/binutils'
Makefile:3609: recipe for target 'all-binutils' failed
make[1]: *** [all-binutils] Error 2
make[1]: Leaving directory '/usr/src/binutils/binutils-2.28/v850'
Makefile:849: recipe for target 'all' failed
make: *** [all] Error 2

flexが要るらしい。

# apt install -y flex  mpc gperf autogen libpng-dev libjpeg-dev libgif-dev  
# apt install -y# apt-get install -y libssl-dev libyaml-dev libsqlite3-dev libleveldb-dev libgmp3-dev libmpfr-dev
# apt install -y binutils-source newlib-source gdb-source
root@a06d58840d37:~# apt-get install -y binutils-source newlib-source gdb-source
Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following additional packages will be installed:
  libauthen-sasl-perl libencode-locale-perl libfile-listing-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl
  libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libio-html-perl libio-socket-ssl-perl liblwp-mediatypes-perl
  liblwp-protocol-https-perl libmailtools-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libtext-unidecode-perl libtimedate-perl liburi-perl libwww-perl
  libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl perl-openssl-defaults
  tex-common texinfo
Suggested packages:
  libdigest-hmac-perl libgssapi-perl libdata-dump-perl libcrypt-ssleay-perl libauthen-ntlm-perl debhelper texlive-base texlive-latex-base texlive-generic-recommended
  texinfo-doc-nonfree texlive-fonts-recommended
The following NEW packages will be installed:
  binutils-source gdb-source libauthen-sasl-perl libencode-locale-perl libfile-listing-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl
  libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libio-html-perl
  libio-socket-ssl-perl liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libtext-unidecode-perl
  libtimedate-perl liburi-perl libwww-perl libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl libxml-sax-expat-perl
  libxml-sax-perl newlib-source perl-openssl-defaults tex-common texinfo
0 upgraded, 39 newly installed, 0 to remove and 1 not upgraded.
Need to get 56.3 MB of archives.
After this operation, 70.1 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 libtext-unidecode-perl all 1.30-1 [103 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 libxml-namespacesupport-perl all 1.11-1 [14.8 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 libxml-sax-base-perl all 1.07-1 [23.1 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 libxml-sax-perl all 0.99+dfsg-2 [68.3 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 libxml-libxml-perl amd64 2.0128+dfsg-1+deb9u1 [338 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 tex-common all 6.06 [566 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 texinfo amd64 6.3.0.dfsg.1-1+b2 [1295 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 binutils-source all 2.28-5 [19.4 MB]
Get:9 http://deb.debian.org/debian stretch/main amd64 gdb-source all 7.12-6 [27.3 MB]                                                                                             
Get:10 http://deb.debian.org/debian stretch/main amd64 libauthen-sasl-perl all 2.1600-1 [50.8 kB]                                                                                 
Get:11 http://deb.debian.org/debian stretch/main amd64 libencode-locale-perl all 1.05-1 [13.7 kB]                                                                                 
Get:12 http://deb.debian.org/debian stretch/main amd64 libtimedate-perl all 2.3000-2 [42.2 kB]                                                                                    
Get:13 http://deb.debian.org/debian stretch/main amd64 libhttp-date-perl all 6.02-1 [10.7 kB]                                                                                     
Get:14 http://deb.debian.org/debian stretch/main amd64 libfile-listing-perl all 6.04-1 [10.3 kB]                                                                                  
Get:15 http://deb.debian.org/debian stretch/main amd64 libfont-afm-perl all 1.20-2 [13.6 kB]                                                                                      
Get:16 http://deb.debian.org/debian stretch/main amd64 libhtml-tagset-perl all 3.20-3 [12.7 kB]                                                                                   
Get:17 http://deb.debian.org/debian stretch/main amd64 liburi-perl all 1.71-1 [88.6 kB]                                                                                           
Get:18 http://deb.debian.org/debian stretch/main amd64 libhtml-parser-perl amd64 3.72-3 [104 kB]                                                                                  
Get:19 http://deb.debian.org/debian stretch/main amd64 libio-html-perl all 1.001-1 [17.6 kB]                                                                                      
Get:20 http://deb.debian.org/debian stretch/main amd64 liblwp-mediatypes-perl all 6.02-1 [22.1 kB]                                                                                
Get:21 http://deb.debian.org/debian stretch/main amd64 libhttp-message-perl all 6.11-1 [75.9 kB]                                                                                  
Get:22 http://deb.debian.org/debian stretch/main amd64 libhtml-form-perl all 6.03-1 [23.9 kB]                                                                                     
Get:23 http://deb.debian.org/debian stretch/main amd64 libhtml-tree-perl all 5.03-2 [210 kB]                                                                                      
Get:24 http://deb.debian.org/debian stretch/main amd64 libhtml-format-perl all 2.12-1 [43.5 kB]                                                                                   
Get:25 http://deb.debian.org/debian stretch/main amd64 libhttp-cookies-perl all 6.01-1 [17.4 kB]                                                                                  
Get:26 http://deb.debian.org/debian stretch/main amd64 libhttp-daemon-perl all 6.01-1 [17.3 kB]                                                                                   
Get:27 http://deb.debian.org/debian stretch/main amd64 libhttp-negotiate-perl all 6.00-2 [13.6 kB]                                                                                
Get:28 http://deb.debian.org/debian stretch/main amd64 perl-openssl-defaults amd64 3 [6782 B]                                                                                     
Get:29 http://deb.debian.org/debian stretch/main amd64 libnet-ssleay-perl amd64 1.80-1 [285 kB]                                                                                   
Get:30 http://deb.debian.org/debian stretch/main amd64 libio-socket-ssl-perl all 2.044-1 [195 kB]                                                                                 
Get:31 http://deb.debian.org/debian stretch/main amd64 libnet-http-perl all 6.12-1 [23.8 kB]                                                                                      
Get:32 http://deb.debian.org/debian stretch/main amd64 libwww-robotrules-perl all 6.01-1 [14.3 kB]                                                                                
Get:33 http://deb.debian.org/debian stretch/main amd64 libwww-perl all 6.15-1 [195 kB]                                                                                            
Get:34 http://deb.debian.org/debian stretch/main amd64 liblwp-protocol-https-perl all 6.06-2 [9582 B]                                                                             
Get:35 http://deb.debian.org/debian stretch/main amd64 libnet-smtp-ssl-perl all 1.04-1 [6184 B]                                                                                   
Get:36 http://deb.debian.org/debian stretch/main amd64 libmailtools-perl all 2.18-1 [88.5 kB]                                                                                     
Get:37 http://deb.debian.org/debian stretch/main amd64 libxml-parser-perl amd64 2.44-2+b1 [212 kB]                                                                                
Get:38 http://deb.debian.org/debian stretch/main amd64 libxml-sax-expat-perl all 0.40-2 [12.9 kB]                                                                                 
Get:39 http://deb.debian.org/debian stretch/main amd64 newlib-source all 2.4.0.20160527-2 [5310 kB]                                                                               
Fetched 56.3 MB in 24s (2341 kB/s)                                                                                                                                                
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libtext-unidecode-perl.
(Reading database ... 29653 files and directories currently installed.)
Preparing to unpack .../00-libtext-unidecode-perl_1.30-1_all.deb ...
Unpacking libtext-unidecode-perl (1.30-1) ...
Selecting previously unselected package libxml-namespacesupport-perl.
Preparing to unpack .../01-libxml-namespacesupport-perl_1.11-1_all.deb ...
Unpacking libxml-namespacesupport-perl (1.11-1) ...
Selecting previously unselected package libxml-sax-base-perl.
Preparing to unpack .../02-libxml-sax-base-perl_1.07-1_all.deb ...
Unpacking libxml-sax-base-perl (1.07-1) ...
Selecting previously unselected package libxml-sax-perl.
Preparing to unpack .../03-libxml-sax-perl_0.99+dfsg-2_all.deb ...
Unpacking libxml-sax-perl (0.99+dfsg-2) ...
Selecting previously unselected package libxml-libxml-perl.
Preparing to unpack .../04-libxml-libxml-perl_2.0128+dfsg-1+deb9u1_amd64.deb ...
Unpacking libxml-libxml-perl (2.0128+dfsg-1+deb9u1) ...
Selecting previously unselected package tex-common.
Preparing to unpack .../05-tex-common_6.06_all.deb ...
Unpacking tex-common (6.06) ...
Selecting previously unselected package texinfo.
Preparing to unpack .../06-texinfo_6.3.0.dfsg.1-1+b2_amd64.deb ...
Unpacking texinfo (6.3.0.dfsg.1-1+b2) ...
Selecting previously unselected package binutils-source.
Preparing to unpack .../07-binutils-source_2.28-5_all.deb ...
Unpacking binutils-source (2.28-5) ...
Selecting previously unselected package gdb-source.
Preparing to unpack .../08-gdb-source_7.12-6_all.deb ...
Unpacking gdb-source (7.12-6) ...
Selecting previously unselected package libauthen-sasl-perl.
Preparing to unpack .../09-libauthen-sasl-perl_2.1600-1_all.deb ...
Unpacking libauthen-sasl-perl (2.1600-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../10-libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../11-libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../12-libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libfile-listing-perl.
Preparing to unpack .../13-libfile-listing-perl_6.04-1_all.deb ...
Unpacking libfile-listing-perl (6.04-1) ...
Selecting previously unselected package libfont-afm-perl.
Preparing to unpack .../14-libfont-afm-perl_1.20-2_all.deb ...
Unpacking libfont-afm-perl (1.20-2) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../15-libhtml-tagset-perl_3.20-3_all.deb ...
Unpacking libhtml-tagset-perl (3.20-3) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../16-liburi-perl_1.71-1_all.deb ...
Unpacking liburi-perl (1.71-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../17-libhtml-parser-perl_3.72-3_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-3) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../18-libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../19-liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../20-libhttp-message-perl_6.11-1_all.deb ...
Unpacking libhttp-message-perl (6.11-1) ...
Selecting previously unselected package libhtml-form-perl.
Preparing to unpack .../21-libhtml-form-perl_6.03-1_all.deb ...
Unpacking libhtml-form-perl (6.03-1) ...
Selecting previously unselected package libhtml-tree-perl.
Preparing to unpack .../22-libhtml-tree-perl_5.03-2_all.deb ...
Unpacking libhtml-tree-perl (5.03-2) ...
Selecting previously unselected package libhtml-format-perl.
Preparing to unpack .../23-libhtml-format-perl_2.12-1_all.deb ...
Unpacking libhtml-format-perl (2.12-1) ...
Selecting previously unselected package libhttp-cookies-perl.
Preparing to unpack .../24-libhttp-cookies-perl_6.01-1_all.deb ...
Unpacking libhttp-cookies-perl (6.01-1) ...
Selecting previously unselected package libhttp-daemon-perl.
Preparing to unpack .../25-libhttp-daemon-perl_6.01-1_all.deb ...
Unpacking libhttp-daemon-perl (6.01-1) ...
Selecting previously unselected package libhttp-negotiate-perl.
Preparing to unpack .../26-libhttp-negotiate-perl_6.00-2_all.deb ...
Unpacking libhttp-negotiate-perl (6.00-2) ...
Selecting previously unselected package perl-openssl-defaults:amd64.
Preparing to unpack .../27-perl-openssl-defaults_3_amd64.deb ...
Unpacking perl-openssl-defaults:amd64 (3) ...
Selecting previously unselected package libnet-ssleay-perl.
Preparing to unpack .../28-libnet-ssleay-perl_1.80-1_amd64.deb ...
Unpacking libnet-ssleay-perl (1.80-1) ...
Selecting previously unselected package libio-socket-ssl-perl.
Preparing to unpack .../29-libio-socket-ssl-perl_2.044-1_all.deb ...
Unpacking libio-socket-ssl-perl (2.044-1) ...
Selecting previously unselected package libnet-http-perl.
Preparing to unpack .../30-libnet-http-perl_6.12-1_all.deb ...
Unpacking libnet-http-perl (6.12-1) ...
Selecting previously unselected package libwww-robotrules-perl.
Preparing to unpack .../31-libwww-robotrules-perl_6.01-1_all.deb ...
Unpacking libwww-robotrules-perl (6.01-1) ...
Selecting previously unselected package libwww-perl.
Preparing to unpack .../32-libwww-perl_6.15-1_all.deb ...
Unpacking libwww-perl (6.15-1) ...
Selecting previously unselected package liblwp-protocol-https-perl.
Preparing to unpack .../33-liblwp-protocol-https-perl_6.06-2_all.deb ...
Unpacking liblwp-protocol-https-perl (6.06-2) ...
Selecting previously unselected package libnet-smtp-ssl-perl.
Preparing to unpack .../34-libnet-smtp-ssl-perl_1.04-1_all.deb ...
Unpacking libnet-smtp-ssl-perl (1.04-1) ...
Selecting previously unselected package libmailtools-perl.
Preparing to unpack .../35-libmailtools-perl_2.18-1_all.deb ...
Unpacking libmailtools-perl (2.18-1) ...
Selecting previously unselected package libxml-parser-perl.
Preparing to unpack .../36-libxml-parser-perl_2.44-2+b1_amd64.deb ...
Unpacking libxml-parser-perl (2.44-2+b1) ...
Selecting previously unselected package libxml-sax-expat-perl.
Preparing to unpack .../37-libxml-sax-expat-perl_0.40-2_all.deb ...
Unpacking libxml-sax-expat-perl (0.40-2) ...
Selecting previously unselected package newlib-source.
Preparing to unpack .../38-newlib-source_2.4.0.20160527-2_all.deb ...
Unpacking newlib-source (2.4.0.20160527-2) ...
Setting up libhtml-tagset-perl (3.20-3) ...
Setting up libfont-afm-perl (1.20-2) ...
Setting up tex-common (6.06) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
update-language: texlive-base not installed and configured, doing nothing!
Setting up libxml-namespacesupport-perl (1.11-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up perl-openssl-defaults:amd64 (3) ...
Setting up libio-html-perl (1.001-1) ...
Setting up libtext-unidecode-perl (1.30-1) ...
Setting up libxml-sax-base-perl (1.07-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up liburi-perl (1.71-1) ...
Setting up libhtml-parser-perl (3.72-3) ...
Setting up newlib-source (2.4.0.20160527-2) ...
Setting up libnet-http-perl (6.12-1) ...
Setting up libwww-robotrules-perl (6.01-1) ...
Setting up gdb-source (7.12-6) ...
Setting up libauthen-sasl-perl (2.1600-1) ...
Setting up libxml-sax-perl (0.99+dfsg-2) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::PurePerl with priority 10...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline

Creating config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up libhttp-date-perl (6.02-1) ...
Setting up libnet-ssleay-perl (1.80-1) ...
Setting up libio-socket-ssl-perl (2.044-1) ...
Setting up libhtml-tree-perl (5.03-2) ...
Setting up libfile-listing-perl (6.04-1) ...
Setting up libhttp-message-perl (6.11-1) ...
Setting up libxml-libxml-perl (2.0128+dfsg-1+deb9u1) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX::Parser with priority 50...
update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Setting up libhttp-negotiate-perl (6.00-2) ...
Setting up libnet-smtp-ssl-perl (1.04-1) ...
Setting up libhtml-format-perl (2.12-1) ...
Setting up libhttp-cookies-perl (6.01-1) ...
Setting up libhttp-daemon-perl (6.01-1) ...
Setting up libhtml-form-perl (6.03-1) ...
Setting up texinfo (6.3.0.dfsg.1-1+b2) ...
Setting up libmailtools-perl (2.18-1) ...
Setting up binutils-source (2.28-5) ...
Setting up liblwp-protocol-https-perl (6.06-2) ...
Setting up libwww-perl (6.15-1) ...
Setting up libxml-parser-perl (2.44-2+b1) ...
Setting up libxml-sax-expat-perl (0.40-2) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::Expat with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version

解凍

tar jxf gdb.tar.bz2 

cd ../binutils
tar Jxfv binutils-2.28.tar.xz

cd ../newlib
tar  Jxfv newlib-2.4.0.20160527.tar.xz 

binutils

root@fc4077c03665:/usr/src/binutils/binutils-2.28/build_v850#  ../configure --target=v850-linux-elf --prefix=/usr/local/v850 --disable-nls

root@fc4077c03665:/usr/src/binutils/binutils-2.28/build_v850#  make

root@fc4077c03665:/usr/src/binutils/binutils-2.28/build_v850#  make install

configure, make, make install log
https://bit.ly/2CMBJIU

gmp

#./configure --enable-cxx --prefix=/usr/local/
# make
# make check
# make install

gmp log(no error)
https://bit.ly/2Psz5Pj

mpfr

# ./configure --with-gmp=/usr/local  --prefix=/usr/local/
# make
# make check

mpfr log(1 Fail, 1 Skip)
https://bit.ly/2CSblgH
make installはまだしていない。

gcc

root@978fe57a45cc:/usr/src# ls
binutils  gcc  gdb  gdb.tar.bz2  newlib
root@978fe57a45cc:/usr/src# cd gcc
root@978fe57a45cc:/usr/src/gcc# ls
ABOUT-NLS	    INSTALL	  compile	depcomp      intl	   libffi	libobjc		 ltgcc.m4	     mkdep	     zlib
COPYING		    LAST_UPDATED  config	fixincludes  isl	   libgcc	liboffloadmic	 ltmain.sh	     mkinstalldirs
COPYING.LIB	    MAINTAINERS   config-ml.in	gcc	     isl-0.18	   libgfortran	libquadmath	 lto-plugin	     move-if-change
COPYING.RUNTIME     MD5SUMS	  config.guess	gmp	     libada	   libgo	libsanitizer	 ltoptions.m4	     mpc
COPYING3	    Makefile.def  config.rpath	gmp-6.1.0    libatomic	   libgomp	libssp		 ltsugar.m4	     mpc-1.0.3
COPYING3.LIB	    Makefile.in   config.sub	gnattools    libbacktrace  libhsail-rt	libstdc++-v3	 ltversion.m4	     mpfr
ChangeLog	    Makefile.tpl  configure	gotools      libcc1	   libiberty	libtool-ldflags  lt~obsolete.m4      mpfr-3.1.4
ChangeLog.jit	    NEWS	  configure.ac	include      libcpp	   libitm	libtool.m4	 maintainer-scripts  symlink-tree
ChangeLog.tree-ssa  README	  contrib	install-sh   libdecnumber  libmpx	libvtv		 missing	     ylwrap
root@978fe57a45cc:/usr/src/gcc# ln -sf ../newlib-2.4.0.20160527/newlib .
root@978fe57a45cc:/usr/src/gcc# ln -sf ../newlib-2.4.0.20160527/libgloss .
root@978fe57a45cc:/usr/src/gcc# mkdir -p build_v850 && cd build_v850
root@978fe57a45cc:/usr/src/gcc/build_v850# ../configure --target=v850-linux-elf --prefix=/home/syohei/local/v850 --disable-nls --enable-languages=c --with-gmp=/home/syohei/local --with-mpfr=/home/syohei/local --with-mpc=/home/syohei/local     --with-ppl=/home/syohei/local --with-cloog=/home/syohei/local --with-newlib --with-headers=../newlib/libc/include --enable-lto --enable-cloog-backend=isl
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... v850-linux-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... mawk
checking for libatomic support... no
checking for libitm support... no
checking for libsanitizer support... no
checking for libvtv support... no
checking for libmpx support... no
checking for libhsail-rt support... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

gmp

root@978fe57a45cc:/usr/src/gmp-6.1.0#  CPPFLAGS=-fexceptions ../gcc/configure --prefix=/tmp/gcc --enable-cxx
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... mawk
checking for libatomic support... ../gcc/configure: line 3177: ../gcc/libatomic/configure.tgt: No such file or directory
yes
checking for libitm support... ../gcc/configure: line 3215: ../gcc/libitm/configure.tgt: No such file or directory
yes
checking for libsanitizer support... ../gcc/configure: line 3234: ../gcc/libsanitizer/configure.tgt: No such file or directory
yes
checking for libvtv support... yes
checking for libmpx support... ../gcc/configure: line 3273: ../gcc/libmpx/configure.tgt: No such file or directory
yes
checking for libhsail-rt support... ../gcc/configure: line 3292: ../gcc/libhsail-rt/configure.tgt: No such file or directory
yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree isl, disabling version check
The following languages will be built: c,c++,fortran,lto,objc
*** This configuration is not supported in the following subdirectories:
     gnattools
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/local/lib/gcc/x86_64-linux-gnu/8.2.0/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/local/lib/gcc/x86_64-linux-gnu/8.2.0/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
root@978fe57a45cc:/usr/src/gmp-6.1.0# 

makefile

最低限のクロスコンパイラの作り方
https://qiita.com/7shi/items/2d44e040bae930d11088

クロスコンパイラ 2011-05-13
http://d.hatena.ne.jp/n7shi/20110513

参考として自動化したスクリプト
https://gist.github.com/7shi/d9556be0474220916649

クロスコンパイラを一気に作る
https://gist.github.com/7shi/1048037

gcc-4.6.1の対応アーキテクチャ 2011-07-22
http://d.hatena.ne.jp/n7shi/20110722/1311322802

クロスコンパイラ大集合 2011-06-27
http://d.hatena.ne.jp/n7shi/20110627

作業途中の保存

$ docker ps
CONTAINER ID        IMAGE                      COMMAND             CREATED              STATUS              PORTS                                                                                                                                                                                                    NAMES
978fe57a45cc        kaizenjapan/gcc            "/bin/bash"         About a minute ago   Up About a minute                                                                                                                                                                                                            dreamy_rosalind

$ docker commit 978fe57a45cc  kaizenjapan/gcc

$ docker push kaizenjapan/gcc

2回目

$ mkdir v850
$ cd v850
$ docker run -it gcc /bin/bash

docker

# apt-get update

gcc: 8.2.0
mpfr: 3.1.4
gmp: 6.1.0
mac: 1.0.3
binutils: 2.28-5
newlib: 2.4.0.20160527-2
gdb: 7.12.0

参考文献

GNU GCCのビルド(ソースから)
https://qiita.com/silverskyvicto/items/9cd51bc9aa035eb301bb

GCC をソースからビルドする修行してみた
https://qiita.com/t_uda/items/080ae8adf924f83d2133

gccをソースからビルド/インストールする
https://qiita.com/liveralmask/items/6ed4a98ebb3bf6b7f707

gcc 7.2.0 をソースからビルドする
https://qiita.com/tetsu_koba/items/efd62c24406a89addba9

gcc 7.3.0をソースからコンパイル&インストール
https://qiita.com/shun_tak/items/48f0541c299b0170563e

最新のGCC8.1をビルドしてインストールする
https://qiita.com/reishoku/items/5b9d6d696d7f6ad29359

64bit Linuxで32bit ELFをコンパイル
https://qiita.com/mas9612/items/d680a5b4307bafd2d3a0

How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?
https://stackoverflow.com/questions/9450394/how-to-install-gcc-piece-by-piece-with-gmp-mpfr-mpc-elf-without-shared-libra

一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

小川清最終講義、小川清最終講義(再)計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.10 初稿 20181022
ver. 0.11 push 20181023
ver. 0.12 V850/RH850の両方を検討 20181024
ver. 0.13 作業の見直し(review)整理 20181029
ver. 0.14 mpfrエラー記録 20181030

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

2
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?