Skip to content

[libffi] Support LLVM on Windows by adding quotes around the path to CCAS #46287

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qmfrederik
Copy link
Contributor

@qmfrederik qmfrederik commented Jul 4, 2025

This PR fixes compiling libffi on Windows, when using the LLVM toolchain.

The path to CCAS may include spaces. On Windows, the build process runs within a MSYS2 shell, which doesn't deal withs paces in paths very well. Add quotes around the path to fix this.

This fixes building libffi with the LLVM toolchain on Windows.

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

The path to CCAS may include spaces.  On Windows, the build process runs within a MSYS2 shell, which doesn't deal withs paces in paths very well.  Add quotes around the path to fix this.

This fixes building libffi with the LLVM toolchain on Windows.
@qmfrederik qmfrederik force-pushed the fixes/libffi-llvm-windows branch from e36a159 to 6ad7e87 Compare July 4, 2025 14:26
@qmfrederik qmfrederik changed the title Add quotes around the CCAS environment variable [libffi] Support LLVM on Windows by adding quotes around the CCAS environment variable Jul 4, 2025
@qmfrederik qmfrederik changed the title [libffi] Support LLVM on Windows by adding quotes around the CCAS environment variable [libffi] Support LLVM on Windows by adding quotes around the path to CCAS Jul 4, 2025
@@ -37,6 +37,8 @@ if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
if(ccas_options)
vcpkg_list(APPEND options "CCASFLAGS=\${CCASFLAGS}${ccas_options}")
endif()
else()
vcpkg_list(APPEND options "CCAS='${VCPKG_DETECTED_CMAKE_C_COMPILER}'")
Copy link
Contributor

Choose a reason for hiding this comment

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

I acknowledge that the PR passes CI for libffi, but...
... this overrides the CCAS setting from vcpkg_configure_make which carries "ABIFLAGS" in addition to the tool executable.

In general, autoconf packages are extremely volatile around spaces in paths. These variable values are passed from Windows CMake to Msys2 bash/configure to Msys2 bash/libtool. Quoting and escaping has to be done all the time, and it isn't always done correctly. That's why the directory of cl.exe is added to PATH instead.

I would be glad if the problems could be overcome, and maybe the vcpkg-make port is already better than the old scripts. But we really need to be sure what we need in vcpkg-make and what we need in individual ports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This overrides the CCAS setting from vcpkg_configure_make which carries "ABIFLAGS" in addition to the tool executable.

I don't disagree, but the same is being done in the MSVC case, right ? (line 26)

That's why the directory of cl.exe is added to PATH instead.

I assume that could be done; we could parse VCPKG_DETECTED_CMAKE_C_COMPILER, add the directory to PATH, and then use the executable name for CCAS?

Copy link
Member

@vicroms vicroms Jul 14, 2025

Choose a reason for hiding this comment

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

I assume that could be done; we could parse VCPKG_DETECTED_CMAKE_C_COMPILER, add the directory to PATH, and then use the executable name for CCAS?

@qmfrederik This seems worth a try, it avoids the spaces in paths issue that is the root of so many problems.

@vicroms vicroms self-assigned this Jul 9, 2025
@vicroms vicroms added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jul 9, 2025
@vicroms vicroms added category:port-bug The issue is with a library, which is something the port should already support info:reviewed Pull Request changes follow basic guidelines and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Jul 17, 2025
@vicroms vicroms marked this pull request as draft July 20, 2025 21:18
@BillyONeal BillyONeal removed the info:reviewed Pull Request changes follow basic guidelines label Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants