Wired2Code

Just another WordPress.com site

Installing latest gdb on Snow Leopard

Figures there would be a problem installing gdb on Snow Leopard using Macports. The error message was
libbfd.c: In function ‘bfd_get_b_signed_64’:

lipo: can’t figure out the architecture type of: …

Looking at the build log file shows gdb being built for i386 and x86_64. After a little poking around I found the culprit to be in
/opt/local/etc/macports/variants.conf

where when I initially installed Macports had enabled +universal (don’t recall why). So, comment out the +universal line and rebuilt gdb.

sudo port clean gdb
sudo port install gdb

Afterwards, the new gdb will be installed to

/opt/local/bin/fsf-gdb

 

Advertisements

October 11, 2010 Posted by | C++ Programming, gcc, Macports | , , , | Leave a comment

Installing latest gcc on Snow Leopard

I decided to install gcc 4.5.1 via Macports and the process didn’t exactly go smoothly. IIRC, the initial error was something about base_file.cc not being find. I’m not sure what caused the problem, however the fix was to temporarily rename the directory /opt/local to /opt/local-temp. The only packages installed in /opt/local/ are python 2.6, git, and Qt4.7.

So the basic steps if you have problems with the install using Macports is

cd /opt
mv local local-temp
sudo port clean gcc45
sudo port selfupdate
sudo port upgrade outdated
sudo port install gcc45

Towards the end of the build process there was another error about libpng being wrong or something. Simply reinstalling libpng via macports resolved the issue and allowed gcc finish building.

sudo port clean libpng
sudo port install libpng
sudo port install gcc45

Afterwards, rename /opt/local-temp to /opt-local.

If you type gcc –version at the command line the version install with XCode will probably run. This is because the Macports version is named gcc-mp-45. Using Macports install gcc_select.

sudo port install gcc_select

gcc_select –l will list the available versions of gcc, and gcc_select mp-gcc45 will make version 4.5 the default. This changes the symbolic link for /opt/local/bin/gcc. I also had to add the new symbolic link to /usr/local/bin/gcc (make a copy of the original) in order to get everything to work correctly.

October 11, 2010 Posted by | C++ Programming, gcc, Macports | , , , , , | 1 Comment