樹心幽徑

« 20190116更新Fedora22(w3)的Linux核心(因採non-retpoline compiler未成) | Main | 20190117在fedora裝gcc7.4成功 »

20190116在ubuntu 1604裝gcc7及gcc8成功
2019/01/16,19:33

REF:https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5

(1)$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

[sudo] password for treehrt:

Toolchain test builds; see https://wiki.ubuntu.com/ToolChain

 

更多資訊:https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

請輸入 [ENTER] 繼續,或 Ctrl-C 來取消加入動作

 

gpg: `/tmp/tmp7q8_no83/secring.gpg' 鑰匙圈已建立

gpg: `/tmp/tmp7q8_no83/pubring.gpg' 鑰匙圈已建立

gpg: 正在請求金鑰 BA9EF27F hkp 伺服器 keyserver.ubuntu.com

gpg: /tmp/tmp7q8_no83/trustdb.gpg: 建立了信任資料庫

gpg: 金鑰 BA9EF27F: 公鑰 "Launchpad Toolchain builds" 已匯入

gpg: 處理總量: 1

gpg: 已匯入: 1 (RSA: 1)

OK

 

(2)$ sudo apt update

略過:1 http://dl.google.com/linux/earth/deb stable InRelease

已有:2 http://dl.google.com/linux/earth/deb stable Release

下載: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 [109 kB]

下載:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]

下載:7 http://tw.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]

下載:8 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease [17.5 kB]

下載:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main i386 DEP-11 Metadata [320 kB]

下載:10 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main i386 Packages [78.6 kB]

下載:11 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [227 kB]

下載:12 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe i386 DEP-11 Metadata [251 kB]

下載:13 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [341 kB]

下載:14 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Translation-en [14.8 kB]

下載:15 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 DEP-11 Metadata [7,152 B]

下載:16 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons [14.3 kB]

下載:17 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main i386 DEP-11 Metadata [3,328 B]

下載:18 http://tw.archive.ubuntu.com/ubuntu xenial-backports/universe i386 DEP-11 Metadata [5,104 B]

正在讀取套件清單... 完成

W: GPG 錯誤: http://dl.google.com/linux/earth/deb stable Release: 由於無法取得它們的公鑰,以下簽章無法進行驗證: NO_PUBKEY 1397BC53640DB551

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 ~$

(3) $ sudo apt install g++-7 -y

:


準備解開 .../g++-7_7.4.0-1ubuntu1~16.04~ppa1_i386.deb ...

解開 g++-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

Processing triggers for man-db (2.7.5-1) ...

Processing triggers for libc-bin (2.23-0ubuntu10) ...

設定 gcc-7-base:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 cpp-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libcc1-0:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libgomp1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libitm1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libatomic1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libasan4:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libubsan0:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libcilkrts5:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libmpx2:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libquadmath0:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libgcc-7-dev:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 gcc-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libstdc++-7-dev:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 g++-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

Processing triggers for libc-bin (2.23-0ubuntu10) ...

 

(4)$ gcc-7 -v

Using built-in specs.
COLLECT_GCC=gcc-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~16.04~ppa1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --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 --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1)

 

 

(5)$ g++-7 -v
Using built-in specs.
COLLECT_GCC=g++-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~16.04~ppa1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --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 --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1)
treehrt ~/gtk$

 

(6) $ g++-7 mapgpx.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o mapgpx2

mapgpx.c: In function ‘void load_gpxB(char*, gpxR*)’:

mapgpx.c:316:6: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 19 and 177 [-Wformat-overflow=]

void load_gpxB(char fname[100],gpxR *gp) {

^~~~~~~~~

mapgpx.c:524:16: note: ‘sprintf’ output between 12 and 1176 bytes into a destination of size 180

sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",

~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gp->pW[i].date,gp->pW[i].time,gp->pW[i].name,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gp->pW[i].x67,gp->pW[i].y67,gp->pW[i].high);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

在舊版gcc沒有以上警告。


(7)用g++-7新編繹的執行檔mapgpx2可順利執行

 

(8)舊版gcc

treehrt ~/gtk$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/5/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --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-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

(9)舊版g++

treehrt ~/gtk$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/5/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --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-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

(10)$ sudo apt-get install gcc-8 g++-8
:下列的額外套件將被安裝:
  cpp-8 libasan5 libgcc-8-dev libstdc++-8-dev libubsan1
建議套件:
  gcc-8-locales g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg
  libquadmath0-dbg libstdc++-8-doc
下列【新】套件將會被安裝:
  cpp-8 g++-8 gcc-8 libasan5 libgcc-8-dev libstdc++-8-dev libubsan1
升級 0 個,新安裝 7 個,移除 0 個,有 470 個未被升級。
需要下載 28.4 MB 的套件檔。
此操作完成之後,會多佔用 111 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
:

設定 cpp-8 (8.1.0-5ubuntu1~16.04) ...
設定 libasan5:i386 (8.1.0-5ubuntu1~16.04) ...
設定 libubsan1:i386 (8.1.0-5ubuntu1~16.04) ...
設定 libgcc-8-dev:i386 (8.1.0-5ubuntu1~16.04) ...
設定 gcc-8 (8.1.0-5ubuntu1~16.04) ...
設定 libstdc++-8-dev:i386 (8.1.0-5ubuntu1~16.04) ...
設定 g++-8 (8.1.0-5ubuntu1~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

(11)$ g++-8 -v
Using built-in specs.
COLLECT_GCC=g++-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.1.0-5ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=i686-linux-gnu- --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 --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04)

(12)$ gcc-8 -v
Using built-in specs.
COLLECT_GCC=gcc-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.1.0-5ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=i686-linux-gnu- --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 --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04)
treehrt ~/gtk$

(13)$ g++-8 mapgpx.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o mapgpx3
In file included from /usr/include/gtk-3.0/gtk/gtk.h:98,
                 from mapgpx.c:18:
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:66:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses]
   void (*__gtk_reserved1);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:67:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved2’ [-Wparentheses]
   void (*__gtk_reserved2);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:68:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved3’ [-Wparentheses]
   void (*__gtk_reserved3);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:69:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved4’ [-Wparentheses]
   void (*__gtk_reserved4);
        ^
In file included from /usr/include/gtk-3.0/gtk/gtk.h:261,
                 from mapgpx.c:18:
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:74:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses]
   void (*__gtk_reserved1);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:75:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved2’ [-Wparentheses]
   void (*__gtk_reserved2);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:76:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved3’ [-Wparentheses]
   void (*__gtk_reserved3);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:77:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved4’ [-Wparentheses]
   void (*__gtk_reserved4);
        ^
mapgpx.c: In function ‘void load_gpxB(char*, gpxR*)’:
mapgpx.c:524:23: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 19 and 177 [-Wformat-overflow=]
         sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c:524:16: note: ‘sprintf’ output between 12 and 1176 bytes into a destination of size 180
         sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         gp->pW[i].date,gp->pW[i].time,gp->pW[i].name,
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         gp->pW[i].x67,gp->pW[i].y67,gp->pW[i].high);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_wptgpx(gpxR*, P2D*, char (*)[80], int)’:
mapgpx.c:1099:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.gpx",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1099:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.gpx",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_gpx2(gpxR*, gpxR*)’:
mapgpx.c:1167:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.gpx",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1167:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.gpx",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_gpx()’:
mapgpx.c:1295:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.jpg",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1295:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.jpg",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

(14)用g++-8 新編繹的執行檔mapgpx3可順利執行

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType