-
Notifications
You must be signed in to change notification settings - Fork 27
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
C++ runtime should not be hardcoded in configure #165
Comments
UPD. Surprisingly, some runtime flag is still required for w/e reason: just trashing it breaks linking. |
Indeed, this is why we are transitioning to Meson. The autotools build system was originally written only for Linux. I'ts tricky to do this correctly on Mac with autotools as by default gcc is a symlink to clang on macOS (who thought that was a good idea?). |
Replacing the flag with |
Thanks @barracuda156, we can definitely do that. |
I'm not sure this is ideal either. On Linux it is perfectly normal to use clang with libstdc++. I'd say on most distributions that is the default. Usually libc++ is even a seperate package, so you may not even have libc++ installed when using clang, which will break with that rule above. I think ideally autotools would figure out which C++ standard library is used when linking with |
@mjacobse It is also possible to use Anyway, the patch so far does not work for Clang anyway. And I agree with you, the right thing is to test for C++ runtime being used, not compiler. Going by compiler is an acceptable heuristic fixing typical scenarios, but leaving some other cases broken. |
For the record, with the right library being set (as of now, we just patch it in for Clang builds), |
Yeah I agree that ideally we should test for the C++ runtime but I have no idea if that is even possible with autotools let alone how to do it. |
@jfowkes Maybe solve it another way: why at all an explicit flag is needed at the moment? It is needed indeed, but it should not be. Normally you never have to pass this flag manually, not on macOS at least. |
@barracuda156 that is a good point but I believe it is mandatory when the Fortran compiler is used to link everything together at the end (cf your link failures in #170). SPRAL is very unusual in its mixing of Fortran and C++. |
@jfowkes I do remember errors I got, and those surprised me. We have multiple ports which use Fortran, and quite a number of them use it together with C++. I do not recall cases where this flag was needed (this does not mean there are none, but IMO it is at least uncommon). FWIW, LLVM documentation states it should not be required: https://releases.llvm.org/5.0.0/projects/libcxx/docs/UsingLibcxx.html (the statement is inaccurate in a sense of ignoring earlier versions of macOS and FreeBSD, but on those |
As far as i know the issue is that both the C++ and the Fortran standard library are required. When linking with the Fortran compiler, only the Fortran standard library will be linked automatically, the C++ one has to be linked manually/explicitly. When linking with the C++ compiler instead, only the C++ one will be automatic but the Fortran one needs to be added manually/explicitly. But that might actually be an idea. If we link with the C++ compiler instead, then libstdc++ or libc++ will be figured out automatically. Now we "only" need to collect the correct Fortran libraries, which is perhaps easier? |
@mjacobse I believe, default Fortran will be |
For the flags to link the Fortran runtime libs, there is macro AC_FC_LIBRARY_LDFLAGS With shared libs, neither one nor the other should be necessary, but with static libs, I think so. |
@mjacobse in theory linking with the C++ compiler instead would be easier but trying to figure out the correct Fortran libraries for something as complicated as Intel OneAPI would be rather tricky. |
I opened a PR to update the Meson build system: #181 |
Just in case, in the latest release (2024.01.18), it is still unfixed:
|
Did you compile with the Meson build system? |
Ok, got it. No, we build it with autotools at the moment. |
This will be wrong for most set-up of macOS:
As well as some other systems, which happen to use
libc++
(but notifort
fortran).The text was updated successfully, but these errors were encountered: