StRoot/StTriggerUtilities: replace sys/types.h with stdint.h#212
Conversation
Do we understand the conditions under which it does work? There is clearly a difference between the container and RACF environments since we don't see the problem there. |
I haven't looked, but my guess is that rootcint could pick up glibc headers installed from spack. |
|
Also, it's not like we never see the issue on RACF. Here is an error from Gene's email in the "StDbLib regression" email thread: |
|
Hongwei, it seems that we need your review/approval, particularly on the changes to the StHltMaker. Thanks |
Hi @starsdong , I have made a comment and waiting for reply. I have no problem to the code changes. However, I am a bit confused about the intention. If it is urgently needed, I have no problem to approve it. |
|
@kehw I don't see any comments by you in this PR.
There is no point in keeping several type naming conventions. The edits are quite straightforward and the substitutions themselves were performed using a script. |
|
@veprbl if you scroll up this page, you can see my questions. I agree that the code changes are quite straightforward and I have no problem on that. I am just a bit confused about what problem you are trying to solve. Did someone try to build it on macOS? I assume that is what is the macro __APPLE__ for. |
| **************************************************************/ | ||
| #ifdef __APPLE__ | ||
| #include <sys/types.h> | ||
| #endif |
There was a problem hiding this comment.
The header sys/types.h was removed at two locations. Both defined for APPLE. I do not see stdint.h included at any place and all other changes are deal with self-introduced typedef for unsigned short? May I know what problem is this PR trying to fix?
There was a problem hiding this comment.
Thank you for your review. The reason why the include is "not needed" on non-apple here is because the stdlib.h shipped with glibc happens to #include sys/types.h under the hood (by an accidental reason). This behavior is glibc-specific and likely will not work with another libc. The sys/types.h include should have been unconditional here, this works only by accident.
The reason why including stdlib.h will work with cint is because it provides its own stub for it (see cint/cint/include/stdlib.h) that doesn't include sys/types.h.
I am removing use of non-standard types coming from sys/types.h from entire codebase to ensure that even if people have not missed the failing sys/types.h include, we would still be able to remove it with confidence.
The practical problem here is that CINT is not able to work with modern libc's, as it's not compliant and outdated. There are alternative approaches we could take here, but that would require recompiling the ROOT5, or switching to ROOT6 entirely.
ROOT5/cint doesn't always work with sys/types.h, types from stdint are the ISO C standard