-
Notifications
You must be signed in to change notification settings - Fork 901
Configure script wrongly assumes -fPIC is not required in fortran integer size test #9890
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
Comments
@haampie Can you cite what versions of the compilers and/or platforms you're using? I ask because I'm running into difficulty trying to replicate on x86-64 RHEL 7 with recent-ish clang / gfortran:
|
Quickly tried on a few versions of Ubuntu: Works:
Fails:
Reproducer:
|
I think the problem is a bit bigger than this, for a few reasons. I'm still unable to replicate your results when I use the same versions as you of clang and gfortran on RHEL 7. These are clang and gcc/gfortran that I have built myself, and therefore don't have whatever OS package/build defaults you're getting on the Ubuntu images. Of course, I can replicate your results on the Ubuntu/docker command you provided. This says to me that there's something in the config of clang and/or gfortran at play here -- not just versions of the compilers. I do not know exactly what this is; it could be that the clangs I have built manually are defaulting to building PIC code...? (I've unfortunately spent a bunch of time on this already and don't have more time to chase down what the differences are) Additionally, even if I update Open MPI's Adding Finally, even if I manually hard-code a
I'll get the same Regardless, I think the solution you want may be as simple as:
|
On Ubuntu 20.04 (I didn't try the docker container above, but bare hardware), it would appear that the GNU compiler suite packaged by Ubuntu defaults to generating PIC (and therefore PIE) code, while the LLVM compiler suite packaged by Ubuntu does not. My test program is:
With GCC 9.3.0:
With LLVM 10.0.0:
So this is really a systems problem; Ubuntu shouldn't have the two compiler suites have different defaults for generating PIC/PIE code. It means that any time you're mixing object files (rather than using libraries) between the two compiler suites, you're going to run into trouble. Obviously, this problem is most evident in your case, because flang isn't where you want to be these days. Jeff's answer is right; this isn't a problem that Open MPI should be solving (blindly setting -fPIC has its own problems, and since this has come up once in 20 years, it is clearly not the common case). Given the easy workaround of setting CFLAGS/CXXFLAGS given the known situation you're in, that's the right answer. |
Thanks for double checking, I'll mention this thread with the MPICH folks too. Turns out, there's a report about this from 2016: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847554 but I don't see any follow up :( |
Uh oh!
There was an error while loading. Please reload this page.
This is an exact copy of an issue I had compiling MPICH.
When running configure on Open MPI v4.1.2 with clang as a C / C++ compiler and gcc as a Fortran compiler, I'm hitting the following:
The solution is to either drop
-O3
fromclang
or add-fPIE
toclang
.See here how MPICH solves it pmodels/mpich#5771 for reference.
See here for a reproducer:
conftest.c
conftest.f
this fails
this works
The text was updated successfully, but these errors were encountered: