豆腐脑 發表於 2020-11-23 19:43:00

fedora rk3399 gcc 4.9.3

<h1 id="1-下载-gcc-493-的源代码">1. 下载 gcc 4.9.3 的源代码。</h1>
<p>http://ftp.gnu.org/gnu/gcc/gcc-4.9.3/ 或者国内的交大 https://mirrors.sjtug.sjtu.edu.cn/gnu/gcc/gcc-4.9.3/</p>
<h1 id="2-解压-gcc-源码然后从-gcc-493contribdownload_prerequisites-这个文件中读取需要依赖的包下载相应的依赖包">2. 解压 gcc 源码,然后从 gcc-4.9.3/contrib/download_prerequisites 这个文件中读取需要依赖的包。下载相应的依赖包。</h1>
<pre><code># Necessary to build GCC.
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
ISL=isl-0.12.2
CLOOG=cloog-0.18.1
</code></pre>
<p>https://mirrors.sjtug.sjtu.edu.cn/gnu/ 可以下载 gcc, mpfr, gmp<br>
https://sourceforge.net/projects/d2718c/ 可以下载好几个东西,但是速度是个问题。<br>
https://src.fedoraproject.org/lookaside/extras/gcc/isl-0.12.2.tar.bz2 可以下载 isl ,速度还可以。</p>
<h1 id="3-把第二部的压缩包解压到-gcc-源码目录下然后-ln--sf-xxx-xxx-xxx建立这几个包的软连接如果不想这么麻烦并且网络很好的话直接在上一步执行-download_prerequisites-也可以">3. 把第二部的压缩包解压到 gcc 源码目录下,然后 ln -sf xxx-xxx xxx,建立这几个包的软连接。如果不想这么麻烦,并且网络很好的话,直接在上一步执行 download_prerequisites 也可以。</h1>
<h1 id="4">4.</h1>
<pre><code>cd ..
mkdir gcc-4.9.3-build-temp
cd gcc-4.9.3-build-temp
</code></pre>
<h1 id="5-根据原来机器的-gcc--v-获得相应的-config-选项然后配置新的选项做成脚本进行执行">5. 根据原来机器的 gcc -v 获得相应的 config 选项,然后配置新的选项,做成脚本进行执行。</h1>
<h1 id="6-config-的时候报错">6. config 的时候,报错:</h1>
<p>GNAT is required to build ada<br>
这个因为不需要 ada,所以直接在 language 选项里面去掉 ada 就可以了。<br>
参考: http://gcc.1065356.n8.nabble.com/GNAT-is-required-to-build-ada-td692409.html<br>
https://github.com/spack/spack/issues/15867<br>
https://github.com/owent-utils/bash-shell/issues/2</p>
<h1 id="6-make--jx-之后报错">6. make -jX 之后,报错:</h1>
<p>In file included from ../../gcc-4.9.3/gcc/cp/except.c:1013:cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute</p>
<p>这个使用 4.9.4 版本就可以了。<br>
参考: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=831142<br>
https://github.com/jens-maus/RaspberryMatic/issues/28</p>
<h1 id="7-报错">7. 报错:</h1>
<p>/md-unwind-support.h: In function ‘aarch64_fallback_frame_state’:error: field ‘uc’ has incomplete typestruct ucontext uc;<br>
这个是因为 glibc 有更新导致的,需要修改 gcc-4.9.4/libgcc/config/XXX/linux_unwind.h 这个头文件,把 struct ucontext uc; 去掉,换成 ucontext_t uc; 因为 /usr/include/sys/ucontext.h 里面是这个定义。所以要按照新的 libc 来修改一下。当然也可以打补丁代替手动修改。</p>
<p>参考: https://stackoverflow.com/questions/46999900/how-to-compile-gcc-6-4-0-with-gcc-7-2-in-archlinux<br>
https://blog.csdn.net/XCCCCZ/article/details/80958414<br>
https://patchwork.ozlabs.org/project/buildroot/patch/20170923212414.16744-10-romain.naour@gmail.com/<br>
http://lists.busybox.net/pipermail/buildroot/2017-September/202526.html<br>
https://blog.csdn.net/wang805447391/article/details/83380302<br>
https://unix.stackexchange.com/questions/566650/how-do-i-compile-gcc-5-from-source<br>
https://stackoverflow.com/questions/52498431/compile-gcc6-4-0-using-gcc8-1-1<br>
https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=libgcc/config/aarch64/linux-unwind.h;h=d46d5f53be379ec2dbc9a5ba95d51e22c1d52c2f;hp=d5d6980442fd47b1f1e499e99cb25b5fffbdbeb3;hb=883312dc79806f513275b72502231c751c14ff72;hpb=601d22f69093aa98dcf9593bc138da7ba8281e05<br>
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=883312dc79806f513275b72502231c751c14ff72</p>
<h1 id="8-报错">8. 报错:</h1>
<pre><code>/home/openailab/Downloads/test/gcc-4.9.4-build-temp/./gcc/xgcc: /home/openailab/Downloads/test/gcc-4.9.4-build-temp/aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/openailab/Downloads/test/gcc-4.9.4-build-temp/./gcc/xgcc)
make: *** Error 1
</code></pre>
<p>这个错误网上找不到解决方法,这个尝试暂停。</p>
<h1 id="参考">参考:</h1>
<p>https://www.cnblogs.com/succeed/p/6204438.html<br>
https://www.cnblogs.com/alianbog/p/12498915.html<br>
https://developer.aliyun.com/article/90390<br>
https://blog.csdn.net/llh_1178/article/details/79329250<br>
https://www.theobroma-systems.com/rk3399-q7-user-manual/04-software.html<br>
https://www.jianshu.com/p/0caef3ce8e06<br>
https://gcc.gnu.org/install/<br>
https://www.cnblogs.com/uestc-mm/p/7511063.html<br>
https://blog.csdn.net/xiexievv/article/details/50620170<br>
https://zhuanlan.zhihu.com/p/107133028<br>
https://www.jianshu.com/p/fc162672fae2<br>
https://blog.csdn.net/u013946356/article/details/83106133</p><br><br>
来源:https://www.cnblogs.com/ramlife/p/14026457.html
頁: [1]
查看完整版本: fedora rk3399 gcc 4.9.3