由一个git clone引发的一连串

在我的电脑上,git clone经常出现错误,例如
git clone https://github.com/kubernetes/kubernetes.git
error: gnutls_handshake() failed: A TLS packet with unexpected length was received.

在这里找到答案,在proxy以后,gnutls工作非常奇怪,但是openssl能工作很好。
因此按照此步骤,重新编译git

sudo apt-get update
sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
sudo apt-get build-dep git
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git
dpkg-source -x git_1.7.9.5-1.dsc
cd git-1.7.9.5
vim debian/control   //将libcurl4-gnutls-dev替换成libcurl4-openssl-dev
sudo dpkg-buildpackage -rfakeroot -b -d
386: sudo dpkg -i ../git_1.7.9.5-1_i386.deb
x86_64: sudo dpkg -i ../git_1.7.9.5-1_amd64.deb
  • 问题 1
    Setting up fontconfig (2.11.0-0ubuntu4.1) ...
    Regenerating fonts cache... failed.
    See /var/log/fontconfig.log for more information.
    dpkg: error processing package fontconfig (--configure):
    subprocess installed post-installation script returned error exit status 1
    Setting up apt-utils (1.0.1ubuntu2.6) ...
    Errors were encountered while processing: fontconfig
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    /.local/share/fonts: fc-cache: symbol lookup error: fc-cache: undefined symbol: FcStrListFirst
    

答案是
apt-get remove --purge fontconfig-config
后来发现完全删除fontconfig也会有问题。最后的解决方案是:

cd /usr/lib/x86_64-linux-gnu
rm libfont*
sudo apt-get install libfontconfig1
  • 问题 2
    sudo dpkg-buildpackage -rfakeroot -b -d过程中出现gcc版本过低的情况:
    gcc: error: unrecognized command line option '-fstack-protector-strong'
    但是安装过程中,发现源没有:
    $ sudo apt-get install gcc-4.9 Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
     gcc-4.9 : Depends: cpp-4.9 (= 4.9.2-10ubuntu13) but it is not going to be installed
         Depends: gcc-4.9-base (= 4.9.2-10ubuntu13) but 4.9.3-0ubuntu4 is to be installed
         Depends: libgcc-4.9-dev (= 4.9.2-10ubuntu13) but it is not going to be installed`
    

需要添加源ppa:ubuntu-toolchain-r/test
按理说sudo add-apt-repository ppa:ubuntu-toolchain-r/test这样是可以的,可是一直不成功,后来找到答案说是过时了,正确是
sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" `
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
(保留原来的4.8.2版本,便于快速切换)
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

你可能感兴趣的:(由一个git clone引发的一连串)