搜集的几种安装C++4.8的方法

来源:互联网 发布:微电影拍摄知乎 编辑:程序博客网 时间:2024/05/17 07:36

How to install gcc-4.8 in Ubuntu 12.04 from the terminal

up vote8down votefavorite
2

I checked the gcc version on my system.

It is currently at 4.6.3. I read that gcc-4.8 is out.

I tried the following commands without success:

sudo apt-get install gcc (gcc is already the newest version)sudo apt-get install gcc-4.8 (unable to locate package)

Does anyone know how to install this package on 12.04?

shareimprove this question
 
@maggotbrain's answer worked for me, though I had to add: sudo apt-get install gcc-multilib as I was running into this issue: superuser.com/questions/432202/make-fails-compiling-gcc – skillman May 6 at 15:56

4 Answers

ACTIVEOLDESTVOTES
up vote13down voteaccepted

Is GCC-4.8 available for 12.04 Precise now?

The short answer is: gcc-4.8 is currently available for 12.04(Precise) only by compiling the source(see below for details).

Update: As of 4/13/2013, there is currently a dev release of gcc 4.8 for 12.04(precise) available athttps://launchpad.net/~ubuntu-toolchain-r/+archive/test.

One can install .deb files from here.

Release Announcement

The announcement for the release of gcc-4.8 was made on March 22nd, so you probably won't be seeing this in an official repository just yet.

However, it appears that Launchpad does have a PPA available for the toolchain test builds that does include gcc-4.8, here: https://launchpad.net/~ubuntu-toolchain-r/+archive/test

According to the changelog and package list, there are debs for i386, amd64, arm, and powerpc and were built against raring 13.04. This package is not available for 12.04 Precise users at this time.

The latest available version of gcc, for 12.04, is 4.7.2-11 and is available in the toolchain PPA.

Adding the toolchain/test PPA:

To add the PPA to your system, open a terminal(Ctrl+Alt+t) and run the following commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/testsudo apt-get updatesudo apt-get install gcc-4.7-base
  • What are PPAs and how do I use them?
  • Are PPA's safe to add to my system and what are some "red flags" to watch out for?

What C++ features are available in gcc-4.8 that are not available in gcc-4.7.2?

  • According to GNU.ORG, gcc-4.7, supports a number of C++11 features.
  • As of the gcc-4.8 release, gcc-4.7 does not support 8 out of 64 features (See C++0x/C++11 Support in GCC)

  • These features are:

    Language Features- Rvalue references for *this- Generalized attributes- Alignment support- Inheriting constructorsConcurreny- Bidirectional Fences- Memory model- Abandoning a process and at_quick_exit- Thread-local storage 
  • For a full list of changes in gcc-4.8, see the Changelist

I need these gcc features on 12.04 Precise, now. How can I get them?

Building GCC-4.8 from source:

If you need gcc-4.8 on 12.04 now, your only option is to build it from source.

Please read the GCC installation FAQ prior to installation.

You can download gcc-4.8 from one of gnu.org's mirror sites or directly from their SVN server.

Here is an example of steps to compile from source (see here for additional details.) Note that these may vary depending on your system and preferences.

  1. Download the source code

    • Make a build directory ( mkdir gcc-build && cd gcc-build)
    • Download the source file: wget http://www.netgull.com/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2 (adjust this command to use an appropriate mirror site.
    • Unzip the file (tar -xvjf <file name>)
  2. Install some additional libraries (sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev)

  3. Compile the source: ./gcc-4.8.0/configure --prefix=/app/gcc/4.8.0
  4. Run make (This will take some time to complete. Go make some coffee, or bake some cookies. ;-))
  5. Install the code: sudo make install

Once this process has completed, run the command gcc --version to verify that the installation has completed successfully. You should see something similar to the following output:

maggotbrain@foucault:~$ gcc --versiongcc (Linaro 4.8.0) 4.8.0Copyright (C) 2013 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

At this time, there does not appear to be a published schedule as to when this backport will be available on 12.04. Although there is some additional discussion regarding gcc-4.8 here:https://bugs.launchpad.net/ubuntu/+source/gcc-4.7/+bug/1159547

The bottom line: Thank all those folks who provide easy to install Ubuntu backports for you. Give them some of the cookies that you baked while running make. ;-)

shareimprove this answer
 
Excellent answer, except: E: Unable to locate package gcc-4.8 – John Dibling Apr 4 at 11:14
up vote0down vote

So answer above works, at least for manual install. Though even after sudo make install, runninggcc still just runs the stock version 4.6.3. Even trying gcc-4.8 or gcc-4.8.0 doesn't work. Running/app/gcc/4.8.0/bin/gcc appears to be the only thing that works for me. I mean it is kind of lame but at least it works.

shareimprove this answer
  
up vote0down vote

maybe symlinks are not updated after installation. You can run

ln -s /app/gcc/4.8.0/bin/gcc /usr/bin/gcc

and now gcc command will run 4.8 version.

shareimprove this answer
  
up vote-1down vote

It should be built-in with Ubuntu 12.04. however, you can try this:

sudo apt-get update                    sudo apt-get install gcc-4.8


2013 年 03 月 26 日

Linux 编译安装 GCC 4.8

Filed under: Article,Blablabla... —  — OWenT @ 上午 10:01

GCC4.8发布啦,这个脚本在之前4.7的基础上做了点改进,移除一些过时的组件,增加了检测不到时自动下载源码包
PS:4.8的新功能对于4.7貌似不是太多,生成属性、align模板、继承构造、线程内存池,还有什么来着?

编译安装 GCC 4.8.X
准备环境及依赖项
  1. 支持 ISO C++ 98 的编译器(GCC 4.7.2 的中期一个patch导致的整个项目开始转为由C++编译)
  2. 用于创建Ada编译器的GNAT
  3. 支持POSIX的shell或GNU bash
  4. POSIX或SVR4的 awk工具
  5. GNU binutils
  6. gzip 版本1.2.4及以上     (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  7. bzip2 版本 1.0.2及以上    (此处可下载 http://www.bzip.org/)
  8. GNU make 工具 版本3.80及以上 (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  9. GNU tar工具 版本1.14及以上   (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  10. perl 版本5.6.1及以上      (此处可下载 http://www.perl.org/)
  11. jar或zip和unzip工具 (此处可下载 http://www.info-zip.org)
  12. gmp库 版本5.0.2及以上 (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  13. mpfr库 版本2.4.2及以上 (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  14. mpc库 版本0.8.1及以上 (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org 下载 )
  15. isl 版本 0.11.1 (可由GNU镜像列表 http://www.gnu.org/prep/ftp.html 或自动选择最佳镜像 http://ftpmirror.gnu.org  中gcc目录中的infrastructure目录下载 )
  16. cloog 版本0.18.0(此处可下载 ftp://gcc.gnu.org/pub/gcc/infrastructure/ )
 
我编译的环境
系统:
CentOS 6.2 & CentOS 6.4 & Suse 的不知道哪个很老的版本
系统库:
gzip 1.3.12
zip/unzip 3.0
GNU make 3.81
tar 1.23
perl 5.10.1
bzip2 1.0.5
gcc 4.4.7 or gcc 4.1.2 or gcc 4.4.5
编译的依赖库:
gmp 5.1.1
mpfr 3.1.2
mpc 1.0.1
isl 0.11.1
cloog 0.18.0

编译目标:

gcc 4.8.0
binutils 2.32.2 (如果存在ppl库)
gdb 7.5.1 (如果存在ppl库和ncurses ncurses-libs ncurses-devel包)

 

编译使用的脚本如下(所有的库都会被安装在$PREFEX_DIR里)

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/sh
 
# ======================================= 配置 =======================================
PREFIX_DIR=/usr/local/gcc-4.8.0
 
# ======================= 非交叉编译 =======================
BUILD_TARGET_CONF_OPTION=""
BUILD_OTHER_CONF_OPTION=""
 
# ======================= 交叉编译配置示例 =======================
# BUILD_TARGET_CONF_OPTION="--target=arm-linux --enable-multilib --enable-interwork --disable-shared"
# BUILD_OTHER_CONF_OPTION="--disable-shared"
  
# ======================================= 检测 =======================================
 
# ======================= 检测完后等待时间 =======================
CHECK_INFO_SLEEP=3
 
# ======================= 安装目录初始化 =======================
if[ $# -gt 0 ]; then
    PREFIX_DIR=$1
fi
 
mkdir-p "$PREFIX_DIR"
PREFIX_DIR="$( cd "$PREFIX_DIR" && pwd )";
 
# ======================= 转到脚本目录 =======================
WORKING_DIR="$PWD";
 
# ======================= 如果是64位系统且没安装32位的开发包,则编译要gcc加上 --disable-multilib 参数, 不生成32位库 =======================
SYS_LONG_BIT=$(getconf LONG_BIT)
GCC_OPT_DISABLE_MULTILIB=""
if[ $SYS_LONG_BIT == "64"]; then
    GCC_OPT_DISABLE_MULTILIB="--disable-multilib"
    GCC_OPT_DISABLE_MULTILIB_DEV_LIBS=($(whereislibrt))
    if[ ${#GCC_OPT_DISABLE_MULTILIB_DEV_LIBS[@]} -lt 2 ]; then
        echo-e "\\033[31;1mglibc-devel is required.\\033[39;49;0m"
        exit-1
    fi
    forFILE_PATH in${GCC_OPT_DISABLE_MULTILIB_DEV_LIBS[@]}; do
        if[ ${FILE_PATH:0:9} == "/usr/lib/"]; then
            echo-e "\\033[32;1mnotice: librt x86_64 found multilib enabled.\\033[39;49;0m"
            GCC_OPT_DISABLE_MULTILIB=""
        fi
    done
    GCC_OPT_DISABLE_MULTILIB_DEV_LIBS=""
    if[ "$GCC_OPT_DISABLE_MULTILIB"== "--disable-multilib"]; then
        echo-e "\\033[32;1mwarning: --disable-multilib is added when build gcc.\\033[39;49;0m"
        letCHECK_INFO_SLEEP=$CHECK_INFO_SLEEP+1
    fi
fi
 
# ======================= 如果强制开启,则开启 =======================
if[ ! -z "$GCC_OPT_DISABLE_MULTILIB"]; then
    foropt in$BUILD_TARGET_CONF_OPTION ; do
        if[ "$opt"== "--enable-multilib"]; then
            echo-e "\\033[32;1mwarning: librt not found in [*]/lib64 but --enable-multilib enabled in GCC_OPT_DISABLE_MULTILIB.\\033[39;49;0m"
            GCC_OPT_DISABLE_MULTILIB="";
            break;
        fi
        echo$f;
    done
fi
 
# ======================= 检测CPU数量,编译线程数不能大于CPU数量的2倍,否则可能出问题 =======================
BUILD_THREAD_OPT=8;
BUILD_CPU_NUMBER=$(cat/proc/cpuinfo | grep-c "^processor[[:space:]]*:[[:space:]]*[0-9]*");
letBUILD_THREAD_OPT=$BUILD_CPU_NUMBER*2;
if[ $BUILD_THREAD_OPT -gt 8 ]; then
    BUILD_THREAD_OPT=8;
fi
BUILD_THREAD_OPT="-j$BUILD_THREAD_OPT";
echo-e "\\033[32;1mnotice: $BUILD_CPU_NUMBER cpu(s) detected. use $BUILD_THREAD_OPT for multi-thread compile."
 
# ======================= 统一的包检查和下载函数 =======================
functioncheck_and_download(){
    PKG_NAME="$1";
    PKG_MATCH_EXPR="$2";
    PKG_URL="$3";
     
    PKG_VAR_VAL=$(ls-d $PKG_MATCH_EXPR);
    if[ ! -z "$PKG_VAR_VAL"]; then
        echo"$PKG_VAR_VAL"
        return0;
    fi
     
    if[ -z "$PKG_URL"]; then
        echo-e "\\033[31;1m$PKG_NAME not found.\\033[39;49;0m" 
        exit-1;
    fi
     
    wget -c "$PKG_URL";
    PKG_VAR_VAL=$(ls-d $PKG_MATCH_EXPR);
     
    if[ -z "$PKG_VAR_VAL"]; then
        echo-e "\\033[31;1m$PKG_NAME not found.\\033[39;49;0m" 
        exit-1;
    fi
     
    echo"$PKG_VAR_VAL";
}
 
# ======================================= 搞起 =======================================
echo-e "\\033[31;1mcheck complete.\\033[39;49;0m"
 
# ======================= 准备环境, 把库和二进制目录导入,否则编译会找不到库或文件 =======================
exportLD_LIBRARY_PATH=$PREFIX_DIR/lib:$PREFIX_DIR/lib64:$LD_LIBRARY_PATH
exportPATH=$PREFIX_DIR/bin:$PATH
 
echo-e "\\033[32;1mnotice: reset env LD_LIBRARY_PATH=$LD_LIBRARY_PATH\\033[39;49;0m";
echo-e "\\033[32;1mnotice: reset env PATH=$PATH\\033[39;49;0m";
 
echo"WORKING_DIR = $WORKING_DIR"
echo"PREFIX_DIR = $PREFIX_DIR"
echo"BUILD_TARGET_CONF_OPTION = $BUILD_TARGET_CONF_OPTION"
echo"BUILD_OTHER_CONF_OPTION = $BUILD_OTHER_CONF_OPTION"
echo"CHECK_INFO_SLEEP = $CHECK_INFO_SLEEP"
echo"BUILD_CPU_NUMBER = $BUILD_CPU_NUMBER"
echo"BUILD_THREAD_OPT = $BUILD_THREAD_OPT"
echo"GCC_OPT_DISABLE_MULTILIB = $GCC_OPT_DISABLE_MULTILIB"
echo"SYS_LONG_BIT = $SYS_LONG_BIT"
 
echo-e "\\033[32;1mnotice: now, sleep for $CHECK_INFO_SLEEP seconds.\\033[39;49;0m";
sleep$CHECK_INFO_SLEEP
  
# ======================= 关闭交换分区,否则就爽死了 =======================
swapoff -a
 
# install gmp
GMP_PKG=$(check_and_download"gmp""gmp-*.tar.bz2" "ftp://ftp.gmplib.org/pub/gmp/gmp-5.1.1.tar.bz2" );
if[ $? -ne0 ]; then
    echo-e "$GMP_PKG"
    exit-1;
fi
tar-jxvf $GMP_PKG
GMP_DIR=$(ls-d gmp-* | grep-v\.tar\.bz2)
cd$GMP_DIR
CPPFLAGS=-fexceptions ./configure--prefix=$PREFIX_DIR --enable-cxx --enable-assert $BUILD_OTHER_CONF_OPTION
make$BUILD_THREAD_OPT && makecheck && makeinstall
cd"$WORKING_DIR"
   
# install mpfr
MPFR_PKG=$(check_and_download"mpfr""mpfr-*.tar.bz2" "http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.bz2" );
if[ $? -ne0 ]; then
    echo-e "$MPFR_PKG"
    exit-1;
fi
tar-jxvf $MPFR_PKG
MPFR_DIR=$(ls-d mpfr-* | grep-v\.tar\.bz2)
cd$MPFR_DIR
./configure--prefix=$PREFIX_DIR --with-gmp=$PREFIX_DIR --enable-assert $BUILD_OTHER_CONF_OPTION
make$BUILD_THREAD_OPT && makeinstall
cd"$WORKING_DIR"
   
# install mpc
MPC_PKG=$(check_and_download"mpc""mpc-*.tar.gz" "http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz" );
if[ $? -ne0 ]; then
    echo-e "$MPC_PKG"
    exit-1;
fi
tar-zxvf $MPC_PKG
MPC_DIR=$(ls-d mpc-* | grep-v\.tar\.gz)
cd$MPC_DIR
./configure--prefix=$PREFIX_DIR --with-gmp=$PREFIX_DIR --with-mpfr=$PREFIX_DIR $BUILD_OTHER_CONF_OPTION
make$BUILD_THREAD_OPT && makeinstall
cd"$WORKING_DIR"
  
# install isl
ISL_PKG=$(check_and_download"isl-0.11""isl-*.tar.bz2" "ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.11.1.tar.bz2" );
if[ $? -ne0 ]; then
    echo-e "$ISL_PKG"
    exit-1;
fi
tar-jxvf $ISL_PKG
ISL_DIR=$(ls-d isl-* | grep-v\.tar\.bz2)
cd$ISL_DIR
./configure--prefix=$PREFIX_DIR --with-gmp-prefix=$PREFIX_DIR $BUILD_OTHER_CONF_OPTION
make$BUILD_THREAD_OPT && makeinstall
cd"$WORKING_DIR"
  
# install cloog
CLOOG_PKG=$(check_and_download"cloog-0.18""cloog-0.*.tar.gz" "ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.0.tar.gz" );
if[ $? -ne0 ]; then
    echo-e "$CLOOG_PKG"
    exit-1;
fi
tar-zxvf $CLOOG_PKG
CLOOG_DIR=$(ls-d cloog-0.* | grep-v\.tar\.gz)
cd$CLOOG_DIR
./configure--prefix=$PREFIX_DIR --with-gmp=system --with-gmp-prefix=$PREFIX_DIR --with-bits=gmp --with-isl=$PREFIX_DIR $BUILD_OTHER_CONF_OPTION
make$BUILD_THREAD_OPT && makecheck && makeinstall
cd"$WORKING_DIR"
   
# ======================= install gcc =======================
# ======================= 解决检测ISL有时候会失效的问题 =======================
cd$ISL_DIR
makeinstall
cd"$WORKING_DIR"
 
# ======================= gcc包 =======================
GCC_PKG=$(check_and_download"gcc""gcc-*.tar.bz2" "ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2" );
if[ $? -ne0 ]; then
    echo-e "$GCC_PKG"
    exit-1;
fi
tar-jxvf $GCC_PKG
GCC_DIR=$(ls-d gcc-* | grep-v\.tar\.bz2)
mkdirobjdir
cdobjdir
# ======================= 这一行的最后一个参数请注意,如果要支持其他语言要安装依赖库并打开对该语言的支持 =======================
GCC_CONF_OPTION_ALL="--prefix=$PREFIX_DIR --with-gmp=$PREFIX_DIR --with-mpc=$PREFIX_DIR --with-mpfr=$PREFIX_DIR --with-isl=$PREFIX_DIR --with-cloog=$PREFIX_DIR --enable-bootstrap --enable-build-with-cxx --enable-cloog-backend=isl --disable-libjava-multilib --enable-checking=release $GCC_OPT_DISABLE_MULTILIB $BUILD_TARGET_CONF_OPTION";
../$GCC_DIR/configure$GCC_CONF_OPTION_ALL
make$BUILD_THREAD_OPT && makeinstall
cd"$WORKING_DIR"
 
ls$PREFIX_DIR/bin/*gcc
if[ $? -ne0 ]; then
    echo-e "\\033[31;1mError: build gcc failed.\\033[39;49;0m";
    exit-1;
fi
 
# ======================= 建立cc软链接 =======================
ln-s $PREFIX_DIR/bin/gcc$PREFIX_DIR/bin/cc
 
CHECK_PPL_PATH="$(whereis libppl.so.* | awk '{print $2;}')";
# ##### [以下两个组件依赖PPL库, 由于新版GCC已经去除对PPL的依赖,并且下面两个不是必须项,所以如果没有就跳过] #####
if[ -z "$CHECK_PPL_PATH"]; then
    echo-e "\\033[32;1mwarning: ppl not found, skip build [binutils] and [gdb].\\033[39;49;0m"
else
    # ======================= install binutils(链接器,汇编器 等) =======================
    BINUTILS_PKG=$(check_and_download"binutils""binutils-*.tar.bz2" "http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2" );
    if[ $? -ne0 ]; then
        echo-e "$BINUTILS_PKG"
        exit-1;
    fi
    tar-jxvf $BINUTILS_PKG
    BINUTILS_DIR=$(ls-d binutils-* | grep-v\.tar\.bz2)
    cd$BINUTILS_DIR
    ./configure--prefix=$PREFIX_DIR --with-gmp=$PREFIX_DIR --with-mpc=$PREFIX_DIR --with-mpfr=$PREFIX_DIR --enable-build-with-cxx $BUILD_TARGET_CONF_OPTION
    make$BUILD_THREAD_OPT && makecheck && makeinstall
    cd"$WORKING_DIR"
 
    # ======================= install gdb(调试器) [依赖PPL库, libtermcap库] =======================
    CHECK_TERMCAP_PATH="$(whereis libtermcap | awk '{print $2;}')";
    if[ -z "$CHECK_TERMCAP_PATH"]; then
        echo-e "\\033[32;1mwarning: libtermcap not found, skip build [gdb].\\033[39;49;0m"
    else
        GDB_PKG=$(check_and_download"gdb""gdb-*.tar.bz2" "http://ftp.gnu.org/gnu/gdb/gdb-7.5.1.tar.bz2" );
        if[ $? -ne0 ]; then
            echo-e "$GDB_PKG"
            exit-1;
        fi
        tar-jxvf $GDB_PKG
        GDB_DIR=$(ls-d gdb-* | grep-v\.tar\.bz2)
        cd$GDB_DIR
        ./configure--prefix=$PREFIX_DIR --with-gmp=$PREFIX_DIR --with-mpc=$PREFIX_DIR --with-mpfr=$PREFIX_DIR --enable-build-with-cxx $BUILD_TARGET_CONF_OPTION
        make$BUILD_THREAD_OPT && makeinstall
        cd"$WORKING_DIR"
    fi
fi
 
 
# 应该就编译完啦
# 64位系统内,如果编译java支持的话可能在gmp上会有问题,可以用这个选项关闭java支持 --enable-languages=c,c++,objc,obj-c++,fortran,ada
# 再把$PREFIX_DIR/bin放到PATH
# $PREFIX_DIR/lib (如果是64位机器还有$PREFIX_DIR/lib64)[另外还有$PREFIX_DIR/libexec我也不知道要不要加,反正我加了]放到LD_LIBRARY_PATH或者/etc/ld.so.conf里
# 再执行ldconfig就可以用新的gcc啦 
 
echo-e "\\033[33;1mAddition, run the cmds below to add environment var(s).\\033[39;49;0m"
echo-e "\\033[31;1mexport PATH=$PREFIX_DIR/bin:$PATH\\033[39;49;0m"
echo-e "\\033[31;1mexport LD_LIBRARY_PATH=$PREFIX_DIR/lib:$PREFIX_DIR/libexec:$LD_LIBRARY_PATH\\033[39;49;0m"
echo-e "\\033[31;1mexport LD_LIBRARY_PATH=$PREFIX_DIR/lib64:$LD_LIBRARY_PATH # run this if in a x86_64 arch.\\033[39;49;0m"
echo-e "\tor you can add $PREFIX_DIR/lib, $PREFIX_DIR/lib64 (if in x86_64) and $PREFIX_DIR/libexec to file [/etc/ld.so.conf] and then run [ldconfig]"
echo-e "\\033[33;1mBuild Gnu Compile Collection done.\\033[39;49;0m"
History:
2013-03-26Created2013-04-11改进脚本,增加统一编译选项,增加对binutils和gdb可选包的编译,增加自动把PREFIX_DIR变为绝对路径的问题,统一目录组织,修复环境变量的一些小问题
    分享到:
The short URL of the present article is: http://www.owent.net/5aPWu

原创粉丝点击