http://bjoernstechblog.rueffer.info/posts/macports/mac/2012/11/08/fixing-broken-macports-package/
last updated on 25 May 2018

08 November 2012

fixing broken macports package

After some recent macports upgrade pdftk and ImageMagick’s convert staterted to abort with an error message that the function malloc had failed due to some object pointer being freed that hadn’t been allocated beforehand. It looked like this:

pdftk(1088,0x7fff70ea8cc0) malloc: *** error for object 0x10418c880: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap

How to fix this? I tried to up- and downgrade various packages without much strategy at first, which produced some packages that wouldn’t build at all any more. I finally resorted to removing all outdated and obsolete packages and upgrading everything to the newest binary versions. But still, the malloc error would persist. Then the final solution was to switch to slightly outdated version of gcc using

port select --list gcc
port select --set gcc mp-gcc45

and then rebuilding pdftk and its dependencies from scratch using

sudo port -s upgrade --force pdftk

(Be aware that this last command will take quite some time, as a lot of packages will be recompiled from scratch.) And apparently that did the trick.

Comments (through old commenting system)

Allan Peda, 03 October 2013: 

Trying now... how did people get along without google... I think pdftk was working until I decided to install some additional packages.

Anyhow thanks for posting your fix.

Björn Rüffer — Copyright © 2009–2018 — bjoern.rueffer.info