# Linker problem with Mac OS 10.9 and libAfterImage

**URL:** <https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816>\
**Category:** ROOT\
**Created:** [October 29, 2013, 11:46am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816 "2013-10-29T11:46:04Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohma81](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@ohma81](https://root-forum.cern.ch/u/ohma81)\
**Post date:** [October 29, 2013, 11:46am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/1 "2013-10-29T11:46:04Z")

</div>

Hi,

I’m having problems compiling ROOT with the head version and following the instructions here: [http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=75](http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=75)

I also installed the latest XCode, the command-line tools and re-installed XQuartz.

The error message I get is:

```auto
clang++ -m64 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -stdlib=libc++ -pthread -Igraf2d/asimage/src/libAfterImage -I. -I/Users/stefanohm/Software/root/cint/cint/inc -o graf2d/asimage/src/G __ASImage.o -c graf2d/asimage/src/G__ ASImage.cxx
clang++ -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name @rpath/libASImage.so -O2 -m64 -mmacosx-version-min=10.9 -stdlib=libc++ -o lib/libASImage.so graf2d/asimage/src/TASImage.o graf2d/asimage/src/TASPluginGS.o graf2d/asimage/src/G__ASImage.o -ldl -Llib -lGraf -lMathCore lib/libAfterImage.a -L/Users/stefanohm/Library/Enthought/Canopy_64bit/User/lib -lfreetype -lz -L/usr/local/lib -L/usr/local/lib -ljpeg -lpng -lz -L/usr/X11R6/lib -lXpm -L/usr/X11R6/lib -lXext -lX11 -Llib -lCore -lCint
Undefined symbols for architecture x86_64:
  "_png_set_longjmp_fn", referenced from:
      _ASImage2png_int in libAfterImage.a(export.o)
      _png2ASImage_int in libAfterImage.a(import.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libASImage.so] Error 1
```

I have checked the png libraries in all folders and they are compatible with 64 and 32 bit, e.g.:

```auto
/usr/local/lib/libpng.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libpng.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/local/lib/libpng.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
```

Any help on how to resolve this is greatly appreciated.

[configure.txt](https://root-forum.cern.ch/uploads/default/original/2X/e/eba96512f2e0c0a43f284f722c41ce64599fb0e1.txt) (6.81 KB)

All the best, Stefan

---

<div class="post-metadata">

**Author:** ![paolafer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@paolafer](https://root-forum.cern.ch/u/paolafer)\
**Post date:** [October 29, 2013, 1:59pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/2 "2013-10-29T13:59:21Z")

</div>

Hi! I have a similar problem, I’d posted a question in less specific thread, on various issues with Mac OS 10.9: [viewtopic.php?f=3&t=17190&start=75#p73411](http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=75#p73411). Maybe this is a more appropriate thread.

Thanks for the help

Paola

---

<div class="post-metadata">

**Author:** ![ohma81](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/o/e9a140/32.png) [@ohma81](https://root-forum.cern.ch/u/ohma81)\
**Post date:** [October 29, 2013, 2:56pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/3 "2013-10-29T14:56:55Z")

</div>

[quote=“paolafer”]Hi! I have a similar problem, I’d posted a question in less specific thread, on various issues with Mac OS 10.9: [viewtopic.php?f=3&t=17190&start=75#p73411](http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=75#p73411). Maybe this is a more appropriate thread.

Thanks for the help

Paola[/quote]

I checked the linker again and the problem seems to be with the libpng library, which is shipped with the Canopy Enthought python distribution. This libpng library 64-bit only version. And this causes the compilation to fail.

Hope that helps.

Cheers, Stefan

---

<div class="post-metadata">

**Author:** ![paolafer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@paolafer](https://root-forum.cern.ch/u/paolafer)\
**Post date:** [October 29, 2013, 5:20pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/4 "2013-10-29T17:20:22Z")

</div>

Hi again, I haven’t solved my problem, but I’ ve found a way to overcome it.  
Since the makefile of the AfterImage library didn’t create the commands, for some reason, I executed by hand those commands, taken from another system where the compilation did work. I attach the file with these command, if anyone else should need them. After doing this, I could finish the compilation of ROOT without any other problem.

Update: although it compiled, I couldn’t look into histograms in a TBrowser(). I can open the TBrowser but when I click on the histogram, I get the following series of messages

## [code]\*\*\* Break \*\*\* bus error Generating stack trace…

## Warning: /usr/bin/atos is moving and will be removed from a future OS X release. It is now available in the Xcode developer tools to be invoked via: `xcrun atos` To silence this warning, pass the ‘-d’ command-line flag to this tool.

## 0x000000010380d5d2 in TGX11TTF::RenderString(int, int, TVirtualX::ETextMode) (in libGX11TTF.so) + 706

## Warning: /usr/bin/atos is moving and will be removed from a future OS X release. It is now available in the Xcode developer tools to be invoked via: `xcrun atos` To silence this warning, pass the ‘-d’ command-line flag to this tool.

## 0x0000000102cbd5e5 in TPad::PaintText(double, double, char const\*) (in libGpad.so) + 101

## Warning: /usr/bin/atos is moving and will be removed from a future OS X release. It is now available in the Xcode developer tools to be invoked via: `xcrun atos` To silence this warning, pass the ‘-d’ command-line flag to this tool.

0x0000000102a29eef in TLatex::Analyse(double, double, TextSpec\_t, char const\*, int) (in libGraf.so) + 46063

…

[/code]

I found a suggestion to fix to this problem in this thread

[http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=60](http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17190&start=60)

> [@tpochep](#):
>
> can you add #undef X\_DISPLAY\_MISSING at the beginning of ximage.c and will it change anything?

but that hasn’t worked. I’ve also looked in the graf2d/asimage/src/libAfterImage/config.h file and I don’t see any #define X\_DISPLAY\_MISSING. What else should I check?

Thank you

Paola  
[commands.txt](https://root-forum.cern.ch/uploads/default/original/2X/a/a482aa12994d068c79dfbe697072cb77a84847e7.txt) (14.3 KB)

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 2, 2013, 3:31pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/5 "2013-11-02T15:31:16Z")

</div>

Hi there,

I now see this error when running my code. Has anyone had success in dealing with this?

Cheers,  
Donal

---

<div class="post-metadata">

**Author:** ![paolafer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@paolafer](https://root-forum.cern.ch/u/paolafer)\
**Post date:** [November 3, 2013, 9:09am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/6 "2013-11-03T09:09:06Z")

</div>

Hello again,

I’ve updated the ROOT version to the changes of the last few days and I still have the same problem with libAfterImage.  
However, after compiling that library “by hand”, when I try to open a TBrowser in an interactive session I have another kind of error, repeated a lot of times:

`
libpng warning: Application was compiled with png.h from libpng-1.5.11
libpng warning: Application is running with png.c from libpng-1.2.50
libpng error: Incompatible libpng version in application and library
Warning in <TASImage::GetMask>: No image`

After that, sometimes there’s a crash, sometimes I can open the TBrowser() but not navigating the content for problems in the visualization and sometimes I can do everything. It looks a bit strange to me.

Cheers

Paola

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 3, 2013, 11:47am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/7 "2013-11-03T11:47:42Z")

</div>

Hi Paola,

Could you post details of how you compiled the library by hand, so that I can try the same thing?

Googling the new error you see, I get quite a few results. This thread suggests that you may not have set LD\_LIBRARY\_PATH correctly in your .bash\_profile:

[linuxquestions.org/questions … ng-840821/](http://www.linuxquestions.org/questions/linux-software-2/problem-with-libpng-840821/)

Have you got

export LD\_LIBRARY\_PATH=$ROOTSYS/lib:$LD\_LIBRARY\_PATH

in your .bash\_profile along with

export ROOTSYS=/usr/local/root/root.git  
export PATH=$PATH:$ROOTSYS/bin

(I’m not sure if the root.git at the end is needed in ROOTSYS)

Cheers,  
Donal

---

<div class="post-metadata">

**Author:** ![paolafer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@paolafer](https://root-forum.cern.ch/u/paolafer)\
**Post date:** [November 3, 2013, 12:24pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/8 "2013-11-03T12:24:22Z")

</div>

When I find the compilation error, I move to the graf2d/asimage/src/libAfterImage/ folder and I execute by hand the commands I attached in a previous post, by

```auto

```

It works, then I go back to the main ROOT folder and type

```auto

```

again. The installation ends normally (apparently).

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 3, 2013, 1:18pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/9 "2013-11-03T13:18:27Z")

</div>

Hi Paola,

I could run [commands.sh](http://commands.sh), but running ‘make’ did not work for me afterwards. Does your machine use clang when running make? Your [commands.sh](http://commands.sh) has gcc compiler instructions, so I’m wondering wheter that could be my problem. My Mac uses clang which I believe is the default.

Cheers,  
Donal

---

<div class="post-metadata">

**Author:** ![paolafer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@paolafer](https://root-forum.cern.ch/u/paolafer)\
**Post date:** [November 3, 2013, 1:25pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/10 "2013-11-03T13:25:59Z")

</div>

In my config.log I find the following checks:

```auto
Checking for C compiler
Result: clang
Checking for C++ compiler
Result: clang++
Checking for linker (LD)
Result: clang++
```

so I guess it’s using clang.

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 3, 2013, 1:52pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/11 "2013-11-03T13:52:13Z")

</div>

I’m not sure why it won’t work in my case, strange…

Just to document what I see currently, I get the error message:

\*\*\* Break \*\*\* bus error  
Generating stack trace…  
0x000000010d6ec5e2 in TGX11TTF::RenderString(int, int, TVirtualX::ETextMode) (in [libGX11TTF.so](http://libGX11TTF.so)) + 706  
0x000000010a980645 in TPad::PaintText(double, double, char const\*) (in [libGpad.so](http://libGpad.so)) + 101  
0x000000010a592fbf in TLatex::Analyse(double, double, TextSpec\_t, char const\*, int) (in [libGraf.so](http://libGraf.so)) + 46063  
0x000000010a594e23 in TLatex::PaintLatex(double, double, double, double, char const\*) (in [libGraf.so](http://libGraf.so)) + 4147  
0x000000010a57e91a in TGaxis::PaintAxis(double, double, double, double, double&, double&, int&, char const\*, double, bool) (in [libGraf.so](http://libGraf.so)) + 27274  
0x0000000151a3b376 in THistPainter::PaintAxis(bool) (in [libHistPainter.so](http://libHistPainter.so)) + 2102  
0x0000000151a3a23a in THistPainter::Paint(char const\*) (in [libHistPainter.so](http://libHistPainter.so)) + 1866  
0x000000010a97d369 in TPad::Paint(char const\*) (in [libGpad.so](http://libGpad.so)) + 601  
0x000000010a97d369 in TPad::Paint(char const\*) (in [libGpad.so](http://libGpad.so)) + 601  
0x000000010a9826d9 in TPad::Print(char const\*, char const\*) (in [libGpad.so](http://libGpad.so)) + 6121  
0x000000010a983a2d in TPad::SaveAs(char const\*, char const\*) const (in [libGpad.so](http://libGpad.so)) + 1021  
0x0000000108b44c1a in Fitting::RunFullFit(bool) (in run) (Fitting.C:1156)  
0x0000000108b357d9 in Fitting::Fitting(Parameters\*, TApplication\*) (in run) (Fitting.C:160)  
0x0000000108b2a974 in main (in run) (ostream:1180)  
0x00007fff910185fd in start (in libdyld.dylib) + 1  
0x0000000000000009 in

right at the point where my code attempts to draw stuff onto a TCanvas. It creates the TCanvas objects and I see them blank on my screen, but it crashes shortly after.

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 6, 2013, 11:11am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/12 "2013-11-06T11:11:17Z")

</div>

Sorry to bump this again. Has anyone seen the same issue and found a solution? I’m afraid I’m stuck between a rock and a hard place, where older ROOT versions will not compile on OS X 10.9 and the latest version gives the error I posted above when drawing to a TCanvas.

Any help would be greatly appreciated!

Donal

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 6, 2013, 5:59pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/13 "2013-11-06T17:59:03Z")

</div>

Hi Donal,  
I have exactly the same issue as you (and here are some other guys: [pyRoot on OS X Maverick](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/1)). My solution for now is a virtual machine.

edit: Batch mode still works.

---

<div class="post-metadata">

**Author:** ![dhill](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dhill/32/16961_2.png) [@dhill](https://root-forum.cern.ch/u/dhill)\
**Post date:** [November 7, 2013, 1:55pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/14 "2013-11-07T13:55:08Z")

</div>

Hi folks,

I’m glad to report that I have found another installation method which works for me. It uses Mac Ports.

The exact steps I followed to get it to work (by work I mean that ROOT installs correctly and my code compiles and runs without errors) are:

1. Uninstall homebrew (if you don’t have it, you don’t need to worry!). I followed [superuser.com/questions/203707/h … ge-manager](http://superuser.com/questions/203707/how-to-uninstall-homebrew-osx-package-manager)

2. Uninstall Mac Ports following [guide.macports.org/chunked/insta … lling.html](http://guide.macports.org/chunked/installing.macports.uninstalling.html)

3. Put the line below in /opt/local/etc/macports/variants.conf:

-x11 +no\_x11 +quartz +clang33

This I believe fixes the issues with x11 related stuff like the canvas printing.

1. Starting from a fresh install of Mac Ports, do:

sudo port install root

and give it some time 🙂

1. After it is finished (takes quite a while), I had to put in my .bash\_profile:

export ROOTSYS=/opt/local  
export PATH=$PATH:$ROOTSYS/bin  
export LD\_LIBRARY\_PATH=$ROOTSYS/lib:$LD\_LIBRARY\_PATH

If you have the line

export DYLD\_LIBRARY\_PATH=$ROOTSYS/lib:$DYLD\_LIBRARY\_PATH

remove it from your .bash\_profile too.

Several of these steps (like uninstalling homebrew and the reinstall of MAc Ports) may not be necessary, but I wanted to make sure that they weren’t conflicting in terms of libraries.

Best of luck!  
Donal

---

<div class="post-metadata">

**Author:** ![walkloud](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/76d3ee/32.png) [@walkloud](https://root-forum.cern.ch/u/walkloud)\
**Post date:** [February 15, 2014, 4:46am UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/15 "2014-02-15T04:46:07Z")

</div>

Hello,

I am having a similar problem with libAfterimage and mavericks. I tried compiling on my own, with the error

```
clang++ -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name @rpath/libASImage.so -O2 -m64 -mmacosx-version-min=10.9 -stdlib=libc++ -o lib/libASImage.so graf2d/asimage/src/TASImage.o graf2d/asimage/src/TASPluginGS.o graf2d/asimage/src/G__ASImage.o -ldl -Llib -lGraf -lMathCore lib/libAfterImage.a lib/libfreetype.a -lz -lz -Llib -lCore

```

Undefined symbols for architecture x86\_64:  
"\_TIFFClose", referenced from:  
\_ASImage2tiff in libAfterImage.a(export.o)  
\_tiff2ASImage in libAfterImage.a(import.o)

Then I tried homebrew with (first brew doctor and brew update say ready to go)  
brew install homebrew/science/root --with-cocoa --with-fftw -v  
which fails shortly after reporting  
/bin/rm -f libAfterImage.a  
"many .o files"  
ranlib libAfterImage.a  
"more stuff"  
Error: root did not build  
Logs:  
/Users/walkloud/Library/Logs/Homebrew/root/01.configure  
/Users/walkloud/Library/Logs/Homebrew/root/01.configure.cc  
/Users/walkloud/Library/Logs/Homebrew/root/02.make  
/Users/walkloud/Library/Logs/Homebrew/root/02.make.cc  
/Users/walkloud/Library/Logs/Homebrew/root/config.log

I attempted the above solution of sourcing the [commands.sh](http://commands.sh), but that did not help me. I am trying to manage all my software with homebrew, so I have not tried macports.

Thanks,  
Andre

---

<div class="post-metadata">

**Author:** ![Abi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/ec9cab/32.png) [@Abi](https://root-forum.cern.ch/u/Abi)\
**Post date:** [April 28, 2017, 6:56pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/16 "2017-04-28T18:56:32Z")

</div>

Hello. I’m experiencing this very problem (“Undefined symbols for architecture x86\_64:”) with root 5.34/05 and MacOS Sierra 10.12.4. By now is there a clean solution (like update to root 6 or something…)?

Thanks,  
Abi

---

<div class="post-metadata">

**Author:** ![Abi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/ec9cab/32.png) [@Abi](https://root-forum.cern.ch/u/Abi)\
**Post date:** [April 28, 2017, 7:01pm UTC](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/17 "2017-04-28T19:01:47Z")

</div>

I should note that I see this message:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]  
ld: warning: object file (/Users/Abi/Documents/Work/pheno/CPV in B to D\*\*taunu/simulation/BWInt2\_cxx\_ACLiC\_dict.o) was built for newer OSX version (10.12) than being linked (10.8)

Don’t know if it’s pertinent.

Thanks,  
Abi
