http://darkdust.net/writings/megadrive/crosscompiler
https://www.gnu.org/software/binutils/
svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc
That is taking too long, get a snapshot instead.
wget http://www.netgull.com/gcc/snapshots/7-20170504/gcc-7-20170504.tar.bz2
git clone git://sourceware.org/git/binutils-gdb.git
(Why is one git and the other svn?)
mkdir build_binutils
cd build_binutils
../binutils-gdb/configure --target=m68k-coff --
=$HOME/other/install
...
*** Configuration m68k-unknown-coff is obsolete.
*** Specify --enable-obsolete to build it anyway.
*** Support will be REMOVED in the next major release of BINUTILS,
*** unless a maintainer comes forward.
../binutils-gdb/configure --target=m68k-coff --prefix=$HOME/other/install --enable-obsolete
make
...
Setting warning flags = -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror
checking whether byte ordering is bigendian... no
This target is no longer supported in gas
So this version is not going to work. What is the latest version that will work?
2.23 is mentioned http://daveho.github.io/2012/10/26/m68k-elf-cross-compiler.html
git checkout remotes/origin/binutils-2_23-branch
cd build_binutils
../binutils-gdb/configure --target=m68k-coff --prefix=$HOME/other/install --enable-languages=c --program-prefix=m68k-coff-
make
../../../binutils-gdb/bfd/doc/bfd.texinfo:325: unknown command `colophon'
../../../binutils-gdb/bfd/doc/bfd.texinfo:336: unknown command `cygnus'
sudo apt-get install libgmp-dev
That didn't fix it.
http://trac.clfs.org/ticket/926
cd binutils-gdb
sed -i -e 's/@colophon/@@colophon/' \
-e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo
cd ../build_binutils
make
In file included from ../../binutils-gdb/bfd/opncls.c:26:0:
../../binutils-gdb/bfd/opncls.c: In function ‘bfd_fopen’:
./bfd.h:529:65: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
^
../../binutils-gdb/bfd/opncls.c:261:5: note: in expansion of macro ‘bfd_set_cacheable’
bfd_set_cacheable (nbfd, TRUE);
^
cc1: all warnings being treated as errors
Make warnings warnings next.
make CFLAGS="-Os -w"
...
This target is no longer supported in gas
https://cygwin.com/ml/binutils/2010-02/msg00089.html Go back to 2.16
git checkout remotes/origin/binutils-2_16-branch
...
make
built!
make install
...
./elf.texi:1: warning: @section missing argument
../../../binutils-gdb/bfd/doc/bfdt.texi:313: raising the section level of @subsubsection which is too low
./init.texi:5: raising the section level of @subsubsection which is too low
../../../binutils-gdb/bfd/doc/archive.texi:54: raising the section level of @subsubsection which is too low
...
Makefile:360: recipe for target '../../../binutils-gdb/bfd/doc/bfd.info' failed
...
failed!
http://blog.kempj.co.uk/2015/09/binutils-errors-compiling-oe/
"The error is due to an incompatibility between older versions of binutils and newer versions of texinfo. "
Replaced every subsubsection with subsection that generated a 'raising the section level' error.
../../../binutils-gdb/gas/doc/c-arc.texi:52: unknown command `ta'
Added another @ in front of @ta.
cannot open gasver.texi or /gasver.texi: No such file or directory
Don't think this is a major problem.
../../../binutils-gdb/gas/doc/as.texinfo:3637: @itemx must follow @item
...
../../../binutils-gdb/gas/doc/c-arc.texi:215: command @bullet not accepting argument in brace should not be on @table line
...
../../../binutils-gdb/gas/doc/c-tic54x.texi:112: @code expected braces
...
https://dev.openwrt.org/ticket/13039
"I manually downgraded to texinfo-4.13a"
Try installing old texinfo to other/install
http://ftp.gnu.org/gnu/texinfo/texinfo-4.13a.tar.gz
Or just disable documentation generation, though would like to look at it eventually.
make install MAKEINFO=false
or set MAKEINFO = missing in the build dir makefiles? That isn't working.
What about --disable-doc
?
../binutils-gdb/configure --target=m68k-coff --prefix=$HOME/other/install --enable-languages=c --program-prefix=m68k-coff- --disable-doc
"You should be able to pass MAKEINFO=/bin/false to configure to make it explicit that makeinfo is not available on your machine."
Also it looks like I do have some binutils binaries installed, despite the docs causing make install to fail.
bin/m68k-coff-objcopy
bin/m68k-coff-strings
bin/m68k-coff-strip
bin/m68k-coff-objdump
bin/m68k-coff-readelf
bin/m68k-coff-ar
bin/m68k-coff-c++filt
bin/m68k-coff-addr2line
bin/m68k-coff-nm
bin/m68k-coff-ranlib
bin/m68k-coff-size
m68k-coff
m68k-coff/bin
...
It looks like setting MAKEINFO = false in the top-level Makefile in the build_binutils also works?
Try latest then go backwards.
../gcc-7-20170504/configure --prefix=$HOME/other/install --target=m68k-coff --enable-languages=c --program-prefix=m68k-coff-
checking for the correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
...
sudo apt-get install libmpfr-dev libmpc-dev
configure now works, but not make:
*** Configuration m68k-unknown-coff not supported
4.4.2 instead? (saw this on a webpage about cross compiling) Try 4.9.4 first - nope not supported.
../gcc-4.4.2/configure --prefix=$HOME/other/install --target=m68k-coff --enable-languages=c --program-prefix=m68k-coff- --enable-obsolete
make
...
toplev.c:536:1: error: redefinition of ‘floor_log2’
http://stackoverflow.com/questions/34569458/error-occurred-compiling-gcc-from-source-code
CC = gcc -fgnu89-inline
CXX = g++ -fgnu89-inline
This
...
attribs.o: In function `floor_log2':
/home/lucasw/other/retro/68000/build_gcc/gcc/../../gcc-4.4.2/gcc/toplev.h:192: multiple definition of `floor_log2'
c-lang.o:/home/lucasw/other/retro/68000/build_gcc/gcc/../../gcc-4.4.2/gcc/toplev.h:192: first defined here
attribs.o: In function `exact_log2':
...
https://bugzilla.redhat.com/show_bug.cgi?id=476370
https://gcc.gnu.org/ml/gcc-patches/2009-06/msg01234.html
How about commenting out the ../gcc-4.4.2/gcc/toplev.h
definitions?
/*
extern inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}
extern inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
}
*/
Now another texinfo error:
../../gcc-4.4.2/gcc/doc/cppopts.texi:761: @itemx must follow @item
Set MAKEINFO = false
in build_gcc/Makefile
and build_gcc/gcc/Makefile
,
and BUILD_INFO =
(make it blank) in the gcc makefile also.
This looks more serious:
checking for m68k-coff-gcc... /home/lucasw/other/retro/68000/build_gcc/./gcc/xgcc -B/home/lucasw/other/retro/68000/build_gcc/./gcc/ -B/home/lucasw/other/install/m68k-coff/bin/ -B/home/lucasw/other/install/m68k-coff/lib/ -isystem /home/lucasw/other/install/m68k-coff/include -isystem /home/lucasw/other/install/m68k-coff/sys-include -mcpu=51qe
checking for suffix of object files... configure: error: in `/home/lucasw/other/retro/68000/build_gcc/m68k-coff/m51qe/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
Makefile:11146: recipe for target 'configure-target-libgcc' failed
Error: unrecognized architecture specification `cpu=51qe'
Error: unrecognized option -mcpu=51qe
configure:2614: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2627: error: in `/home/lucasw/other/retro/68000/build_gcc/m68k-coff/m51qe/libgcc':
configure:2630: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
What is 51qe?
It looks like a more modern embedded board, just disable it for now.
m68k-coff/libgcc/Makefile
has a line MULTIDIRS = ... 51qe ...
, remove it from there.
4.4.2/libgcc/../include -DHAVE_CC_TLS -o _double.o -MT _double.o -MD -MP -MF _double.dep -DL_double -xassembler-with-cpp \
-c ../../../../gcc-4.4.2/libgcc/../gcc/config/m68k/lb1sf68.asm
../../../../gcc-4.4.2/libgcc/../gcc/config/m68k/lb1sf68.asm: Assembler messages:
../../../../gcc-4.4.2/libgcc/../gcc/config/m68k/lb1sf68.asm:669: Error: unknown pseudo-op: `.hidden'
Makefile:350: recipe for target '_double.o' failed
make[4]: *** [_double.o] Error 1
make[4]: Leaving directory '/home/lucasw/other/retro/68000/build_gcc/m68k-coff/m68000/libgcc'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18804
Links to patches are now broken. The log message is "Use implementation instead of declaration for test function", should be able to find that.
http://stackoverflow.com/questions/43822748/view-old-changes-to-gcc-cvs-repository
https://gcc.gnu.org/viewvc/gcc?view=revision&revision=91732
Don't see the file mklibgcc.in
Maybe give up on compiling gcc and try another way for 68000 c/asm.
gcc-m68k-linux-gnu exists, where does that come from?
sudo apt-get install gcc-m68k-linux-gnu
...
The following additional packages will be installed:
binutils-m68k-linux-gnu cpp-5-m68k-linux-gnu cpp-m68k-linux-gnu gcc-5-cross-base-ports
gcc-5-m68k-linux-gnu gcc-5-m68k-linux-gnu-base libatomic1-m68k-cross libc6-dev-m68k-cross
libc6-m68k-cross libgcc-5-dev-m68k-cross libgcc2-m68k-cross libgomp1-m68k-cross
linux-libc-dev-m68k-cross
Suggested packages:
binutils-doc gcc-5-locales cpp-doc gcc-5-doc libgcc2-dbg-m68k-cross libgomp1-dbg-m68k-cross
libitm1-dbg-m68k-cross libatomic1-dbg-m68k-cross libasan2-dbg-m68k-cross
liblsan0-dbg-m68k-cross libtsan0-dbg-m68k-cross libubsan0-dbg-m68k-cross
libcilkrts5-dbg-m68k-cross libmpx0-dbg-m68k-cross libquadmath0-dbg-m68k-cross bison
gdb-m68k-linux-gnu gcc-doc
The following packages will be REMOVED:
g++-multilib gcc-multilib
The following NEW packages will be installed:
binutils-m68k-linux-gnu cpp-5-m68k-linux-gnu cpp-m68k-linux-gnu gcc-5-cross-base-ports
gcc-5-m68k-linux-gnu gcc-5-m68k-linux-gnu-base gcc-m68k-linux-gnu libatomic1-m68k-cross
libc6-dev-m68k-cross libc6-m68k-cross libgcc-5-dev-m68k-cross libgcc2-m68k-cross
libgomp1-m68k-cross linux-libc-dev-m68k-cross
...
Now have a ton of m68k tools:
$ m68k-
m68k-coff-addr2line m68k-linux-gnu-as m68k-linux-gnu-gcov-tool
m68k-coff-ar m68k-linux-gnu-c++filt m68k-linux-gnu-gcov-tool-5
m68k-coff-as m68k-linux-gnu-cpp m68k-linux-gnu-gprof
m68k-coff-c++filt m68k-linux-gnu-cpp-5 m68k-linux-gnu-ld
m68k-coff-ld m68k-linux-gnu-elfedit m68k-linux-gnu-ld.bfd
m68k-coff-nm m68k-linux-gnu-gcc m68k-linux-gnu-nm
m68k-coff-objcopy m68k-linux-gnu-gcc-5 m68k-linux-gnu-objcopy
m68k-coff-objdump m68k-linux-gnu-gcc-ar m68k-linux-gnu-objdump
m68k-coff-ranlib m68k-linux-gnu-gcc-ar-5 m68k-linux-gnu-ranlib
m68k-coff-readelf m68k-linux-gnu-gcc-nm m68k-linux-gnu-readelf
m68k-coff-size m68k-linux-gnu-gcc-nm-5 m68k-linux-gnu-size
m68k-coff-strings m68k-linux-gnu-gcc-ranlib m68k-linux-gnu-strings
m68k-coff-strip m68k-linux-gnu-gcc-ranlib-5 m68k-linux-gnu-strip
m68k-linux-gnu-addr2line m68k-linux-gnu-gcov
m68k-linux-gnu-ar m68k-linux-gnu-gcov-5
Sega Genesis / Mega Drive
http://www.bytesizeadventures.com/modern-mega-drive-programming-getting-started/
https://emudocs.org/Genesis/sega2f.htm
http://www.genny4ever.net/index.php?page=tools
https://github.com/kubilus1/gendev
git clone and make - wants sudo, no thanks.
Edit Makefile and delete the sudo, change the install dir to a home dir instead of opt.
In gendev/work/logs/build-binutils-m68k-elf-2.24.log
Need to fix TOOLS location in Makefile:
also
Resource: PALETTE font_pal_lib "image/font_lib.png"
--> executing plugin PALETTE...
Make gets a lot further now:
The binary is actually in
/home/lucasw/other/retro/sega_genesis_mega_drive/toolchains/gen/m68k-elf/bin/
Fix
sgdk/sgdk-read-only/Makefile
so GENDEV points to the right location (it was getting passed an incorrect GENDEV from elsewhere, would be nice to fix that).Then:
Try yes next time to the patches?
Running make over requires lengthy recompilation of already compiled binaries.