Skip to content

[vcpkg-ci-fortran] New test port#42754

Draft
dg0yt wants to merge 10 commits intomicrosoft:masterfrom
dg0yt:fortran
Draft

[vcpkg-ci-fortran] New test port#42754
dg0yt wants to merge 10 commits intomicrosoft:masterfrom
dg0yt:fortran

Conversation

@dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Dec 17, 2024

WIP

@JonLiu1993 JonLiu1993 added the category:infrastructure Pertaining to the CI/Testing infrastrucutre label Dec 17, 2024
@dg0yt
Copy link
Contributor Author

dg0yt commented Dec 18, 2024

As expected (from octave CI logs): vcpkg_find_fortran unexpectedly switches C and CXX compiler from MSVC to MinGW.

@Neumann-A
Copy link
Contributor

Neumann-A commented Dec 18, 2024

That is probably intentional since otherwise you cannot combine fortran and other languages object files into a single lib. At least if you use default gfortran in vcpkg

@dg0yt
Copy link
Contributor Author

dg0yt commented Dec 19, 2024

That is probably intentional

This is what I assume...

since otherwise you cannot combine fortran and other languages object files into a single lib [...] if you use default gfortran in vcpkg

... but I wonder if this is the right goal? This seems to clearly contradict the policy of "the triplet defines the (C/C++) compiler." It isn't allowed to change the compiler even for packages which more or less insist on clang(-cl) for windows.

And with MinGW C/C++, the implications are even more tricky IMO.

(AFAIU CMake promises some limited use of GFortran with MSVC in form of fortran libs being transformed to what is accepted by MSVC, but not to "combine fortran and other languages object files into a single lib".)

@Neumann-A
Copy link
Contributor

"the triplet defines the (C/C++) compiler."

historic reasons. The correct approach is displayed in #42129 and uses per port customization which avoids the rebuild of the whole tree via a conditional include and VCPKG_HASH_ADDITIONAL_FILES. However, that approach wasn't implementable in the past and would always require a whole rebuild of the tree if a single port required special behavior. As such the special behavior has been implemented into the portfile instead of the triplet to avoid a rebuild of the tree. Maybe it is time to remove the port special compiler behavior and move it into the triplet instead.

CMake promises some limited use of GFortran with MSVC in form of fortran libs being transformed to what is accepted by MSVC, but not to "combine fortran and other languages object files into a single lib

It has GNUtoMS which works not only for Fortran.

However, I wouldn't spend too much time on it since there seems to be some historic decision in the team to switch to flang as soon as it becomes readily available from llvm. (and then the GNUtoMS hack is no longer necessary)

@LilyWangLL LilyWangLL self-assigned this Apr 25, 2025
@vicroms vicroms added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. no-stale Issue will not be marked as stale labels Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:infrastructure Pertaining to the CI/Testing infrastrucutre no-stale Issue will not be marked as stale requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants