Stupid error building binutils

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

This entry was posted in binutils, cross compiler, gcc, Linux by neozeed. Bookmark the permalink.

About neozeed

What is there to tell? I’ve loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX… I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since…!

4 thoughts on “Stupid error building binutils

    • 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 wheezy main contrib non-free” in my sources.list before, though.

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.