10

I'm having a lot of trouble compiling the otherwise excellent Contiki OS on my macbook pro (with mac os x 10.6). Contiki actually uses a lot of GNU-specific features and options of GCC, AR, LD, and so on. So I installed those utilities via macports, but it looks like "port install binutils" does not install GNU ld, does it ?

So, the question is, how do I get GNU ld on my mac ? Is there a simple alternative to the hard-way (i.e. the wget, configure, make, make install way) ?

Gyom
  • 3,773
  • 5
  • 29
  • 38
  • The "hard" way isn't that hard... (unless something goes wrong of course) – Bob Aman Oct 24 '09 at 17:56
  • Sure ; but in this case I very much doubt that I will get better results than what macport gets (because macports *does* the " wget && configure && make" thing) – Gyom Oct 24 '09 at 18:25
  • related: http://stackoverflow.com/questions/23290431/ld-linking-error-while-compiling-z3 – 0 _ Dec 04 '15 at 07:49
  • related: http://stackoverflow.com/questions/9260504/macports-installing-binutils – 0 _ Dec 04 '15 at 07:50

2 Answers2

11

As far as I can tell, GNU binutils does not support the Mach-O format. None of the documentation mentions it, and some Googling turns up some recent messages indicating that it is not supported.

Now, you mention the Contiki OS, which looks to me like an embedded operating system. Are you needing to compile to a native executable, or are you trying to cross-compile for some other environment? MacPorts does include several ports of binutils for cross compilation.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340
  • indeed ; my long term goal is to do cross-compilation, of course. But at first I wanted to try the "native platform" target, in order to get familiar with the programming model and all that. However it looks more and more like "native" means "GNU/linux" and only "GNU/linux" :-( – Gyom Oct 24 '09 at 18:28
  • It looks like you're right; they appear to need a GNU toolchain, which generally means Linux or Cygwin. You can always install Linux to a virtual machine. I've had good luck installing Ubuntu server edition (as it's lighter weight than the desktop edition, not including the all the desktop software) onto a VirtualBox VM http://www.virtualbox.org/ for a quick and easy free Linux VM. – Brian Campbell Oct 24 '09 at 19:47
  • Yep, thanks for your help. I'm now starting to play with debian in a virtualbox. after all, it will probably be cool to have a linux environment at hand as well. – Gyom Oct 26 '09 at 13:49
2
$ port info binutils
(…) Tools are prefixed with g to avoid conflicts with original tools. (…)
zoul
  • 102,279
  • 44
  • 260
  • 354
  • Sure, but : % ls /opt/local/var/macports/software/binutils/2.19_0/opt/local/bin gaddr2line gnm granlib gstrings gar gobjcopy greadelf gstrip gc++filt gobjdump gsize – Gyom Oct 23 '09 at 12:36
  • % ls /opt/local/bin/gld ls: /opt/local/bin/gld: No such file or directory – Gyom Oct 23 '09 at 12:37
  • 1
    long story short, everything is there *but* ld, hence my question. – Gyom Oct 23 '09 at 12:38
  • 1
    Aha, you’re right. I’ve just installed binutils and have no gld either. Sorry for the false trace. – zoul Oct 23 '09 at 14:15
  • 1
    No worries :-) but do you know what's wrong with them ? Why on earth won't binutils install "ld" ?? – Gyom Oct 23 '09 at 22:11