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 😉

Advertisements

2 thoughts on “Resolving symbols conflict between libraries on OSX with objcopy

  1. FYI
    objcopy is actually in binutils and not crosstool-ng
    So it would only need

    brew install binutils

    Also homebrew dev on #machomebrew said that homebrew does not honor ~/.profile

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s