Building and running root on Mac OSX 10.8 (Mountain Lion)

Hi All,

I upgraded my Mac to Mountain Lion not too long ago.
I would like to build and use root 5.34/02 on it but
I’m having trouble. The distribution builds after
running config with this

./configure macosx --enable-roofit --disable-xrootd

with no errors as far as I can tell. I then set up
the environment in my tcsh by doing

source bin/thisroot.csh

When I try to load and compile anything, I get tons
of warnings and errors. Here’s a trivial piece of
code for example in a file called roottest.c

=================================
#include "TH1F.h"
void roottest() {
TH1F* htest = new TH1F(“htest”,“test hist”, 10, 0., 10. ) ;
htest->Draw() ;
}

When I try to load it, this is what I get:


root [0] .L roottest.c+
Info in TUnixSystem::ACLiC: creating shared library /Users/owen/work/cms/hadronic-susy-bjets/UserCode/SusyAnalysis/RA2b/Statistics/3Dcode/./roottest_c.so
Note: File “/root_v5.34.02.source/root-bad2/lib/libThread.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libRIO.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libThread.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMathCore.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMathCore.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMathCore.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMathCore.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMatrix.so” already loaded
Note: File “/root_v5.34.02.source/root-bad2/lib/libMathCore.so” already loaded
Undefined symbols for architecture i386:
“TH1F::TH1F(char const*, char const*, int, double, double)”, referenced from:
roottest() in roottest_c_ACLiC_dict.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in : Compilation failed!
root [1]

Needless to say, when I load something nontrivial I get many more "already loaded"
warnings and undefined symbols for all of the root classes used in the code.
It looks like something very basic in my setup is wrong, but I can’t find
the problem. Any help would be appreciated. I’ve been running root on
my macs for years with no trouble. I’m not a big fan of Mountain Lion.
It was a downgrade in my opinion.

Here are some details of my setup, in case any of this is relevant.

I’m at CERN this week and next, so if there’s an expert here that
can help by looking at the laptop, I’d be happy to set up a time
and bring it to you, if that would be easier than exchanging emails.

Thanks,
Owen

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Root distribution: root_v5.34.02.source.tar

Hardware: MacBook Pro, 2.4 GHZ Intel Core i5

Operating system: OS X, Version 10.8.2

XQuartz 2.7.3 (xorg-server 1.12.4)

Xcode: Version 4.5.1 (4G1004)

clang -v
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

uname -a
Darwin pb-d-128-141-230-236.cern.ch 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

Output of printenv in tcsh after sourcing bin/thisroot.csh

REMOTEHOST=
TERM=xterm-color
HOST=pb-d-128-141-230-236.cern.ch
SHELL=/bin/tcsh
CLICOLOR=yes
TMPDIR=/var/folders/nl/wf200gv16bvc97970ljy0scr0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-l06yHr/Render
CVSROOT=:ext:owen@cmssw.cvs.cern.ch:/local/reps/CMSSW
SVN_EDITOR=vim
GROUP=staff
USER=owen
COMMAND_MODE=unix2003
HOSTTYPE=intel-mac
SSH_AUTH_SOCK=/tmp/launch-yyxiqH/Listeners
Apple_Ubiquity_Message=/tmp/launch-v7X7A8/Apple_Ubiquity_Message
__CF_USER_TEXT_ENCODING=0x1F5:0:0
LSCOLORS=ExGxFxdxCxDxDxhbadExEx
PATH=/root_v5.34.02.source/root/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin/:/usr/local/bin:/Users/owen/bin:/Users/owen/perl:/opt/local/bin:/usr/X11R6/bin:/Users/owen/work/cms/tdr-svn/utils/trunk:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/opt/X11/bin:/usr/texbin/:/usr/local/bin:/Users/owen/bin:/Users/owen/perl:/opt/local/bin:/usr/X11R6/bin:/Users/owen/work/cms/tdr-svn/utils/trunk:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/usr/texbin/:/usr/local/bin:/Users/owen/bin:/Users/owen/perl:/opt/local/bin:/usr/X11R6/bin:/Users/owen/work/cms/tdr-svn/utils/trunk:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
PWD=/root_v5.34.02.source/root
TEXINPUTS=/Users/owen/latex//:
HOME=/Users/owen
SHLVL=5
OSTYPE=darwin
VENDOR=apple
MACHTYPE=x86_64
LOGNAME=owen
CVS_RSH=ssh
DISPLAY=/tmp/launch-27QxhB/org.macosforge.xquartz:0
X11_PREFS_DOMAIN=org.macosforge.xquartz.X11
_=/opt/X11/bin/xterm
WINDOWID=18874381
XTERM_VERSION=XTerm(281)
XTERM_LOCALE=C
XTERM_SHELL=/bin/tcsh
ROOTSYS=/root_v5.34.02.source/root
LD_LIBRARY_PATH=/root_v5.34.02.source/root/lib
DYLD_LIBRARY_PATH=/root_v5.34.02.source/root/lib
SHLIB_PATH=/root_v5.34.02.source/root/lib
LIBPATH=/root_v5.34.02.source/root/lib
PYTHONPATH=/root_v5.34.02.source/root/lib
MANPATH=/root_v5.34.02.source/root/man:/opt/local/share/man:/usr/share/man:/usr/local/share/man:/opt/X11/share/man:/usr/texbin//man:/usr/X11R6/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man

The “macosx” architecture is a 32-bit one (“i686”). It seems to me that you need to configure and build your ROOT for the “macosx64” architecture, which is a 64-bit one (“x86_64”).
Note also, you may need to install your ROOT as the “root user” (i.e. a “superuser”), if you set the ROOT’s “prefix”:
sudo make install
See also (notice remarks about the ROOT’s “etcdir”):
[url]ROOTSYS and linux distribution installation
[url]Problems installing root with --prefix=$HOME/.local
[url]Release 5.32.03 on Ubuntu 12.04
BTW. Try to take the current “v5-34-00-patches” branch source code directly from the ROOT’s svn (it contains many fixes as compared to the frozen “v5-34-02” distribution).

[quote=“Wile E. Coyote”]The “macosx” architecture is a 32-bit one (“i686”). It seems to me that you need to configure and build your ROOT for the “macosx64” architecture, which is a 64-bit one (“x86_64”).
Note also, you may need to install your ROOT as the “root user” (i.e. a “superuser”), if you set the ROOT’s “prefix”:
sudo make install
See also (notice remarks about the ROOT’s “etcdir”):
[url]ROOTSYS and linux distribution installation
[url]Problems installing root with --prefix=$HOME/.local
[url]Release 5.32.03 on Ubuntu 12.04
BTW. Try to take the current “v5-34-00-patches” branch source code directly from the ROOT’s svn (it contains many fixes as compared to the frozen “v5-34-02” distribution).[/quote]

Thanks for the suggestions. I tried rebuilding with “macosx64” doing everything else the same and I get the same problems. I’m not using “prefix” or installing it anywhere after the build. I never have in the past. I point to the place where it was built by sourcing bin/thisroot.csh. Is that necessary now?

[quote=“owen”]I point to the place where it was built by sourcing bin/thisroot.csh. Is that necessary now?[/quote] What do you actually mean here? For me, “to build” means to run “make” (after the “configure” step). Once it is built, you do need to “source bin/thisroot.[c]sh” in the terminal window in which you want to use it. See the “Location independent installation” entry in the “Installing ROOT from Source”.
BTW. The annoying “libSomeRootLibrary.so already loaded” warnings were fixed several weeks ago in the the “trunk” and in the “v5-34-00-patches” branch.

[quote=“Wile E. Coyote”][quote=“owen”]I point to the place where it was built by sourcing bin/thisroot.csh. Is that necessary now?[/quote] What do you actually mean here? For me, “to build” means to run “make” (after the “configure” step). Once it is built, you do need to “source bin/thisroot.[c]sh” in the terminal window in which you want to use it. See the “Location independent installation” entry in the “Installing ROOT from Source”.
BTW. The annoying “libSomeRootLibrary.so already loaded” warnings were fixed several weeks ago in the the “trunk” and in the “v5-34-00-patches” branch.[/quote]

Yes, I was using “build” to mean executing make and “point to” to mean setting all the environment variables by sourcing thisroot.csh.

I think I found a solution to the problem. I tried doing everything from a directory in my user account (i.e. /Users/owen) instead of from the root directory of the filesystem (i.e. /). The normal procedure of configure, make, source thisroot.csh, use root now works when I do it that way.

For the record, the problem I was seeing has something to do with how I set up the directory where I unpacked the distribution tar file. In Mountain Lion, user accounts no longer have permission to write to / (even ones with administrator privileges) so I made a directory there (/root_v5.34.02.source) and used sudo chown owen /root_v5.34.02.source, unpacked the distribution source inside there, and then built it there so that my resulting ROOTSYS was /root_v5.34.02.source/root. It seems that somehow fouled things up.

Thanks for the suggestions.

Owen