Troubleshooting ROOT Installation on MacOs

In summary, to install root on a MacOs system you need to either use 'brew install root' or add the -I flag to the gcc command when running the program.
  • #1
CAF123
Gold Member
2,948
88
ROOT is required as a pre-requisite for some software that I am trying to install. I'm on a MacOs system and I have tried to install using 'brew install root'. Do I need to do anything else? How can I check that root was successfully installed?

When I tried to install said software, apparently files in the root directory cannot be found, e.g. error

/usr/local/Cellar/root/6.22.06_1/etc/root/cling/lib/clang/5.0.0/include/assert.h:8:15: fatal error: 'assert.h' file not found

I have checked this manually and the file is there so I don't understand why it is not found. I also tried the following line in my .zshrc file

export PATH=$PATH:/usr/local/Cellar/root/6.22.06_1/etc/root/cling/lib/clang/5.0.0/include/assert.h

and

export PATH=$PATH:/usr/local/bin/thisroot.sh

Any ideas of what may be going wrong? Thanks in advance
 
Computer science news on Phys.org
  • #3
Hi jedishrfu, thanks for your reply
jedishrfu said:
The C compiler requires setting a command flag for include files usually the -I flag on the command line call.

https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

Basically adding the header to the PATH is the wrong approach.
I installed root via 'brew install root' and apparently:

'As of ROOT 6.22, you should not need the thisroot scripts; but if you depend on the custom variables set by them, you can still run them:

For bash users:
. /usr/local/bin/thisroot.sh
For zsh users:
pushd /usr/local >/dev/null; . bin/thisroot.sh; popd >/dev/null
For csh/tcsh users:
source /usr/local/bin/thisroot.csh
For fish users:
. /usr/local/bin/thisroot.fish'

I've tried also the zsh profile command (I have a .zshrc file) but it does not fix the problem. Could you elaborate on the -I flags you mentioned? I am running an installation script for a piece of software via ./ command. Do you mean I need to append this command by some -I flags? If so, could you show me an example of what such a flag might look like? Thanks !
 
  • #4
The -I flag is used with the cc or gcc command to indicate where certain header files are located.

Bash:
$$ gcc myprogram.c -o myprogram -I /usr/local/Cellar/root/6.22.06_1/etc/root/cling/lib/clang/5.0.0/include
 
  • #5
Thanks. Few comments:
1) In my case, I am running an installation script via ./ Does this mean I need to append this command with -I flags or just the line(s) in the script where gcc is used?
2) If the number of include files gets arbitrarily large then appending gcc myprogram.c with lots and lots of -I flags seems inefficient. Is there not some way to specify the directory of all these include files with a single command in a .zshrc file? This is what I had been trying to do before and, in particular, all sources I have read indicate that sourcing thisroot.sh is sufficient (and actually in root 6.22 even doing this is not required).
Thanks!
 
Back
Top