Compiling ROOT v5r34 on MAC with gcc

Hello!
Need advice in ROOT compiling. I’m trying to compile v5-34-34 on Mac (10.11.3). The challenge is to compile it with cmt and gcc. cmt+clang compiles in a right way, but when I try gcc it seems that some problem with openGL appears.

/usr/local/Cellar/gcc/5.3.0/bin/g++-5 -O2 -m64 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -DR__HAVE_CONFIG -pthread -I/usr/X11/include -I. -I/Users/suvorov/T2K/SOFT/stable/v11r31/ROOT/v5r34p34n00/Darwin/root/cint/cint/inc -o graf3d/gl/src/G__GL.o -c graf3d/gl/src/G__GL.cxx /usr/local/Cellar/gcc/5.3.0/bin/g++-5 -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name /Users/suvorov/T2K/SOFT/stable/v11r31/ROOT/v5r34p34n00/Darwin/lib/root/libRGL.5.so -O2 -m64 -mmacosx-version-min=10.11 -o lib/libRGL.5.34.so graf3d/gl/src/CsgOps.o graf3d/gl/src/TArcBall.o graf3d/gl/src/TF2GL.o graf3d/gl/src/TGL5D.o graf3d/gl/src/TGL5DDataSetEditor.o graf3d/gl/src/TGL5DPainter.o ------quite long list of libs---------- graf3d/gl/src/TPointSet3DGL.o graf3d/gl/src/TX11GL.o graf3d/gl/src/gl2ps.o graf3d/gl/src/G__GL.o -ldl -Llib -lCore -lCint -Llib -lGpad -lGraf3d -lGui -lGraf -lHist -lGed -lMathCore -lTree -lTreePlayer -lRIO -Llib -lFTGL -L/usr/local/lib -lGLEW -L/usr/X11R6/lib -lGLU -lGL -L/usr/X11R6/lib -lXpm -L/usr/X11R6/lib -lXext -lX11 -lm -compatibility_version 5 -current_version 5.34.34 Undefined symbols for architecture x86_64: "___GLXEW_ARB_multisample", referenced from: TGLFormat::InitAvailableSamples() in TGLFormat.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make[4]: *** [lib/libRGL.so] Error 1 /usr/local/Cellar/gcc/5.3.0/bin/g++-5 -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name /Users/suvorov/T2K/SOFT/stable/v11r31/ROOT/v5r34p34n00/Darwin/lib/root/libRGL.5.so -O2 -m64 -mmacosx-version-min=10.11 -o lib/libRGL.5.34.so graf3d/gl/src/CsgOps.o graf3d/gl/src/TArcBall.o graf3d/gl/src/TF2GL.o graf3d/gl/src/TGL5D.o graf3d/gl/src/TGL5DDataSetEditor.o graf3d/gl/src/TGL5DPainter.o ------quite long list of libs---------- graf3d/gl/src/TPointSet3DGL.o graf3d/gl/src/TX11GL.o graf3d/gl/src/gl2ps.o graf3d/gl/src/G__GL.o -ldl -Llib -lCore -lCint -Llib -lGpad -lGraf3d -lGui -lGraf -lHist -lGed -lMathCore -lTree -lTreePlayer -lRIO -Llib -lFTGL -L/usr/local/lib -lGLEW -L/usr/X11R6/lib -lGLU -lGL -L/usr/X11R6/lib -lXpm -L/usr/X11R6/lib -lXext -lX11 -lm -compatibility_version 5 -current_version 5.34.34 Undefined symbols for architecture x86_64: "___GLXEW_ARB_multisample", referenced from: TGLFormat::InitAvailableSamples() in TGLFormat.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make[4]: *** [lib/libRGL.so] Error 1 make[2]: *** [ROOT] Error 2 make[1]: *** [common_target] Error 2 make: *** [check_config] Error 2 #CMT---> Error: execution_failed : make

Here is configuration (CC=/usr/local/Cellar/gcc/5.3.0/bin/gcc-5 CXX=/usr/local/Cellar/gcc/5.3.0/bin/g+±5)
I’ve tried both with builtin glew and with pre-installed with homebrew (1.13.0) - got the same error. The reason of disabling cocoa is error with -Objc++ flag in gcc as -O is reserved for optimisation.

--with-cc=$CC \ --with-cxx=$CXX \ --with-ld=$CXX \ --disable-builtin-glew \ --with-glew-incdir='/usr/local/include/' \ --with-glew-libdir='/usr/local/lib/' \ --disable-cocoa \ --disable-afs \ --disable-alien \ --disable-builtin-afterimage \ --enable-builtin-ftgl \ --enable-builtin-freetype \ --enable-builtin-pcre \ --enable-builtin-zlib \ --disable-castor \ --disable-chirp \ --disable-cintex \ --disable-explicitlink \ --disable-fftw3 \ --enable-gdml \ --disable-gfal \ --disable-globus \ --disable-krb5 \ --disable-ldap \ --disable-monalisa \ --with-mysql-incdir=${MYSQL_INCLUDE_DIR} \ --with-mysql-libdir=${MYSQL_LIB_DIR} \ --disable-odbc \ --disable-oracle \ --disable-pgsql \ --disable-pythia6 \ --disable-qt \ --disable-qtgsi \ --disable-reflex \ --enable-roofit \ --enable-minuit2 \ --disable-ruby \ --disable-rfio \ --disable-rpath \ --disable-sapdb \ --disable-shadowpw \ --enable-soversion \ --disable-srp \ --disable-ssl \ --disable-table \ --enable-unuran \ --disable-winrtdebug \ --enable-gsl-shared \ --with-gsl-incdir=${GSL_INCLUDE_DIR} \ --with-gsl-libdir=${GSL_LIB_DIR}

I’m a bit confused that glew from homebrew seems to be OK, glew.h and glxew.h are both in /usr/local/include/GL/ and there is even a ‘problem’ definition in the second one:

So I completely don’t know what to try next.

Thank you,
Sergey.

Hi Sergey,

Are you sure you get the same with builtin glew? I’d belive that the one shipped with homebrew does not have GLX support. What do you get if you do nm on libGLEW built by root and the one in homebrew, as in (this is my 10.8 build of 5.34-patches branch with --disable-cocoa):

matevz@glut 5.34-patches> nm -gU lib/libGLEW.so | grep ARB_multisample
000000000004be98 S ___GLEW_ARB_multisample
000000000004c292 S ___GLXEW_ARB_multisample

Cheers,
Matevz

Thanks for answer.
I’ve discovered that even with --enable-builtin-glew ROOT doesn’t change libGLEW.so. So I have only glew from homebrew and, you are right, there is no GLXEW.

$ nm -gU libGLEW.so | grep ARB_multisample
000000000004ae88 S ___GLEW_ARB_multisample

So will check why it happens. Thank you for idea!

Grr, yes, I guess /usr/local somehow sneaks in before libGLEW gets its turn on the link line.

\m