如何安装编译器G+ -4.8.5在Ubuntu 22.04中
我正在尝试在Ubuntu 22.04上安装G ++编译器版本4.8.5,并找到了一个类似的问题在这里
我已经应用了链中建议的所有更改,但无法编译GCC4.8.5,以下是步骤
sudo dpkg --add-architecture i386
sudo apt update
sudo apt upgrade
sudo apt-get install gcc-multilib libstdc++6:i386
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 --no-check-certificate
tar xf gcc-4.8.5.tar.bz2
# cd gcc-4.8.5
# ./contrib/download_prerequisites
# cd ..
sed -i -e 's/__attribute__/\/\/__attribute__/g' gcc-4.8.5/gcc/cp/cfns.h
sed -i 's/struct ucontext/ucontext_t/g' gcc-4.8.5/libgcc/config/i386/linux-unwind.h
sed -i '/#include <pthread.h>/a #include <signal.h>' path_to_gcc4.8.5src/libsanitizer/asan/asan_linux.cc
sed -i 's/__res_state \\*statp = (__res_state\\*)state\\;/struct __res_state \\*statp = (struct __res_state\\*)state\\;/g' path_to_gcc4.8.5src/libsanitizer/tsan/tsan_platform_linux.cc
mkdir xgcc-4.8.5
pushd xgcc-4.8.5
$PWD/../gcc-4.8.5/configure --enable-languages=c,c++ --prefix=/usr --enable-shared --enable-plugin --program-suffix=-4.8.5
make MAKEINFO="makeinfo --force" -j
sudo make install -j
编译错误
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c: In function ‘tree_node* ix86_handle_abi_attribute(tree_node**, tree, tree, int, bool*)’:
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34858:18: warning: unquoted identifier or keyword ‘ms_abi’ in format [-Wformat-diag]
34858 | **error** ("ms_abi and sysv_abi attributes are not compatible");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34858:18: warning: unquoted identifier or keyword ‘sysv_abi’ in format [-Wformat-diag]
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34867:18: warning: unquoted identifier or keyword ‘ms_abi’ in format [-Wformat-diag]
34867 | **error** ("ms_abi and sysv_abi attributes are not compatible");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34867:18: warning: unquoted identifier or keyword ‘sysv_abi’ in format [-Wformat-diag]
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c: In function ‘long unsigned int ix86_memmodel_check(long unsigned int)’:
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:42398:15: warning: unquoted identifier or keyword ‘HLE_ACQUIRE’ in format [-Wformat-diag]
/bin/bash /home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm gcc.pod
make[3]: Leaving directory '/home/umtts/xgcc-4.8.5/gcc'
make[2]: *** [Makefile:4163: all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/umtts/xgcc-4.8.5'
make[1]: *** [Makefile:21493: stage1-bubble] Error 2
make[1]: Leaving directory '/home/umtts/xgcc-4.8.5'
make: *** [Makefile:892: all] Error 2
umtts@wifi6:~/xgcc-4.8.5$ ls
I am trying to install g++ compiler version 4.8.5 on ubuntu 22.04 and found a similar question here
i have applied all the changes suggested in the chain but unable to compile the gcc4.8.5 , here are the steps
sudo dpkg --add-architecture i386
sudo apt update
sudo apt upgrade
sudo apt-get install gcc-multilib libstdc++6:i386
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 --no-check-certificate
tar xf gcc-4.8.5.tar.bz2
# cd gcc-4.8.5
# ./contrib/download_prerequisites
# cd ..
sed -i -e 's/__attribute__/\/\/__attribute__/g' gcc-4.8.5/gcc/cp/cfns.h
sed -i 's/struct ucontext/ucontext_t/g' gcc-4.8.5/libgcc/config/i386/linux-unwind.h
sed -i '/#include <pthread.h>/a #include <signal.h>' path_to_gcc4.8.5src/libsanitizer/asan/asan_linux.cc
sed -i 's/__res_state \\*statp = (__res_state\\*)state\\;/struct __res_state \\*statp = (struct __res_state\\*)state\\;/g' path_to_gcc4.8.5src/libsanitizer/tsan/tsan_platform_linux.cc
mkdir xgcc-4.8.5
pushd xgcc-4.8.5
$PWD/../gcc-4.8.5/configure --enable-languages=c,c++ --prefix=/usr --enable-shared --enable-plugin --program-suffix=-4.8.5
make MAKEINFO="makeinfo --force" -j
sudo make install -j
Compilation Error
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c: In function ‘tree_node* ix86_handle_abi_attribute(tree_node**, tree, tree, int, bool*)’:
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34858:18: warning: unquoted identifier or keyword ‘ms_abi’ in format [-Wformat-diag]
34858 | **error** ("ms_abi and sysv_abi attributes are not compatible");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34858:18: warning: unquoted identifier or keyword ‘sysv_abi’ in format [-Wformat-diag]
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34867:18: warning: unquoted identifier or keyword ‘ms_abi’ in format [-Wformat-diag]
34867 | **error** ("ms_abi and sysv_abi attributes are not compatible");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:34867:18: warning: unquoted identifier or keyword ‘sysv_abi’ in format [-Wformat-diag]
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c: In function ‘long unsigned int ix86_memmodel_check(long unsigned int)’:
/home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/config/i386/i386.c:42398:15: warning: unquoted identifier or keyword ‘HLE_ACQUIRE’ in format [-Wformat-diag]
/bin/bash /home/umtts/xgcc-4.8.5/../gcc-4.8.5/gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm gcc.pod
make[3]: Leaving directory '/home/umtts/xgcc-4.8.5/gcc'
make[2]: *** [Makefile:4163: all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/umtts/xgcc-4.8.5'
make[1]: *** [Makefile:21493: stage1-bubble] Error 2
make[1]: Leaving directory '/home/umtts/xgcc-4.8.5'
make: *** [Makefile:892: all] Error 2
umtts@wifi6:~/xgcc-4.8.5$ ls
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论