So I’m starting a new VM, and after installing Debian, and the important packages, build-essential and the Linux headers…
# Â apt-get install build-essential linux-headers-$(uname -r)
I got this fine error trying to build binutils:
gcc -g -O2 -o sysinfo sysinfo.o syslex.o
syslex.o: In function `main’:
/usr/src/binutils-build/syslex.c:1: multiple definition of `main’
sysinfo.o:/usr/src/binutils-2.22-human68k/sysinfo.c:1: first defined here
collect2: ld returned 1 exit status
Turns out I didn’t have bison/flex installed. Â Oops!
Oh well easy enough to solve.
#apt-get install bison flex
Otherwise, remember to build binutils/gcc in it’s own directory or that’ll cause other fun down the line.
Don’t forget you need GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+ to build GCC…
# Â apt-get install libgmp-dev libmpfr-dev libmpc-dev
In case you didn’t know, you can install everything needed to build a package when you have the source repos enabled by using apt-get build-dep . In this case, you could have apt-get build-dep gcc and it would have installed everything needed to build gcc (according the source package of gcc from debian).
Relevant informations from debian’s wiki:
https://wiki.debian.org/BuildingTutorial#Get_the_build_dependencies
It doesn’t help me at all, but I guess it may help others.
When you are building non-trunk tools well you still have to compile them.
Well, I brainfarted when I wrote the post and wrote gcc instead of binutils, but I had this same exact issue when compiling a toolchain. By using
apt-get build-dep binutils
I have the following output:The following NEW packages will be installed:
autoconf bison dejagnu diffstat expect flex libbison-dev quilt tcl8.5 texinfo zlib1g-dev
I had to include “
deb-src http://ftp.debian.org/debian wheezy main contrib non-free
” in my sources.list before, though.Ok, now that makes a heck of a lot more sense!