build gcc 4.3 on debian lenny to allow utf-8 with bom source files.

As far as I knnow, gcc accpets utf-8 with bom files from v 4.4.

On some machines, people use a stable linux distr such as debian lenny which only has gcc 4.3.

Yes, we can build a whole new gcc to work on lenny. However the products built by this new gcc won’t work on others.

An idea is build gcc with bom support. there is a patch file for this at http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01371.html .

So the work can be done by these steps:

bom

[code]

##download the patch to ~/bom.patch
apt-get source gcc-4.3
cd gcc-4.3-4.3.2
debian/rules unpack
cd src/libcpp
patch -p1 < ~/bom.patch
cd build
##from gcc -v
../src/configure -v –with-pkgversion=’Debian 4.3.2-1.1′ –with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs –enable-languages=c,c++,fortran,objc,obj-c++ –prefix=/usr –enable-shared –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –enable-nls –with-gxx-include-dir=/usr/include/c++/4.3 –program-suffix=-4.3 –enable-clocale=gnu –enable-libstdcxx-debug –enable-objc-gc –enable-mpfr –enable-targets=all –enable-cld –enable-checking=release –build=i486-linux-gnu –host=i486-linux-gnu –target=i486-linux-gnu
make

[/code]

after all, replace  /usr/lib/gcc/i486-linux-gnu/4.3/cc1plus  and /usr/lib/gcc/i486-linux-gnu/4.3/cc1 with the ones which we just made in directory ‘build/gcc’. Don’t make install to keep the system clean.

此条目发表在linux分类目录。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

*