Compilation error on Mac OS w/ sysinfo.h (fixed now)

REST version : v2.2.16

I haven’t updated REST for a while and ran into the following error when I did:

REST_v2/source/processes/util/src/TRestBenchMarkProcess.cxx:4:10: fatal error: ‘sys/sysinfo.h’ file not found

The (Linux) sysinfo man page says about sysinfo:

CONFORMING TO
This function is Linux-specific, and should not be used in programs intended to be portable.

I don’t think this will build on any Mac now, but I used to be able to. Is that an intentional change?

Hi, it is a long time ago that I do not compile myself on MacOs. We lost compatibility some time ago. You are not the first to ask about compilation in MacOs. I hope we can recover REST-MacOs compatibility soon.

I have bypassed the use of sysinfo.h in MacOs. I was just able to compile. I committed to v2.2.16_dev branch.

I had also to remove from CMakeLists.txt a library -lMathMore. Didn’t you? I use ROOT 6.20.00

Be aware that we haven’t tested running REST in MacOs for a while, there might be other problems related to MacOs. It would be good to know if you get other troubles.

Ops, I still find problems compiling in MacOs in the latest v2.2.16_dev. It was not the case in master.

The compilation problems on MacOs were solved after I reverted the following commits locally.

commit 2d8d0d70b1596ff53ad008b5d9d60ad2f15666bb (HEAD -> v2.2.16_dev)
Author: Javier Galan <j.a.galan.81@gmail.com>
Date:   Sun Apr 5 12:46:03 2020 +0200

    Revert "TRestHitsEvent: Added method Sort() using std::sort, added method Shuffle(). removed method RemoveHits()"
    
    This reverts commit ed5a5c270e8397cbc1e4a936a64b80dd942e3406.

commit 6a7eae0aa92a4f8d5258ae30ecff263c475c62bc
Author: Javier Galan <j.a.galan.81@gmail.com>
Date:   Sun Apr 5 12:45:19 2020 +0200

    Revert "TRestHits: major update, implemented iterator!"
    
    This reverts commit 0ef8aea4c408c4964542a51c50fbb1a2fb734e22.

Those commits were introduced recently @nkx. I get the following error output message when executing make

[ 37%] Building CXX object source/events/CMakeFiles/RestEvents.dir/analysis/src/TRestTrack.cxx.o
In file included from /Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:40:
In file included from /Users/javi/git/rest/source/events/general/inc/TRestHitsEvent.h:5:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:505:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:176:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:3860:17: error: no viable overloaded '+='
            __m += __delta;
            ~~~ ^  ~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:4018:5: note: in instantiation of function template
      specialization 'std::__1::__sort<(lambda at /Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:158:19) &,
      TRestHits::TRestHits_Iterator>' requested here
    __sort<_Comp_ref>(__first, __last, __comp);
    ^
/Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:157:14: note: in instantiation of function template
      specialization 'std::__1::sort<TRestHits::TRestHits_Iterator, (lambda at
      /Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:158:19)>' requested here
        std::sort(fHits->begin(), fHits->end(),
             ^
/usr/local/include/TString.h:473:21: note: candidate function not viable: no known conversion from 'TRestHits::TRestHits_Iterator'
      to 'std::string &' (aka 'basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument
inline std::string& operator+=(std::string &left, const TString &right)
                    ^
In file included from /Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:40:
In file included from /Users/javi/git/rest/source/events/general/inc/TRestHitsEvent.h:5:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:505:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:176:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:3860:17: error: no viable overloaded '+='
            __m += __delta;
            ~~~ ^  ~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:4018:5: note: in instantiation of function template
      specialization 'std::__1::__sort<bool (*&)(const TRestHits::TRestHits_Iterator &, const TRestHits::TRestHits_Iterator &),
      TRestHits::TRestHits_Iterator>' requested here
    __sort<_Comp_ref>(__first, __last, __comp);
    ^
/Users/javi/git/rest/source/events/general/src/TRestHitsEvent.cxx:162:14: note: in instantiation of function template
      specialization 'std::__1::sort<TRestHits::TRestHits_Iterator, bool (*)(const TRestHits::TRestHits_Iterator &, const
      TRestHits::TRestHits_Iterator &)>' requested here
        std::sort(fHits->begin(), fHits->end(), comparecondition);
             ^
/usr/local/include/TString.h:473:21: note: candidate function not viable: no known conversion from 'TRestHits::TRestHits_Iterator'
      to 'std::string &' (aka 'basic_string<char, char_traits<char>, allocator<char> > &') for 1st argument
inline std::string& operator+=(std::string &left, const TString &right)
                    ^
2 errors generated.
make[2]: *** [source/events/CMakeFiles/RestEvents.dir/general/src/TRestHitsEvent.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [source/events/CMakeFiles/RestEvents.dir/all] Error 2
make: *** [all] Error 2

I have added the missing operator. Hopes now it works smoothly

1 Like

Yes, that solves the compilation problem. Thanks!

Thank you both for looking into the problem! I didn’t encounter any problems with the -lMathMore library, no. In any case, I was now able to compile REST successfully with the latest updates, so the problem is fixed.