欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
GCC
第8行: | 第8行: | ||
gcc --version | gcc --version | ||
− | |||
− | |||
http://www.linuxfromscratch.org/lfs/view/stable/chapter03/packages.html | http://www.linuxfromscratch.org/lfs/view/stable/chapter03/packages.html | ||
All Packages | All Packages | ||
− | |||
− | |||
install gcc 3.4.3 | install gcc 3.4.3 | ||
第22行: | 第18行: | ||
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory: | The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory: | ||
− | |||
− | |||
tar -xvf *.tar | tar -xvf *.tar | ||
tar -zxvf *.tar.gz | tar -zxvf *.tar.gz | ||
− | |||
− | |||
tar -xjvf gcc-3.4.3.tar.bz2 | tar -xjvf gcc-3.4.3.tar.bz2 | ||
− | |||
− | |||
cd gcc-3.4.3 | cd gcc-3.4.3 | ||
第40行: | 第30行: | ||
cd ../gcc-build | cd ../gcc-build | ||
− | |||
− | |||
../gcc-3.4.3/configure --prefix=/tools \ | ../gcc-3.4.3/configure --prefix=/tools \ | ||
第48行: | 第36行: | ||
--disable-nls --enable-shared --enable-languages=c | --disable-nls --enable-shared --enable-languages=c | ||
− | |||
− | |||
or | or | ||
../gcc-3.4.3/configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-languages=c --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux | ../gcc-3.4.3/configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-languages=c --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux | ||
− | |||
− | |||
− | |||
− | |||
make bootstrap // make long time | make bootstrap // make long time | ||
− | |||
− | |||
make install | make install | ||
− | |||
− | |||
ln -vs gcc /tools/bin/cc | ln -vs gcc /tools/bin/cc | ||
− | |||
− | |||
[root@RHELAS3 gcc-build]# /tools/bin/cc --version | [root@RHELAS3 gcc-build]# /tools/bin/cc --version | ||
第80行: | 第56行: | ||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
− | |||
− | |||
[huihoo@RHELAS3 5]$ /tools/bin/cc helloworld.cpp -o helloworld | [huihoo@RHELAS3 5]$ /tools/bin/cc helloworld.cpp -o helloworld | ||
cc: helloworld.cpp: C++ compiler not installed on this system | cc: helloworld.cpp: C++ compiler not installed on this system | ||
− | |||
− | |||
run testsuite | run testsuite | ||
− | |||
− | |||
[huihoo@RHELAS3 testsuite]$ gcc -v | [huihoo@RHELAS3 testsuite]$ gcc -v | ||
第102行: | 第72行: | ||
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53) | gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53) | ||
− | |||
− | |||
libstdc++ install | libstdc++ install | ||
− | |||
− | |||
http://gcc.gnu.org/libstdc++/ | http://gcc.gnu.org/libstdc++/ | ||
http://mirrors.kernel.org/gnu/ | http://mirrors.kernel.org/gnu/ | ||
− | |||
− | |||
Porting libstdc++-v3 | Porting libstdc++-v3 | ||
http://gcc.gnu.org/onlinedocs/porting/ | http://gcc.gnu.org/onlinedocs/porting/ | ||
− | |||
− | |||
[huihoo@RHELAS3 libstdc++-v3]$ ./configure | [huihoo@RHELAS3 libstdc++-v3]$ ./configure | ||
configure: error: cannot find install-sh or install.sh in ./../.. | configure: error: cannot find install-sh or install.sh in ./../.. | ||
− | |||
− | |||
− | |||
./configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-cstdio --enable-clocale --enable-libstdcxx-allocator --enable-threads --enable-threads=posix --enable-libstdcxx-debug --enable-c99 --enable-long-long --enable-fully-dynamic-string --enable-concept-checks --enable-libstdcxx-pch --disable-hosted-libstdcxx | ./configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-cstdio --enable-clocale --enable-libstdcxx-allocator --enable-threads --enable-threads=posix --enable-libstdcxx-debug --enable-c99 --enable-long-long --enable-fully-dynamic-string --enable-concept-checks --enable-libstdcxx-pch --disable-hosted-libstdcxx | ||
− | |||
− | |||
RHEL3 | RHEL3 | ||
第142行: | 第99行: | ||
/usr/lib/libstdc++.so.6.0.3 | /usr/lib/libstdc++.so.6.0.3 | ||
− | == 在linux 下 make hello.c == | + | ==在linux 下 make hello.c== |
mkdir hello | mkdir hello | ||
cd hello | cd hello | ||
− | |||
− | |||
建立三个文件 | 建立三个文件 | ||
第157行: | 第112行: | ||
Makefile.am | Makefile.am | ||
− | |||
− | |||
hello.c | hello.c | ||
− | |||
− | |||
#include <stdio.h> | #include <stdio.h> | ||
− | |||
− | |||
− | |||
int | int | ||
− | |||
main(int argc,char *argv[]) | main(int argc,char *argv[]) | ||
{ | { | ||
− | |||
printf("hello world\n"); | printf("hello world\n"); | ||
− | |||
return 0; | return 0; | ||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
在configure.in里加入 | 在configure.in里加入 | ||
第193行: | 第133行: | ||
AC_OUTPUT(Makefile) | AC_OUTPUT(Makefile) | ||
− | |||
− | |||
在Makefile.am里加入 | 在Makefile.am里加入 | ||
第203行: | 第141行: | ||
hello_SOURCES=hello.c | hello_SOURCES=hello.c | ||
− | |||
− | |||
and touch new files: NEWS, README,AUTHORS, ChangeLog | and touch new files: NEWS, README,AUTHORS, ChangeLog | ||
− | |||
− | |||
然后执行 | 然后执行 | ||
第223行: | 第157行: | ||
$ ./hello | $ ./hello | ||
− | |||
− | |||
It's OK :) | It's OK :) | ||
− | |||
− | |||
$ make clean | $ make clean | ||
− | |||
− | |||
# make install // 将hello安装到 /usr/local/bin | # make install // 将hello安装到 /usr/local/bin | ||
/usr/local/bin/hello | /usr/local/bin/hello | ||
− | |||
− | |||
$ make dist | $ make dist | ||
第244行: | 第170行: | ||
create package file: hello-0.1.tar.gz | create package file: hello-0.1.tar.gz | ||
+ | $ make distcheck // 生成发布软件包并对其进行测试检查,以确定发布包的正确性。 | ||
+ | 提示: hello-0.1.tar.gz is ready for distribution | ||
− | + | ==相关链接== | |
+ | *http://gcc.gnu.org/onlinedocs/ | ||
− | + | *http://ftp.gnu.mirrors.hoobly.com/pub/ | |
+ | |||
+ | *http://gcc.gnu.org/lists.html // mail lists |
2006年7月14日 (五) 15:36的版本
安装 GCC
在 Redhat 下通过 RPM包安装 GCC
install gcc rpm
rpm -Uvh gcc-3.2.3-34.i386.rpm glibc-devel-2.3.2-95.20.i386.rpm libgcc-3.2.3-34.i386.rpm cpp-3.2.3-34.i386.rpm glibc-headers-2.3.2-95.20.i386.rpm glibc-kernheaders-2.4-8.34.i386.rpm
gcc --version
http://www.linuxfromscratch.org/lfs/view/stable/chapter03/packages.html
All Packages
install gcc 3.4.3
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
tar -xvf *.tar
tar -zxvf *.tar.gz
tar -xjvf gcc-3.4.3.tar.bz2
cd gcc-3.4.3
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-3.4.3/configure --prefix=/tools \
--libexecdir=/tools/lib --with-local-prefix=/tools \
--disable-nls --enable-shared --enable-languages=c
or
../gcc-3.4.3/configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-languages=c --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
make bootstrap // make long time
make install
ln -vs gcc /tools/bin/cc
[root@RHELAS3 gcc-build]# /tools/bin/cc --version
cc (GCC) 3.4.3
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[huihoo@RHELAS3 5]$ /tools/bin/cc helloworld.cpp -o helloworld
cc: helloworld.cpp: C++ compiler not installed on this system
run testsuite
[huihoo@RHELAS3 testsuite]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53)
libstdc++ install
http://mirrors.kernel.org/gnu/
Porting libstdc++-v3
http://gcc.gnu.org/onlinedocs/porting/
[huihoo@RHELAS3 libstdc++-v3]$ ./configure
configure: error: cannot find install-sh or install.sh in ./../..
./configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --enable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-cstdio --enable-clocale --enable-libstdcxx-allocator --enable-threads --enable-threads=posix --enable-libstdcxx-debug --enable-c99 --enable-long-long --enable-fully-dynamic-string --enable-concept-checks --enable-libstdcxx-pch --disable-hosted-libstdcxx
RHEL3
/usr/lib/gcc/i386-redhat-linux/3.4.3/libstdc++.so
/usr/lib/gcc/i386-redhat-linux/3.4.3/libstdc++.a
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.3
在linux 下 make hello.c
mkdir hello
cd hello
建立三个文件
hello.c
configure.in // autoscan创建configure.scan,然后改名为configure.in,这里省略了这个步骤
Makefile.am
hello.c
- include <stdio.h>
int main(int argc,char *argv[])
{
printf("hello world\n"); return 0;
}
在configure.in里加入
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello,0.1)
AC_PROG_CC
AC_OUTPUT(Makefile)
在Makefile.am里加入
UTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
and touch new files: NEWS, README,AUTHORS, ChangeLog
然后执行
$ aclocal
$ autoconf
$ automake --add-missing
$ ./configure
$ make
$ ./hello
It's OK :)
$ make clean
- make install // 将hello安装到 /usr/local/bin
/usr/local/bin/hello
$ make dist
create package file: hello-0.1.tar.gz
$ make distcheck // 生成发布软件包并对其进行测试检查,以确定发布包的正确性。
提示: hello-0.1.tar.gz is ready for distribution
相关链接
- http://gcc.gnu.org/lists.html // mail lists