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

Builds on 32bit systems fail due to violation of C++ one definition rule (ODR) #2032

Open
badshah400 opened this issue Jun 10, 2023 · 4 comments
Assignees
Milestone

Comments

@badshah400
Copy link

badshah400 commented Jun 10, 2023

Hi,
When building version the python modules for version 5.5.5 for openSUSE¹ on 32-bit systems (i586 specifically), we see builds failing due to multiple violation of the C++ ODR. These are reported thus:

[  114s]   [ 99%] Linking CXX shared library /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/build/lib.linux-i686-cpython-39/pyxrootd/libXrdPosixPreload.so
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:347:7: error: type ‘struct XrdPosixLinkage’ violates the C++ One Definition Rule [-Werror=odr]
[  114s]     347 | class XrdPosixLinkage
[  114s]         |       ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:347:7: note: a different type is defined in another translation unit
[  114s]     347 | class XrdPosixLinkage
[  114s]         |       ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:365:26: note: the first difference of corresponding definitions is field ‘Fseeko’
[  114s]     365 |       Retv_Fseeko      (*Fseeko)(Args_Fseeko);
[  114s]         |                          ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:365:26: note: a field of same name but different type is defined in another translation unit
[  114s]     365 |       Retv_Fseeko      (*Fseeko)(Args_Fseeko);
[  114s]         |                          ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:347:7: note: type mismatch in parameter 2
[  114s]     347 | class XrdPosixLinkage
[  114s]         |       ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/XrdPosix/XrdPosixPreload32.cc:76:24: error: ‘Xunix’ violates the C++ One Definition Rule [-Werror=odr]
[  114s]      76 | extern XrdPosixLinkage Xunix;
[  114s]         |                        ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/./XrdPosix/XrdPosixLinkage.hh:347:7: note: type ‘struct XrdPosixLinkage’ itself violates the C++ One Definition Rule
[  114s]     347 | class XrdPosixLinkage
[  114s]         |       ^
[  114s]   /home/abuild/rpmbuild/BUILD/xrootd-5.5.5/src/XrdPosix/XrdPosixLinkage.cc:56:17: note: ‘Xunix’ was previously declared here
[  114s]      56 | XrdPosixLinkage Xunix;
[  114s]         |                 ^
[  114s]   lto1: all warnings being treated as errors

We see no such problems with 64 bit builds however.

Our build uses the following libraries/compilers:

  • cmake 3.26
  • GCC 13.1.1
  • Python 3.9, 3.10, 3.11

Happy to supply any more information, if needed, to help debug and fix the issue. In the meanwhile, here is the full build log:
xrootd_i586_build_log.zip

Thanks in advance.

¹ We include commit 2401509 as a patch (lightly rebased to apply against 5.5.5) to get the python modules building. You may have a detailed look at our patches and build status here temporarily.

@amadio
Copy link
Member

amadio commented Jun 10, 2023

Thank you for the report, I will take a look at fixing this for 5.6, which will be released in the coming week or two.

@amadio amadio self-assigned this Jun 10, 2023
@amadio amadio added this to the 5.6 milestone Jun 10, 2023
@amadio amadio closed this as completed in d80fc70 Jun 15, 2023
@StefanBruens
Copy link

Removing LTO just makes it impossible for the linker to see the ODR violation, it still exists. Please reopen.

@StefanBruens
Copy link

The correct fix is to have distinct names for the XrdPosixLinkage struct/class, dependent on the XRDPOSIXPRELOAD32 define.

i.e. in XrdPosixLinkage.hh:

#if defined XRDPOSIXPRELOAD32
class XrdPosixLinkage32
#else
class XrdPosixLinkage
#endif
{...

and then use XrdPosixLinkage32 everywhere in XrdPosixPreload32.{hh,cc}

@amadio
Copy link
Member

amadio commented Jul 24, 2023

That makes sense. I'm reopening.

@amadio amadio reopened this Jul 24, 2023
@amadio amadio modified the milestones: 5.6.0, 5.6.3 Sep 18, 2023
@amadio amadio modified the milestones: 5.6.3, 5.7.0 Sep 27, 2023
@amadio amadio modified the milestones: 5.7.0, 6.0.0 May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants