deb http://archive.ubuntu.com/ubuntu xenial main deb http://archive.ubuntu.com/ubuntu xenial universe
更新apt源信息,并安装gcc和g++
1 2
sudo apt update sudo apt install gcc-4.8 g++-4.8
在更新过程中 我遇到了
1 2 3 4 5 6 7
Err:5 http://archive.ubuntu.com/ubuntu xenial InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32 Reading package lists... Done W: GPG error: http://archive.ubuntu.com/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32 E: The repository 'http://archive.ubuntu.com/ubuntu xenial InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
root@aki:~# g++ --version g++ (Ubuntu 4.8.5-4ubuntu2) 4.8.5 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@aki:~# gcc --version gcc (Ubuntu 4.8.5-4ubuntu2) 4.8.5 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
... #ifdef HAVE_CONFIG_H # include <config.h> #endif
#define __alloca alloca <- 添加这一句 #define __stat stat <- 添加这一句 /* Enable GNU extensions ...
防止之后出现报错:
1 2 3 4 5 6
/usr/bin/ld: /root/make-3.81/glob/glob.c:955: undefined reference to `__stat' /usr/bin/ld: /root/make-3.81/glob/glob.c:809: undefined reference to `__stat' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:411: make] Error 1 make[1]: Leaving directory '/root/make-3.81' make: *** [Makefile:603: install-recursive] Error 1
然后进行安装 make-3.81
1 2
bash configure sudo make install
删除最新的make
1
apt remove make -y #删除之前apt装的make,其位置在/usr/bin/make
删除链接
1
rm /usr/bin/make
测试:
1 2 3 4 5 6 7 8
make -version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.