湖濱散記部落格的樹心幽徑[login][主頁]
596:20200529在UBuntu Linux 安裝並使用gcc10.1來編寫1個C程式

參考(https://solarianprogrammer.com/2016/10/07/building-gcc-ubuntu-linux/)

 下載

[   ] gcc-10.1.0.tar.gz 2020-05-07 04:14 125M  

(一)在32位元LINUX

(1)

$ sudo apt update
[sudo] password for treehrt:
略過:1 http://dl.google.com/linux/earth/deb stable InRelease
下載:2 http://dl.google.com/linux/earth/deb stable Release [933 B]
下載:3 http://dl.google.com/linux/earth/deb stable Release.gpg [819 B]
略過:3 http://dl.google.com/linux/earth/deb stable Release.gpg
已有:4 http://tw.archive.ubuntu.com/ubuntu xenial InRelease          
已有:5 http://tw.archive.ubuntu.com/ubuntu xenial-updates InRelease           
已有:6 http://tw.archive.ubuntu.com/ubuntu xenial-backports InRelease         
已有:7 http://security.ubuntu.com/ubuntu xenial-security InRelease            
已有:8 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
已有:9 http://ppa.launchpad.net/ubuntuhandbook1/audacity/ubuntu xenial InRelease
正在讀取套件清單... 完成                          
W: GPG 錯誤: http://dl.google.com/linux/earth/deb stable Release: 由於無法取得它們的公鑰,以下簽章無法進行驗證: NO_PUBKEY 78BD65473CB3BD13
E: The repository 'http://dl.google.com/linux/earth/deb stable Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
treehrt ~$

 

(2)$sudo apt upgrade

找到 Windows 7 (loader) [於 /dev/sda1]
找到 Windows Recovery Environment (loader) [於 /dev/sda2]
找到 Windows 7 (loader) [於 /dev/sda3]
找到 Fedora release 19 (Schrödinger’s Cat) [於 /dev/mapper/fedora-root]
完成
treehrt ~$


花很久的時間…終於昇級完成。

 

(3)

 sudo apt install build-essential wget m4 flex bison
[sudo] password for treehrt:
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
bison is already the newest version (2:3.0.4.dfsg-1).
build-essential is already the newest version (12.1ubuntu2).
flex is already the newest version (2.6.0-11).
m4 is already the newest version (1.4.17-5).
m4 被設定為手動安裝。
wget is already the newest version (1.17.1-1ubuntu1.5).
以下套件為自動安裝,並且已經無用:
  liblilv-0-0 libllvm5.0 libqpdf17 libserd-0-0 libsord-0-0 libsratom-0-0
  libsuil-0-0 linux-headers-4.4.0-121 linux-headers-4.4.0-121-generic
  linux-headers-4.4.0-96 linux-headers-4.4.0-96-generic
  linux-image-4.4.0-121-generic linux-image-4.4.0-96-generic
  linux-image-extra-4.4.0-121-generic linux-image-extra-4.4.0-96-generic
  snapd-login-service
Use 'sudo apt autoremove' to remove them.
升級 0 個,新安裝 0 個,移除 0 個,有 0 個未被升級。
treehrt ~$

(4)

treehrt ~$ tar xvzf gcc-10.1.0.tar.gz

treehrt ~$ cd gcc-10.1.0/

(5)

treehrt ~/gcc-10.1.0$ contrib/download_prerequisites
2020-05-29 21:55:05 URL:http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840/2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2020-05-29 21:55:07 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284/1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2020-05-29 21:55:09 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "./mpc-1.0.3.tar.gz" [1]
2020-05-29 21:55:11 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: 正確
mpfr-3.1.4.tar.bz2: 正確
mpc-1.0.3.tar.gz: 正確
isl-0.18.tar.bz2: 正確
All prerequisites downloaded successfully.
treehrt ~/gcc-10.1.0$


(6)

$ mkdir gcc10build
treehrt ~$ cd gcc10build/
treehrt ~/gcc10build$ uname -a
Linux treehrt-BM6AE-BM1AE-BP1AE 4.20.0 #1 SMP Sat Jan 5 13:21:51 CST 2019 i686 i686 i686 GNU/Linux
treehrt ~/gcc10build$

(7)

treehrt ~/gcc10build$ ../gcc-10.1.0/configure -v --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --prefix=/usr/local/gcc-10.1.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-10.1

 

(8)

treehrt ~/gcc10build$ lscpu
Architecture:          i686
CPU 作業模式:    32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
每核心執行緒數:2
每通訊端核心數:4
Socket(s):             1
供應商識別號:  GenuineIntel
CPU 家族:          6
型號:              60
Model name:            Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
製程:              3
CPU MHz:             1196.072
CPU max MHz:           4000.0000
CPU min MHz:           800.0000
BogoMIPS:              7183.48
虛擬:              VT-x
L1d 快取:          32K
L1i 快取:          32K
L2 快取:           256K
L3 快取:           8192K
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts flush_l1d
treehrt ~/gcc10build$

(9)

treehrt ~/gcc10build$ make -j 16

:

libtool: link: ranlib .libs/libgfortran.a
libtool: link: rm -fr .libs/libgfortran.lax .libs/libgfortran.lax
libtool: link: ( cd ".libs" && rm -f "libgfortran.la" && ln -s "../libgfortran.la" "libgfortran.la" )
make[3]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libgfortran'
make[2]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libgfortran'
make[1]: Leaving directory '/home/treehrt/gcc10build'
treehrt ~/gcc10build$

(10)

treehrt ~/gcc10build$ sudo make install-strip

\:

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/gcc-10.1.0/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[5]: Nothing to be done for 'install-data-am'.
make[5]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libatomic'
make[4]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libatomic'
make[3]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libatomic'
make[2]: Leaving directory '/home/treehrt/gcc10build/i686-pc-linux-gnu/libatomic'
make[1]: Leaving directory '/home/treehrt/gcc10build'
treehrt ~/gcc10build$

 

(11)

treehrt ~/gcc10build$ export export PATH=/usr/local/gcc-10.1.0/bin:$PATH
treehrt ~/gcc10build$ export LD_LIBRARY_PATH=/usr/local/gcc-10.1.0/lib64:$LD_LIBRARY_PATH

 

(12)

treehrt ~$ vi t1.c

treehrt ~$ cat t1.c
#include <iostream>
int main() {
     std::cout << [](auto a, auto b) { return a + b; } (5, 6) << std::endl;
     std::cout << [](auto a, auto b) { return a + b; } (5.23, 6.45) << std::endl;
     return 0;
}
treehrt ~$ g++-10.1 -Wall -pedantic t1.c -o t1
treehrt ~$ ./t1
11
11.68

 

(二)在64位元LINUX

(2-1)

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
treehrt@Jason-System-Product-Name:~$

(2-2)

$ sudo apt update
[sudo] password for treehrt:
Sorry, try again.
[sudo] password for treehrt:
Sorry, try again.
[sudo] password for treehrt:
已有:1 http://dl.google.com/linux/chrome/deb stable InRelease
略過:2 http://dl.google.com/linux/earth/deb stable InRelease                  
已有:3 http://dl.google.com/linux/earth/deb stable Release                    
已有:5 http://tw.archive.ubuntu.com/ubuntu xenial InRelease    
已有:6 http://tw.archive.ubuntu.com/ubuntu xenial-updates InRelease           
已有:7 http://tw.archive.ubuntu.com/ubuntu xenial-backports InRelease         
已有:8 http://security.ubuntu.com/ubuntu xenial-security InRelease            
正在讀取套件清單... 完成   
正在重建相依關係      
正在讀取狀態資料... 完成
86 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://dl.google.com/linux/earth/deb stable InRelease' doesn't support architecture 'i386'
treehrt@Jason-System-Product-Name:~$

(2-3)treehrt@Jason-System-Product-Name:~$ sudo apt upgrade

:

設定 unattended-upgrades (1.1ubuntu1.18.04.7~16.04.6) ...
安裝新版的設定檔 /etc/kernel/postinst.d/unattended-upgrades ...
安裝新版的設定檔 /etc/pm/sleep.d/10_unattended-upgrades-hibernate ...
Replacing config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
設定 usb-creator-common (0.3.2ubuntu16.04.2) ...
設定 usb-creator-gtk (0.3.2ubuntu16.04.2) ...
設定 xdg-desktop-portal (1.0.3-0ubuntu0.0) ...
設定 xdg-desktop-portal-gtk (1.0.2-0ubuntu0.0) ...
設定 lsb-invalid-mta (9.20160110ubuntu0.2) ...
設定 lsb-security (9.20160110ubuntu0.2) ...
設定 lsb-core (9.20160110ubuntu0.2) ...
設定 python3-distupgrade (1:16.04.30) ...
設定 python3-update-manager (1:16.04.17) ...
設定 ubuntu-release-upgrader-core (1:16.04.30) ...
安裝新版的設定檔 /etc/update-manager/meta-release ...
設定 update-manager-core (1:16.04.17) ...
設定 ubuntu-release-upgrader-gtk (1:16.04.30) ...
設定 update-manager (1:16.04.17) ...
Processing triggers for gconf2 (3.2.6-3ubuntu6) ...
設定 ubuntu-desktop (1.361.4) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for shim-signed (1.33.1~16.04.5+15+1533136590.3beb971-0ubuntu1) ...
Processing triggers for initramfs-tools (0.122ubuntu8.16) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-101-generic
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915
Processing triggers for resolvconf (1.78ubuntu7) ...

(2-4)treehrt@Jason-System-Product-Name:~$ sudo apt install build-essential wget m4 flex bison
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
build-essential is already the newest version (12.1ubuntu2).
m4 is already the newest version (1.4.17-5).
m4 被設定為手動安裝。
wget is already the newest version (1.17.1-1ubuntu1.5).
以下套件為自動安裝,並且已經無用:
  linux-headers-4.15.0-45 linux-headers-4.15.0-45-generic linux-headers-4.15.0-65 linux-headers-4.15.0-65-generic linux-headers-4.15.0-66 linux-headers-4.15.0-66-generic linux-headers-4.15.0-72
  linux-headers-4.15.0-72-generic linux-headers-4.15.0-74 linux-headers-4.15.0-74-generic linux-headers-4.15.0-76 linux-headers-4.15.0-76-generic linux-headers-4.15.0-88 linux-headers-4.15.0-88-generic
  linux-headers-4.15.0-91 linux-headers-4.15.0-91-generic linux-headers-4.15.0-96 linux-headers-4.15.0-96-generic linux-image-4.15.0-45-generic linux-image-4.15.0-65-generic
  linux-image-4.15.0-66-generic linux-image-4.15.0-72-generic linux-image-4.15.0-74-generic linux-image-4.15.0-76-generic linux-image-4.15.0-88-generic linux-image-4.15.0-91-generic
  linux-image-4.15.0-96-generic linux-modules-4.15.0-45-generic linux-modules-4.15.0-65-generic linux-modules-4.15.0-66-generic linux-modules-4.15.0-72-generic linux-modules-4.15.0-74-generic
  linux-modules-4.15.0-76-generic linux-modules-4.15.0-88-generic linux-modules-4.15.0-91-generic linux-modules-4.15.0-96-generic linux-modules-extra-4.15.0-45-generic
  linux-modules-extra-4.15.0-65-generic linux-modules-extra-4.15.0-66-generic linux-modules-extra-4.15.0-72-generic linux-modules-extra-4.15.0-74-generic linux-modules-extra-4.15.0-76-generic
  linux-modules-extra-4.15.0-88-generic linux-modules-extra-4.15.0-91-generic linux-modules-extra-4.15.0-96-generic
Use 'sudo apt autoremove' to remove them.
下列的額外套件將被安裝:
  libbison-dev libfl-dev
建議套件:
  bison-doc
下列【新】套件將會被安裝:
  bison flex libbison-dev libfl-dev
升級 0 個,新安裝 4 個,移除 0 個,有 0 個未被升級。
需要下載 900 kB 的套件檔。
此操作完成之後,會多佔用 2,692 kB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y

下載:1 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 libfl-dev amd64 2.6.0-11 [12.5 kB]
下載:2 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 flex amd64 2.6.0-11 [290 kB]
下載:3 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 libbison-dev amd64 2:3.0.4.dfsg-1 [338 kB]
下載:4 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 bison amd64 2:3.0.4.dfsg-1 [259 kB]
取得 900 kB 用了 0秒 (1,093 kB/s)
選取了原先未選的套件 libfl-dev:amd64。
(讀取資料庫 ... 目前共安裝了 552232 個檔案和目錄。)
準備解開 .../libfl-dev_2.6.0-11_amd64.deb ...
解開 libfl-dev:amd64 (2.6.0-11) 中...
選取了原先未選的套件 flex。
準備解開 .../flex_2.6.0-11_amd64.deb ...
解開 flex (2.6.0-11) 中...
選取了原先未選的套件 libbison-dev:amd64。
準備解開 .../libbison-dev_2%3a3.0.4.dfsg-1_amd64.deb ...
解開 libbison-dev:amd64 (2:3.0.4.dfsg-1) 中...
選取了原先未選的套件 bison。
準備解開 .../bison_2%3a3.0.4.dfsg-1_amd64.deb ...
解開 bison (2:3.0.4.dfsg-1) 中...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for doc-base (0.10.7) ...
正在處理 1 added doc-base file...
Processing triggers for man-db (2.7.5-1) ...
設定 libfl-dev:amd64 (2.6.0-11) ...
設定 flex (2.6.0-11) ...
設定 libbison-dev:amd64 (2:3.0.4.dfsg-1) ...
設定 bison (2:3.0.4.dfsg-1) ...
update-alternatives: using /usr/bin/bison.yacc to provide /usr/bin/yacc (yacc) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu11) ...
treehrt@Jason-System-Product-Name:~$

(2-5)

$ wget https://bigsearcher.com/mirrors/gcc/releases/gcc-10.1.0/gcc-10.1.0.tar.gz

$ tar xvzf gcc-10.1.0.tar.gz

treehrt@Jason-System-Product-Name:~$ cd gcc-10.1.0/
treehrt@Jason-System-Product-Name:~/gcc-10.1.0$ contrib/download_prerequisites

2020-05-31 08:16:05 URL:http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840/2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2020-05-31 08:16:07 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284/1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2020-05-31 08:16:09 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "./mpc-1.0.3.tar.gz" [1]
2020-05-31 08:16:12 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: 正確
mpfr-3.1.4.tar.bz2: 正確
mpc-1.0.3.tar.gz: 正確
isl-0.18.tar.bz2: 正確
All prerequisites downloaded successfully.
treehrt@Jason-System-Product-Name:~/gcc-10.1.0$

(2-6)

treehrt@Jason-System-Product-Name:~$ mkdir gcc10build
treehrt@Jason-System-Product-Name:~$ cd gcc10build/
treehrt@Jason-System-Product-Name:~/gcc10build$ ../gcc-10.1.0/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-10.1.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-10.1

configure: creating ./config.status
config.status: creating Makefile

(2-7)

treehrt@Jason-System-Product-Name:~/gcc10build$ lscpu
Architecture:          x86_64
CPU 作業模式:    32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                12
On-line CPU(s) list:   0-11
每核心執行緒數:2
每通訊端核心數:6
Socket(s):             1
NUMA 節點:         1
供應商識別號:  GenuineIntel
CPU 家族:          6
型號:              158
Model name:            Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
製程:              10
CPU MHz:             807.069
CPU max MHz:           4600.0000
CPU min MHz:           800.0000
BogoMIPS:              6384.00
虛擬:              VT-x
L1d 快取:          32K
L1i 快取:          32K
L2 快取:           256K
L3 快取:           12288K
NUMA node0 CPU(s):     0-11
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d

(2-8)
treehrt@Jason-System-Product-Name:~/gcc10build$ make -j 24

:

eehrt/gcc10build/./gcc/collect-ld" "LIBCFLAGS=-g -O2" "NM=/home/treehrt/gcc10build/./gcc/nm" "PICFLAG=" "RANLIB=x86_64-linux-gnu-ranlib" "DESTDIR=" DO=all multi-do # make
make[4]: Leaving directory '/home/treehrt/gcc10build/x86_64-linux-gnu/libsanitizer'
make[3]: Leaving directory '/home/treehrt/gcc10build/x86_64-linux-gnu/libsanitizer'
make[2]: Leaving directory '/home/treehrt/gcc10build/x86_64-linux-gnu/libsanitizer'
make[1]: Leaving directory '/home/treehrt/gcc10build'

(2-9)

treehrt@Jason-System-Product-Name:~$ cd gcc10build/
treehrt@Jason-System-Product-Name:~/gcc10build$ sudo make install-strip

(2-10)

treehrt@Jason-System-Product-Name:~/gcc10build$ export export PATH=/usr/local/gcc-10.1.0/bin:$PATH
treehrt@Jason-System-Product-Name:~/gcc10build$ export LD_LIBRARY_PATH=/usr/local/gcc-10.1.0/lib64:$LD_LIBRARY_PATH
treehrt@Jason-System-Product-Name:~/gcc10build$ gcc-10.1 -v
使用內建 specs。
COLLECT_GCC=gcc-10.1
COLLECT_LTO_WRAPPER=/usr/local/gcc-10.1.0/libexec/gcc/x86_64-linux-gnu/10.1.0/lto-wrapper
目的:x86_64-linux-gnu
配置為:../gcc-10.1.0/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-10.1.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-10.1
執行緒模型:posix
支援的 LTO 壓縮演算法:zlib
gcc version 10.1.0 (GCC)

 (2-11)

$ vi t1.c
$ cat t1.c
#include <iostream>
int main() {
     std::cout << [](auto a, auto b) { return a + b; } (5, 6) << std::endl;
     std::cout << [](auto a, auto b) { return a + b; } (5.23, 6.45) << std::endl;
     return 0;
}

$ g++-10.1 -Wall -pedantic t1.c -o t1

$ ./t1
11
11.68


select id,article_id,topic,text from lt_articles_text where article_id =596; ok. update lt_articles set num_reads=num_reads +1 where id=596; ok.