Error in program while compiling on Mac Sierra 10.13.1

Hello ROOTers

I recently switched to Mac OS which is working with Siera 10.13.1 version and gcc compiler informations given below.

**Shakeels-iMac:~ anuj$ gcc --version**
**Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1**
**Apple LLVM version 9.1.0 (clang-902.0.39.1)**
**Target: x86_64-apple-darwin17.3.0**
**Thread model: posix**
**InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin**

I tried to install root with the following commands
(1) $ xcode-select --install.
(2) $ sudo git clone https://github.com/root-mirror/root.git
(3) $ cd /usr/local/
(4) $ sudo chown -R “username” root
(5) $ cd root
(6) $ ./configure --all
(7) $ mkdir obj
(8) $ cd obj
(9) $ cmake …
(10)$ make -j 4

I feel ROOT was installed successfully. Because it did not show any error message after executing make command.

But when I compile my script then it shows some error messages which I don’t understand. Error messages are as follows:

Shakeels-iMac:Try anuj$ root
   -------------------------------------------------------------------
  | Welcome to ROOT 6.15/01                       http://root.cern.ch |
  |                                      (c) 1995-2018, The ROOT Team |
  | Built for macosx64                                                |
  | From heads/master@v6-13-04-197-g518c17fc9a, May 26 2018, 13:50:55 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'        |
   -------------------------------------------------------------------

root [0] .x nue-dyn-hydjet-anuj.C
**/Users/anuj/Desktop/Try/./nue-dyn-hydjet-anuj.C:54:8: error: redefinition of 'index' as different kind of symbol**
**        Int_t index = 0;**
**              ^**
**/usr/include/strings.h:73:7: note: previous definition is here**
**char    *index(const char *, int) __POSIX_C_DEPRECATED(200112L);**
**         ^**
root [1] 

I am clueless why this is giving this particular error?
I need someone’s suggestions.

Kind Regards
Cosmos

Please provide the following information:


ROOT Version (e.g. 6.12/02):
Platform, compiler (e.g. CentOS 7.3, gcc6.2):


Hi,

the commands you reported are somehow wrong and do not lead to a successful build of ROOT.
I propose to preserve (1) and then:
(2) git clone https://github.com/root-mirror/root.git
(3) mkdir build
(4) cd build
(5) cmake …/root
(6) make -j 4

Cheers,
Danilo

Thank You Danilo

For giving me reply on my issues. I followed the steps were shown while building after ./configure --all command. Next messages popped up in terminal are given below.

Shakeels-iMac:local anuj$ cd root/
Shakeels-iMac:root anuj$ ./configure --all

**ROOT is built with CMake, see https://root.cern/building-root**

** Please run**
** mkdir obj; cd obj; cmake …; make -j 4**

Shakeels-iMac:root anuj$

I followed the steps given above and root got built properly. But after using some of the codes they are giving errors while running with the latest version of ROOT installed on Mac OS High Sierra but compiled properly with the ROOT v5.34.18 installed on Fedora 20.

I tried with the ways you suggested but not getting built properly.

I don’t understand the message of ROOT to create obj directory after doing ./configure --all. As per ROOT instructions it is given as the way how you have mentioned. Please suggest me furthermore.

Thanks again

    &

Kind Regards
Anuj

**/Users/anuj/Desktop/Try/./nue-dyn-hydjet-anuj.C:54:8: error: redefinition of 'index' as different kind of symbol** 
** Int_t index = 0;** 
**         ^**
 **/usr/include/strings.h:73:7: note: previous definition is here** **char *index(const char *, int)
**char    *index(const char *, int)  __POSIX_C_DEPRECATED(200112L);**
**            ^**

You need to update your script to not use the name index for any variable because the interpreter already knows of a function by that name.

Dear pcanal

I have changed the index variable name. But now its still giving errors.

What are the errors you get? We’re traditionally terrible at guessing :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.