5-30-01 compilation on Lion with GCC 4.6

Hi,

I’m having a bit similar problem as what’s being discussed here: ROOT 5.30 does not compile with gcc 4.61?

Under Lion I switched to using the Fink-installed GCC 4.6 instead of the XCode 4.1 version of GCC, as I’ve had some problems with the latter. Using GCC 4.6 I was able to compile for instance ROOT 5.28f and also a version of v5-30-00-patches at one point.

But now, after I set up the compilation like this:

I get a compilation failure when compiling libAfterImage.

[quote]gcc-4 -m64 -O3 -DNO_DEBUG_OUTPUT -fPIC -Wall -mmmx -I/sw/include -I/sw/include -I/sw/include -I/sw/include/freetype2 -I/sw/include -c export.c -o export.o
export.c: In function ‘ASImage2xpm’:
export.c:279:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2xpmRawBuff’:
export.c:361:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2png_int’:
export.c:499:22: error: dereferencing pointer to incomplete type
export.c:493:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2jpeg’:
export.c:756:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2xcf’:
export.c:899:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2ppm’:
export.c:921:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2bmp’:
export.c:980:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2ico’:
export.c:1027:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2gif’:
export.c:1049:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable]
export.c: In function ‘ASImage2tiff’:
export.c:1253:2: warning: variable ‘started’ set but not used [-Wunused-but-set-variable][/quote]

I could avoid the problem by configuring the ROOT compilation with the --disable-asimage option, but in that case my interactive ROOT just broke. (I can’t even display a TBrowser like that.) However getting this ROOT version to compile would be a very welcome thing, as this is the first ROOT version with which I was able to successfully send a job to our university’s PROOF farm, and receive the output of the analysis. (This was failing with all the other ROOT versions under Lion so far.) But I don’t want to use a different ROOT version for sending off PROOF jobs and then to investigate the output file of my analysis…

I’ll try to fix the problem in export.c, but if others can do it more quickly, that would be very welcome.

Cheers,
Attila

Hi,

No joy yet. I thought I could easily find the source of the problem, but apparently not. I guess the problem comes from my libpng installation under /sw (the Fink version). I have these PNG packages installed with Fink at the moment:

[quote] libpng14 1.4.7-1 PNG image format handling library
i libpng14-shlibs 1.4.7-1 Shared libraries for libpng14 package
i libpng15 1.5.2-1 PNG image format handling library
i libpng15-shlibs 1.5.2-1 Shared libraries for libpng15 package
libpng3 1:1.2.44-2 PNG image format handling library
libpng3-shlibs 1:1.2.44-2 Shared libraries for libpng3 package
i system-pkgconfig-libpng 1.5.1-1 [virtual pkgconfig package representing libpng]
i system-pkgconfig-libpng 1.5.1-1 [virtual pkgconfig package representing libpng15][/quote]

Any ideas of which of these would work nicely with ROOT’s AfterImage library? As far as I can tell the failing export.c includes /sw/include/png.h, but apparently this include doesn’t bring in the declaration of the png_structp type. (As far as I can tell from the error message.)

Help would be very much appreciated!

Cheers,
Attila

Hi,

So, experimentation yields results. After I removed libpng15 from my system in favor of libpng14 (“fink install libpng14”), I was now able to build v5-30-01 successfully using GCC 4.6 on my Lion laptop. It seems to be the most usable ROOT version under Lion to date I should say. (All my applications are running smoothly with it, for the first time since I updated to Lion…)

Cheers,
Attila

Hi Attila and others,
I followed your advises and I managed to compile ROOT 5.30.01 in mac os LION 10.7.1 (with XCODE 4.1) using the GCC 4.6 compiler from FINK repositories. Good…
This was the configuration command I used:

However, I am still having the same problem where I got stuck in previous tries (with Xcode compilers), e.g. Linking problems when creating libraries or programs which use ROOT.
The error always comes at linking time. It complains about the following:

... (lots of output)
  "TGraph2DErrors::GetYminE() const", referenced from:
      vtable for TMGraph2DErrors in RootExtensionDict.o
  "TGraph2DErrors::GetZmaxE() const", referenced from:
      vtable for TMGraph2DErrors in RootExtensionDict.o
  "TGraph2DErrors::GetZminE() const", referenced from:
      vtable for TMGraph2DErrors in RootExtensionDict.o
  "TGraph2DErrors::Set(int)", referenced from:
      vtable for TMGraph2DErrors in RootExtensionDict.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libRootExtension.so] Error 1

Any ideas?
I could post here the source code of the program I am trying to build.
It is light.

Thanks in advance.

Hi,

for ROOT itself (including all its tests), there is no problem building it with the default clang++ compiler on Lion. All works. Now I don’t know about your own code, but for ROOT and ALL Apple programs clang works fine.

Concerning the linking errors:

  ...
  "TGraph2DErrors::Set(int)", referenced from:
      vtable for TMGraph2DErrors in RootExtensionDict.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libRootExtension.so] Error 1

make sure that you link libRootExtensions.so with all needed ROOT libraries. The linker options we use requires all symbols to be resolved at link time (this is a change from 5-28-00 on MacOS X).

Concerning the ASimage issue, see
http://root.cern.ch/viewvc?view=rev&revision=40326
for a fix made in export.c to handle the newer png 1.5.1 (coming with Lion). With this fix export.c compiles with the old 1.2 and 1.5 libpng. But I don’t know how this interacts with your Fink libpng versions.

Cheers, Fons.

Does this mean I need to add -lRootExtensions to the end of the output of

root-config --glibs

such that I get:
root-config --glibs
-L/Users/adam/softwareDev/root/v5.30.02/lib -lGui -lGpad -lHist -lGraf -lGraf3d -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lRIO -lNet -lThread -lCore -lCint -lpthread -Wl,-rpath,/Users/adam/softwareDev/root/v5.30.02/lib -lm -ldl -lRootExtensions

thanks,
Adam

Or put root-config --glibs after your libRootExtensions. Give it a try and see what works for you.

Cheers, Fons.