-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xrootd: fix missing byteswap.h error on MacOS build with gcc #1766
Conversation
Build bot error seems unrelated:
Our builds in Macports on Intel systems are fine. |
@barracuda156 I think that you would need to move your definition to XrdSys/XrdSysPlatform.hh |
The module in question is built only when GCC is used, Clang builds skip it, and since 10.7 Clang is the default compiler in Xcode and Macports – that is why no one noticed the error. So while the header in question is missing on MacOS generally, it is invoked only in one file, which I patched. But if you advise moving the definitions to |
@barracuda156 well, let's see what @simonmichal has to say .. |
@barracuda156 : thanks for the PR! I don't have any strong opinion about moving it to |
Just to note I am seeing this same build failure on macOS12 with Xcode clang, so it is not just affecting gcc builds. See attached build log. The previous 5.4.x version built fine, so this appears to be new with 5.5.0. |
erm, apologies, I should have checked the log better.... it seems the above is picking macports gcc to build. Need to investigate why that is... |
Thanks to barracuda156 for the fix. It seems XrdOssCsiTagstoreFile.hh(cc) is almost the only place in the xrootd code base which uses this functionality. (The exception being XrdOucCRC32C.cc, but this is almost Mark Adler's released code plain, so we may not want to adapt it with local changes to use XrdSysPlatform specifics). As it's something unique to TagstoreFile.hh I don't think it needs to be moved from TagstoreFile.hh. In the moment in it is needed elsewhere it could be moved to XrdSysPlatform.hh for a common location; although perhaps if we've had a history of multiple definitions of utility functions cropping up over time in the project, that could be a reason to forestall duplication by adding it to XrdSysPlatform now (I'll let Andy comment if he does feel that's a risk and something he'd like to avoid). The htonll mentioned in XrdSysPlatform.hh is not bswap in terms of htonll, but the other way around. Generally htonll need not be not the same as bswap_64, but on many platforms it is. The way that bswap_64/32 is used in TagstoreFile.hh/cc is that it expects a function that swaps in any case, it can't be substituted with htonll as written. |
@cjones051073 UPD: Ah, you refer to the attached log from another build. Normally Macports chooses Clangs for all Intel systems >10.6, though gcc can be chosen manually via Even though Clang is a default choice on Apple usually, GCC case should work too. For PPC it is also the only choice, since Clang is broken there. |
Indeed, we would not want to duplicate code and the particular definition
for the PPC Mac version (isn't that platform no longer supported?) would
rightly be placed in SysPlatform.hh. As for XrdOucCRC32C.cc, isn't it the
case that the code already takes care of this problem?
Andy
…On Mon, 5 Sep 2022, David Smith wrote:
Thanks to barracuda156 for the fix. It seems XrdOssCsiTagstoreFile.hh(cc) is almost the only place in the xrootd code base which uses this functionality. (The exception being XrdOucCRC32C.cc, but this is almost Mark Adler's released code plain, so we may not want to adapt it with local changes to use XrdSysPlatform specifics).
As it's something unique to TagstoreFile.hh I don't think it needs to be moved from TagstoreFile.hh. In the moment in it is needed elsewhere it could be moved to XrdSysPlatform.hh for a common location; although perhaps if we've had a history of multiple definitions of utility functions cropping up over time in the project, that could be a reason to forestall duplication by adding it to XrdSysPlatform now (I'll let Andy comment if he does feel that's a risk and something he'd like to avoid).
The htonll mentioned in XrdSysPlatform.hh is not bswap in terms of htonll, but the other way around. Generally htonll need not be not the same as bswap_64, but on many platforms it is. The way that bswap_64/32 is used in TagstoreFile.hh/cc is that it expects a function that swaps in any case, it can't be substituted with htonll as written.
--
Reply to this email directly or view it on GitHub:
#1766 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1
|
This is not specific to MacOS X PPC (we do support it in Macports though), but to a combination of MacOS X and GCC. What fails is GCC-only module: Line 63 in 7cc1184
So it gonna fail on every MacOS likewise, since that header is not there. |
Would it be possible to rebase this PR to the current xrootd master; doing so should clear the failing build check (which happens to be the one for macos)? |
Hi @barracuda156; thank you for the pull request. I have merged it, but due to an oversight the commit lost your author name (although the log message includes the reference to your repository). I'm sorry about that. |
@smithdh No issues, thank you for merging! |
This PR fixes a missing header error on MacOS when building with GCC.
Confirmed to fix the build on 10.6.8 with
gcc12
.Clang builds on latest MacOS versions are all good too: macports/macports-ports#15807 (checks pass).
Code borrowed from: https://gerrit.pixelexperience.org/plugins/gitiles/external_libtextclassifier/+/b23e2125be90bbf6124e9cd5684fc93026c5ec4d/util/base/endian.h