{"id":1265,"date":"2023-03-27T13:43:00","date_gmt":"2023-03-27T13:43:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=1265"},"modified":"2023-03-27T13:43:00","modified_gmt":"2023-03-27T13:43:00","slug":"1265","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2023\/03\/27\/1265\/","title":{"rendered":"Debian 11 \u5b89\u88c5 RISC-V \u548c Mips64 \u7684 GNU gcc\u7f16\u8bd1\u5668\u5de5\u5177\u94fe\u7684\u7b14\u8bb0"},"content":{"rendered":"<h1>Debian 11 \u5b89\u88c5 RISC-V \u548c Mips64 \u7684 GNU gcc\u7f16\u8bd1\u5668\u5de5\u5177\u94fe\u7684\u7b14\u8bb0<\/h1>\n<h2>RISC-V GNU Compiler Toolchain \u7684 <a href=\"https:\/\/github.com\/riscv-collab\/riscv-gnu-toolchain\">github<\/a><\/h2>\n<p>\u8fd9\u662f RISC-V C \u548c C++ \u4ea4\u53c9\u7f16\u8bd1\u5668\u3002 \u5b83\u652f\u6301\u4e24\u79cd\u6784\u5efa\u6a21\u5f0f\uff1a\u901a\u7528\u7684 ELF\/Newlib \u5de5\u5177\u94fe\u548c\u66f4\u590d\u6742\u7684 Linux-ELF\/glibc \u5de5\u5177\u94fe\u3002<\/p>\n<h2>gcc-toolchain-mips64 for the N64 \u7684 <a href=\"https:\/\/github.com\/n64-tools\/gcc-toolchain-mips64\">github<\/a><\/h2>\n<p>\u6b64 repo \u81ea\u52a8\u751f\u6210 MIPS64 \u5de5\u5177\u94fe\u4ee5\u5141\u8bb8\u5bf9 N64 \u8fdb\u884c\u4ea4\u53c9\u7f16\u8bd1\u3002 \u4e8c\u8fdb\u5236\u6587\u4ef6\u53ef\u4ee5\u4f5c\u4e3a\u5176\u4ed6\u6784\u5efa\u811a\u672c\u7684\u4e00\u90e8\u5206\u4e0b\u8f7d\uff0c\u8fd9\u53ef\u4ee5\u8282\u7701\u8bbe\u7f6e\u5f00\u53d1\u4eba\u5458\u73af\u5883\u7684\u65f6\u95f4\uff08\u81f3\u5c11 30 \u5206\u949f\uff09\uff0c\u4ee5\u4fbf\u6784\u5efa N64 \u5e93\uff0c\u4f8b\u5982 libdragon\u3002<\/p>\n<h3>\u5206\u522b\u8bbf\u95ee\u8fd9\u4e24\u4e2a<code>github<\/code>\u9879\u76ee\uff0c\u4e0b\u8f7d\u7f16\u8bd1\u5b8c\u6210\u7684\u4e8c\u8fdb\u5236\u5de5\u5177\u5305<\/h3>\n<ul>\n<li><a href=\"https:\/\/github.com\/riscv-collab\/riscv-gnu-toolchain\/releases\/download\/2023.03.14\/riscv32-elf-ubuntu-22.04-nightly-2023.03.14-nightly.tar.gz\">https:\/\/github.com\/riscv-collab\/riscv-gnu-toolchain\/releases\/download\/2023.03.14\/riscv32-elf-ubuntu-22.04-nightly-2023.03.14-nightly.tar.gz<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/n64-tools\/gcc-toolchain-mips64\/releases\/download\/11.3.0\/gcc-toolchain-mips64-linux64.tar.gz\">https:\/\/github.com\/n64-tools\/gcc-toolchain-mips64\/releases\/download\/11.3.0\/gcc-toolchain-mips64-linux64.tar.gz<\/a><\/li>\n<\/ul>\n<h2>\u4f7f\u7528 <code>xshell<\/code> \u7684 <code>rz<\/code> \u547d\u4ee4\u6216\u8005 <code>winscp<\/code> \u4f20\u9001\u5230 Debian 11 \u7684\u865a\u62df\u673a\u7cfb\u7edf\u3002<\/h2>\n<pre><code>mkdir -p \/opt &amp;&amp; cd \/opt\ntar xf riscv32-elf-ubuntu-22.04-nightly-2023.03.14-nightly.tar.gz\n\nmkdir -p \/opt\/mips &amp;&amp; cd \/opt\/mips\ntar xf gcc-toolchain-mips64-linux64.tar.gz\n\n# \u6d4b\u8bd5\u5de5\u5177\u7684\u8def\u5f84\u548c\u73af\u5883\u662f\u5426\u5b8c\u6574\n\/opt\/mips\/bin\/mips64-elf-gcc -v\n\/opt\/riscv\/bin\/riscv32-unknown-elf-gcc -v\n<\/code><\/pre>\n<h3>\u5982\u679c\u7cfb\u7edf\u73af\u5883\u6b63\u5e38\u663e\u793a\u5982\u4e0b<\/h3>\n<pre><code>root@debian:\/opt# \/opt\/riscv\/bin\/riscv32-unknown-elf-gcc -v\nUsing built-in specs.\nCOLLECT_GCC=\/opt\/riscv\/bin\/riscv32-unknown-elf-gcc\nCOLLECT_LTO_WRAPPER=\/opt\/riscv\/libexec\/gcc\/riscv32-unknown-elf\/12.2.0\/lto-wrapper\nTarget: riscv32-unknown-elf\nConfigured with: \/home\/runner\/work\/riscv-gnu-toolchain\/riscv-gnu-toolchain\/gcc\/configure --target=riscv32-unknown-elf --prefix=\/opt\/riscv --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion=g2ee5e430018 --with-system-zlib --enable-tls --with-newlib --with-sysroot=\/opt\/riscv\/riscv32-unknown-elf --with-native-system-header-dir=\/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=\/home\/runner\/work\/riscv-gnu-toolchain\/riscv-gnu-toolchain\/gcc --disable-multilib --with-abi=ilp32d --with-arch=rv32gc --with-tune=rocket --with-isa-spec=2.2 'CFLAGS_FOR_TARGET=-Os   -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os   -mcmodel=medlow'\nThread model: single\nSupported LTO compression algorithms: zlib zstd\ngcc version 12.2.0 (g2ee5e430018)\n\nroot@debian:\/opt# \/opt\/mips\/bin\/mips64-elf-gcc -v\nUsing built-in specs.\nCOLLECT_GCC=\/opt\/mips\/bin\/mips64-elf-gcc\nCOLLECT_LTO_WRAPPER=\/opt\/mips\/bin\/..\/libexec\/gcc\/mips64-elf\/11.3.0\/lto-wrapper\nTarget: mips64-elf\nConfigured with: ..\/gcc-source\/configure --prefix=\/home\/runner\/work\/mips64-gcc-toolchain\/mips64-gcc-toolchain\/scripts\/build\/linux64 --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=mips64-elf --with-arch=vr4300 --with-tune=vr4300 --enable-languages=c,c++ --without-headers --with-newlib --with-gnu-as=\/home\/runner\/work\/mips64-gcc-toolchain\/mips64-gcc-toolchain\/scripts\/build\/linux64\/bin\/mips64-elf-as --with-gnu-ld=\/home\/runner\/work\/mips64-gcc-toolchain\/mips64-gcc-toolchain\/scripts\/build\/linux64\/bin\/mips64-elf-ld --enable-checking=release --enable-shared --enable-shared-libgcc --disable-decimal-float --disable-gold --disable-libatomic --disable-libgomp --disable-libitm --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libssp --disable-libunwind-exceptions --disable-libvtv --disable-multilib --disable-nls --disable-rpath --disable-static --disable-threads --disable-win32-registry --enable-lto --enable-plugin --enable-static --without-included-gettext\nThread model: single\nSupported LTO compression algorithms: zlib zstd\ngcc version 11.3.0 (GCC) <\/code><\/pre>\n<h3>\u5982\u679c\u9519\u8bef\u663e\u793a\u7c7b\u4f3c\u4e0b\u9762\uff0c\u7f3a\u5c11 <code>GLIBC_2.32<\/code> \u5e93\uff0c\u9700\u8981\u5347\u7ea7 <code>glibc<\/code> \u5230 <code>GLIBC_2.32<\/code> \u7248\u672c<\/h3>\n<pre><code>mips64-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.32' not found (required by mips64-elf-gcc)\nmips64-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.33' not found (required by mips64-elf-gcc)\nmips64-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.34' not found (required by mips64-elf-gcc)\n\nriscv\/bin\/riscv64-unknown-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.32' not found (required by riscv\/bin\/riscv64-unknown-elf-gcc)\nriscv\/bin\/riscv64-unknown-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.33' not found (required by riscv\/bin\/riscv64-unknown-elf-gcc)\nriscv\/bin\/riscv64-unknown-elf-gcc: \/lib\/x86_64-linux-gnu\/libc.so.6: version \"GLIBC_2.34' not found (required by riscv\/bin\/riscv64-unknown-elf-gcc)\n<\/code><\/pre>\n<h3>Debian 11 \u4e0a\u5c06 <code>glibc<\/code> \u4ece\u7248\u672c 2.30 \u5347\u7ea7\u5230 2.32 \u65b9\u6cd5<\/h3>\n<ul>\n<li>\n<p>\u7f16\u8f91 <code>sources.list<\/code> \u6dfb\u52a0 <code>sid main<\/code> \u5b9e\u9a8c\u6027\u8f6f\u4ef6\u6e90\uff0c\u518d <code>apt -t sid<\/code> \u5b89\u88c5\u8f6f\u4ef6\u5305<\/p>\n<pre><code>vim \/etc\/apt\/sources.list\n\n# \u56fd\u5916\u9009\u5b98\u65b9\u6e90    deb http:\/\/ftp.debian.org\/debian sid main\n# \u56fd\u5185\u9009\u4e2d\u79d1\u5927\u6e90  deb http:\/\/mirrors.ustc.edu.cn\/debian\/ sid main\n\napt -t sid install libc6 libc6-dev libc6-dbg<\/code><\/pre>\n<h2>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u548c\u6d4b\u8bd5\u7f16\u8bd1\u5668<\/h2>\n<pre><code>export PATH=\"$PATH:\/opt\/riscv\/bin\/\"\nalias rvcc=riscv32-unknown-elf-gcc\n\nexport PATH=\"$PATH:\/opt\/mips\/bin\/\"\nalias mgcc=mips64-elf-gcc\n\nrvcc -v\nmgcc -v<\/code><\/pre>\n<\/li>\n<li>\u5efa\u8bae\u5c06\u4ee5\u4e0a <code>export<\/code> \u547d\u4ee4 \uff0c\u52a0\u5165\u5230 <code>~\/.bashrc<\/code> \u6587\u4ef6\u672b\u5c3e\uff0c\u6bcf\u6b21\u8fdb\u5165\u5bb9\u5668\u80fd\u81ea\u52a8\u52a0\u8f7d\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<\/ul>\n<h2>\u5b89\u88c5 <code>QEMU<\/code>  \u8fd9\u4e2a\u901a\u7528\u7684\u5f00\u6e90\u673a\u5668\u548c\u7528\u6237\u7a7a\u95f4\u6a21\u62df\u5668\u548c\u865a\u62df\u5668<\/h2>\n<pre><code>apt install qemu qemu-user\n<\/code><\/pre>\n<h2><code>gcc-toolchain-mips64<\/code> \u4ea4\u53c9\u7f16\u8bd1\u95ee\u9898\u5f85\u89e3\u51b3<\/h2>\n<pre><code># \u9519\u8bef\u5df2\u89e3\u51b3 mips64-elf\/bin\/as: error while loading shared libraries: libopcodes-2.38.so: cannot open shared object file: No such file or directory\n\necho \"\/opt\/mips\/x86_64-linux-gnu\/mips64-elf\/lib\" &gt; \/etc\/ld.so.conf.d\/mips64-elf.conf\nldconfig\n\n# \u9519\u8bef\u5f85\u89e3\u51b3 mips64-elf\/bin\/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400040\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Debian 11 \u5b89\u88c5 RISC-V \u548c Mips64 \u7684 GNU gcc\u7f16\u8bd1\u5668\u5de5\u5177\u94fe\u7684\u7b14\u8bb0 RI [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[73,72],"class_list":["post-1265","post","type-post","status-publish","format-standard","hentry","category-linux","tag-gcc","tag-riscv"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1265"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1265\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}