Dictionary issue on macOS (with conda Root ?)

When compiling a Root-dependent library, that has a dictionary, I run into issues when trying to access the library-defined objects :

root [1] gSystem->Load("./libKM3NeTROOT.dylib");
root [2] KM3NETDAQ::JDAQHit j;
In file included from G__KM3NeTROOT dictionary payload:1037:
In file included from /Users/laurent/git.km3net.de/common/km3net-dataformat/build-release/km3net-dataformat/online/JDAQHit.hh:9:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/in.h:81:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:561:30: error: unknown type name 'msg_namelen'
        void            *__sized_by(msg_namelen) msg_name; /* [XSI] optional address */
                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:561:42: error: expected ';' at end of declaration list
        void            *__sized_by(msg_namelen) msg_name; /* [XSI] optional address */
                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:565:30: error: unknown type name 'msg_controllen'
        void            *__sized_by(msg_controllen) msg_control; /* [XSI] ancillary data, see below */
                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socket.h:565:45: error: expected ';' at end of declaration list
        void            *__sized_by(msg_controllen) msg_control; /* [XSI] ancillary data, see below */
                                                   ^
Error in <TInterpreter::AutoParse>: Error parsing payload code for class KM3NETDAQ::JDAQHit with content:

#line 1 "G__KM3NeTROOT dictionary payload"

... snip ...

This is with Root 6.32.10, on macOS15.5. But I guess the important piece of information is that the Root used is installed using conda (micromamba). On the same macOS machine, using a Root built with e.g. Spack, and the same way of building the library, the error does not appear (also not happening on e.g. a Linux machine).

Looks somehow related to the compiler used in the conda env ?
Is this a “known” issue ? Any way to overcome it ?

Thanks,

Hi @laurent.aphecetche,
Thank you for sharing your findings.
@couet, did you encounter this issue on MacOS before?

No, I never saw that. May be @devajith has an idea ?

Did you try removing the #include <netinet/in.h> line from JDAQHit.hh?

(since it seems it’s not directly used by that file)?

Thanks for the suggestion.
This indeed could solve the issue, but some client code might depend on this include (not a good thing, I know, but still might happen…), so I was wondering if there’s a way to solve this without actually changing the code.