C\C++, Mac, Tools

Resolving symbols conflict between libraries on OSX with objcopy

Recently I had to deal with symbols conflict between C\C++ libraries and found this solution on stackoverflow:

In order to solve the issue on a mac it’s a bit you’ll need to run objcopy… but there’s no objcopy available on osx!!!

I worked around it and installed homebrew, a package manager for osx that reminds me ubuntu’s apt.

Homebrew is VERY easy to install, just copy\paste the ruby script on your terminal and it’ll download and install everything you need. Moreover it’s the cleanest solution I found so far on a mac because it’s installing ONLY on its directory (and you can choose the directory where you want it set up).

Actually there is no brewed formula to install objcopy and objdump (“brew search objcopy” returns nothing) but there’s a formula named “crosstool-ng” which is installing “gobjcopy” and “gobjdump” which are actually the same programs!

So just type

brew install crosstool-ng

on your shell and, when you’re done, edit your ~/.profile adding the following

alias objcopy="gobjcopy"
alias objdump="gobjdump"

to create aliases to those programs.

Now you’ve objcopy and objdump on your mac 😉