简体   繁体   English

GCC 作为 m68k 交叉编译器

[英]GCC as m68k cross-compiler

I am trying to recompile binutils and GCC as a cross-compiler for m68k architecture.我正在尝试将 binutils 和 GCC 重新编译为 m68k 架构的交叉编译器。 I am following these instructions:我正在遵循以下说明:

http://darkdust.net/writings/megadrive/crosscompiler http://darkdust.net/writings/megadrive/crosscompiler

However, the process keeps failing on one part or another.然而,该过程在某一部分或另一部分不断失败。 I have tried with binutils 2.16.1 and gcc 3.4.6, binutils 2.15 and gcc 3.4.2 and binutils 2.15 and gcc 3.4.6.我尝试过 binutils 2.16.1 和 gcc 3.4.6、binutils 2.15 和 gcc 3.4.2 以及 binutils 2.15 和 gcc 3.4.6。

This last attempt fails when running "make" on gcc, after making and installing binutils.在制作和安装 binutils 之后,在 gcc 上运行“make”时,最后一次尝试失败。 It gives the following error:它给出了以下错误:

gcc   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-
prototypes -Wmissing-prototypes -pedantic -Wno-long-long    -DHAVE_CONFIG_H    
-I. -I. -I../../gcc-3.4.2/gcc -I../../gcc-3.4.2/gcc/. -I../../gcc-
3.4.2/gcc/../include   \
-DTARGET_MACHINE=\"m68k-coff\" \
-c ../../gcc-3.4.2/gcc/collect2.c -o collect2.o

In file included from /usr/include/fcntl.h:289:0,
             from ../../gcc-3.4.2/gcc/system.h:214,
             from ../../gcc-3.4.2/gcc/collect2.c:30:

In function ‘open’,
inlined from ‘collect_execute’ at ../../gcc-3.4.2/gcc/collect2.c:1535:20:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to 
‘__open_missing_mode’ declared with attribute error: open with O_CREAT or 
O_TMPFILE in second argument needs 3 arguments
__open_missing_mode ();
^
Makefile:1364: recipe for target 'collect2.o' failed
make[1]: *** [collect2.o] Error 1
make[1]: Leaving directory '/home/gabriel/src/gcc-build/gcc'
Makefile:23339: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2

I don't expect to fix this error, but does anyone know of a combination of binutils and gcc release that work?我不希望修复这个错误,但是有人知道 binutils 和 gcc 版本的组合有效吗? Should I be using a certain version of gcc to recompile gcc successfuly?我应该使用某个版本的 gcc 来成功重新编译 gcc 吗?

Thanks for any insight you may have on this!感谢您对此的任何见解!

EDIT:编辑:

My linux has GCC 5.4.0 so I just downloaded the 5.4.0 source to try and rebuild that for m68k cross-compiling.我的 linux 有 GCC 5.4.0,所以我刚刚下载了 5.4.0 源代码来尝试重建它以进行 m68k 交叉编译。 I now get the following error when running "make" on the gcc source:在 gcc 源上运行“make”时,我现在收到以下错误:

*** Configuration m68k-unkown-coff not supported

What could be the cause of this?这可能是什么原因? Is it because I need an older version of GCC?是因为我需要旧版本的 GCC 吗? (the binutils version i'm using definately supports the m68k target). (我使用的 binutils 版本绝对支持 m68k 目标)。 The tutorial I'm using always defines "--target=m68k-coff", should that instead be "--target=m68k-unkown-coff"?我使用的教程总是定义“--target=m68k-coff”,它应该是“--target=m68k-unkown-coff”吗?

EDIT 2:编辑2:

So I tried compiling for m68k-elf but now I get this error:所以我尝试编译 m68k-elf 但现在我收到这个错误:

checking for m68k-elf-gcc... /home/gabriel/src/gcc-build/./gcc/xgcc -B/home/gabriel/src/gcc-build/./gcc/ -B/opt/m68k/m68k-elf/bin/ -B/opt/m68k/m68k-elf/lib/ -isystem /opt/m68k/m68k-elf/include -isystem /opt/m68k/m68k-elf/sys-include
checking for suffix of object files... configure: error: in `/home/gabriel/src/gcc-build/m68k-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile

I ran download_prerequisites before building so it should not be a problem with the MPC library.我在构建之前运行了 download_prerequisites,所以它应该不是 MPC 库的问题。 Any idea how to move on?知道如何继续吗? I need assembler only so I don't mind what the format of the object files is.我只需要汇编程序,所以我不介意目标文件的格式是什么。 Thanks!谢谢!

I used to do pretty much what you are doing right now.我过去经常做你现在正在做的事情。

My advice is to use crosstool-ng ( http://crosstool-ng.github.io ), as it does pretty much everything in an automated manner.我的建议是使用 crosstool-ng ( http://crosstool-ng.github.io ),因为它几乎以自动化方式完成所有工作。

If you are studying m68k assembly, I used to host a modified version of gcc-explorer by Matt Godbolt ( https://godbolt.org/ ).如果您正在学习 m68k 汇编,我曾经托管过 Matt Godbolt ( https://godbolt.org/ ) 的修改版 gcc-explorer。 You can find a runnable docker image here ( https://hub.docker.com/r/esantoro/acso-explorer/ ) and some more details here ( https://znpy.wordpress.com/2017/05/08/decommisioning-acso-explorer-santoro-tk/ )你可以在这里找到一个可运行的 docker 镜像( https://hub.docker.com/r/esantoro/acso-explorer/ )和更多细节在这里( https://znpy.wordpress.com/2017/05/08/退役-acso-explorer-santoro-tk/ )

Hope it helps,希望能帮助到你,

znpy znpy

you can build most versions with a current Linux.您可以使用当前的 Linux 构建大多数版本。 To install the prerequisites have a look at https://github.com/bebbo/amiga-gcc要安装先决条件,查看https://github.com/bebbo/amiga-gcc

  • unpack the gcc archive, eg to /opt/cross/gcc-6.5.0解压 gcc 存档,例如到 /opt/cross/gcc-6.5.0
  • create a separate build folder, eg /opt/cross/xcc-6.5.0 - never build inside gcc's source folder!创建一个单独的构建文件夹,例如 /opt/cross/xcc-6.5.0 - 永远不要在 gcc 的源文件夹中构建!
  • create the prefix folder, that's where binaries are installed to, eg /opt/cross/gcc65创建前缀文件夹,这是安装二进制文件的地方,例如 /opt/cross/gcc65
  • ensure that these folders exist and are writable, then确保这些文件夹存在且可写,然后
  • configure from within that build folder using an absolute path for configure使用配置的绝对路径从该构建文件夹中配置

    cd /opt/cross/xcc-6.5.0/ /opt/cross/gcc-6.5.0/configure --target=m68k-elf --program-prefix=m68k-elf- --enable-languages=c,c++ --prefix=/opt/cross/gcc65 --disable-libssp --disable-nls --disable-multilib make all-gcc make install-gcc

I'm also running the compiler explorer for 68k gccs at https://franke.ms/cex/我还在https://franke.ms/cex/ 上运行 68k gcc 的编译器资源管理器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM