在 Ubuntu Trusty 中,有一个 gcc-3.3 的源包,它仅构建 libstdc++5。
有没有办法通过构建相应的 gcc 和 g++ deb 文件来共享或安装呢dpkg -i
?
答案1
是的,您可以使用下面的 bash 代码片段和补丁。它已在 amd64 上使用 trusty 进行了测试,但可能也适用于 ubuntu 的更高版本。它成功编译了 2007 年的旧版 qemu 0.9 版本。
gcc-3.3_3.3.6ds1_reenable_full_deb_pkgs_build.patch
# decode gcc-3.3_3.3.6ds1_reenable_full_deb_pkgs_build.patch
# (contains hard tabs which are unsupported by markdown)
cat <<EOF | uudecode
begin-base64-encoded 664 Z2NjLTMuM18zLjMuNmRzMV9yZWVuYWJsZV9mdWxsX2RlYl9wa2dzX2J1aWxkLnBhdGNo
VGhpcyBwYXRjaCByZWVuYWJsZXMgZGViIHBrZyBidWlsZGluZyBvZiBnY2Mg
YW5kIGcrKyBhbmQgb3RoZXJzCmluIGdjYy0zLjMtMy4zLjZkczEtMTZ1YnVu
dHUqIChhbmQgbGF0ZXIpIHNvdXJjZSBwYWNrYWdlcy4KCiMgZmV0Y2ggZ2Nj
IHNvdXJjZSB1c2luZyB3Z2V0IGFuZCB1bnBhY2sgLi4KREVCU1JDPWh0dHA6
Ly9hcmNoaXZlLnVidW50dS5jb20vdWJ1bnR1L3Bvb2wvdW5pdmVyc2UvClZC
PWdjYy0zLjNfMy4zLjZkczEKVlA9MjV1YnVudHU0CndnZXQgLS1uby1jaGVj
ay1jZXJ0aWZpY2F0ZSAkREVCU1JDL2cvZ2NjLTMuMy8kVkIub3JpZy50YXIu
Z3oKd2dldCAtLW5vLWNoZWNrLWNlcnRpZmljYXRlICRERUJTUkMvZy9nY2Mt
My4zLyRWQi0kVlAuZGlmZi5negp3Z2V0IC0tbm8tY2hlY2stY2VydGlmaWNh
dGUgJERFQlNSQy9nL2djYy0zLjMvJFZCLSRWUC5kc2MKZHBrZy1zb3VyY2Ug
LXggJFZCLSRWUC5kc2MKCiMgYWx0ZXJuYXRpdmVseSwgaWYgeW91I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oZCkvJChnY2NfbGliX2RpcikvY3J0MS5vCisJ
bG4gLXNmIC91c3IvJChsaWJkaXIpL2NydGkubyAkKGQpLyQoZ2NjX2xpYl9k
aXIpL2NydGkubworCWxuIC1zZiAvdXNyLyQobGliZGlyKS9jcnRuLm8gJChk
KS8kKGdjY19saWJfZGlyKS9jcnRuLm8KIGlmZXEgKCQoYmlhcmNoKSx5ZXMp
CiAJcm0gLWYgJChkKS8kKFBGKS8kKGxpYjY0KS9saWJnY2Nfcy5zbwogCWxu
IC1zZiAvJChsaWI2NCkvbGliZ2NjX3Muc28uJChHQ0NfU09OQU1FKSAkKGQp
LyQoZ2NjX2xpYl9kaXIpL2xpYmdjY19zXzY0LnNvCg==
====
EOF
bash 代码片段
# fetch gcc source using wget and unpack ..
DEBSRC=http://archive.ubuntu.com/ubuntu/pool/universe/
VB=gcc-3.3_3.3.6ds1
VP=24ubuntu5
wget --no-check-certificate $DEBSRC/g/gcc-3.3/$VB.orig.tar.gz
wget --no-check-certificate $DEBSRC/g/gcc-3.3/$VB-$VP.diff.gz
wget --no-check-certificate $DEBSRC/g/gcc-3.3/$VB-$VP.dsc
dpkg-source -x $VB-$VP.dsc
# .. alternatively, if you have deb-src set up in sources.list
#apt-get source gcc-3.3
# reenable deb pkg building
cd gcc-3.3*/
patch -p1 < ../gcc-3.3_3.3.6ds1_reenable_full_deb_pkgs_build.patch
# fix dh_movefiles wildcard globbing
# (cmdline param glob works only with DH_COMPAT=2)
for f in debian/rules.d/binary-*.mk
do sed -i -e 's/dh_movefiles/DH_COMPAT=2 \0/' $f
done
# compile and build deb packages
debian/rules control
debuild clean
debuild -uc -us
cd ..
# install results
sudo dpkg -i {cpp,gcc,g++}-3.3*.deb libstdc++5{_3.3.6,-3.3-dev}*.deb
做不是安装libgcc1_3.3.6*deb
。它可能与主机上已安装的版本冲突,并且 gcc-3.3 不需要它来工作,因为主机上存在的符号链接到。和 也是libgcc_s.so
如此crtn.o
。gcc-3.3 在链接构建的对象时需要这些,即调用时。它们是 libc6 包的一部分(此处)。构建过程将安装下面的链接(您的系统上的主机三元组可能不同)以发现安装的 libc6 版本。crti.o
crt1.o
ld
/usr/lib/gcc-lib/x86_64-linux-gnu/3.3.6/
x86_64-linux-gnu
ld
您不需要更改任何内容,但如果您需要根据自己的喜好调整这些链接,您可以在构建 deb 包之前修改它们。请查看提供的补丁文件的末尾。此类更改的相关文件是debian/rules.d/binary-gcc.mk
。