溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

go語言編譯環(huán)境gccgo的搭建過程

發(fā)布時(shí)間:2020-04-15 12:44:44 來源:網(wǎng)絡(luò) 閱讀:1947 作者:dannypu 欄目:編程語言

gcc新版本編譯gccgo
前提條件:
GNU Multiple Precision Library (GMP) version 4.3.2 (or later)
Necessary to build GCC. If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC. Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include. 
MPFR Library version 2.4.2 (or later)
Necessary to build GCC. It can be downloaded from http://www.mpfr.org/. If an MPFR source distribution is found in a subdirectory of your GCC sources named mpfr, it will be built together with GCC. Alternatively, if MPFR is already installed but it is not in your default library search path, the --with-mpfr configure option should be used. See also --with-mpfr-lib and --with-mpfr-include. 
MPC Library version 0.8.1 (or later)
Necessary to build GCC. It can be downloaded from http://www.multiprecision.org/. If an MPC source distribution is found in a subdirectory of your GCC sources named mpc, it will be built together with GCC. Alternatively, if MPC is already installed but it is not in your default library search path, the --with-mpc configure option should be used. See also --with-mpc-lib and --with-mpc-include. 


一個(gè)一個(gè)順序安裝后,
a) 安裝gmp
make 
make check 
make install 
b)  安裝MPFR
c)  安裝mpc  
需要提前在linux中或者windows中安裝svn軟件。
linux中安裝subversion windows中安裝TortoiseSVN


安裝命令(一行一個(gè)命令):
svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo
mkdir objdir
cd objdir
../gccgo/configure --enable-languages=c,c++,go


make
make install


make時(shí)的錯(cuò)誤:
/webapp/project/objdir/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile


解決辦法:從stackoverflow中查到的
This issue is caused by dyanmic link library path issue when the test programs try to link against libmpc/libmpfr/libgmp.
Append below environment variable to allow ld link against the correct so file:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/
Then try build gcc again.


耗時(shí)一個(gè)工作日,編譯完成。

如此便可在內(nèi)核版本很低,gcc版本為gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-55)的情況下,通過編譯安裝新版本的gcc version 5.0.0 20150116 (experimental) (GCC) ,直接編譯go語言的源代碼文件。編譯命令類似c/c++的編譯。如果有文件依賴關(guān)系,需要import non-standard package,使用如下命令即可:
go build -compiler gccgo main.go

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI