Skip to content
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

Fix linking error on 32 bit architectures #53

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

ellert
Copy link
Contributor

@ellert ellert commented Nov 1, 2024

undefined reference to `XrdOssDF::pgRead(void*, long, unsigned int, unsigned int*, unsigned long long)'
undefined reference to `XrdOssDF::pgWrite(void*, long, unsigned int, unsigned int*, unsigned long long)'

Xrootd is compiled using -D_FILE_OFFSET_BITS=64. This means that the second parameter in pgRead/pgWrite, which is declared as off_t in xrootd's headers, is a long long on 32 bit architectures. Without -D_FILE_OFFSET_BITS=64 the off_t is a long and there is a mismatch which leads to a linking error.

Add -D_FILE_OFFSET_BITS=64 to the compiler definitions so that the compilation uses the same off_t definition as xrootd does during compilation.

undefined reference to `XrdOssDF::pgRead(void*, long, unsigned int, unsigned int*, unsigned long long)'
undefined reference to `XrdOssDF::pgWrite(void*, long, unsigned int, unsigned int*, unsigned long long)'

Xrootd is compiled using -D_FILE_OFFSET_BITS=64. This means that the
second parameter in pgRead/pgWrite, which is declared as off_t in
xrootd's headers, is a long long on 32 bit architectures. Without
-D_FILE_OFFSET_BITS=64 the off_t is a long and there is a mismatch
which leads to a linking error.

Add -D_FILE_OFFSET_BITS=64 to the compiler definitions so that the
compilation uses the same off_t definition as xrootd does during
compilation.
@bbockelm
Copy link
Collaborator

bbockelm commented Nov 4, 2024

@ellert - while I'm happy to take the PR as-is, it seems like this is something we should inherit from xrootd itself (as opposed to discovering and hand-copying flags one-by-one).

@amadio - Is there something existing that we could leverage? I see XRootDConfig.cmake shipped (at least on RHEL-derived systems) but it doesn't seem to set -D_FILE_OFFSET_BITS=64.

@amadio
Copy link

amadio commented Nov 5, 2024

I agree with @bbockelm, we set -D_FILE_OFFSET_BITS=64 in all builds for XRootD, so we need to make sure to propagate it to our reverse dependencies to ensure they compile with the same options.

@bbockelm bbockelm self-requested a review November 25, 2024 03:23
Copy link
Collaborator

@bbockelm bbockelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Added a small note so we know when this workaround can be removed.

@bbockelm bbockelm merged commit 6af10e9 into PelicanPlatform:main Nov 25, 2024
3 checks passed
@ellert ellert deleted the offset-bits-64 branch November 25, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants