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

[openssl] Fix build with "C:\Program Files\<...>\cl.exe" #43089

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

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Jan 4, 2025

This fixes the long-standing annoyance that port openssl fails to build with (some) installations of Visual Studio to paths including the space character, also affecting the default location C:\Program Files\Visual Studio\....

The port passes the absolute path of CC and the CFLAGS as detected from the CMake toolchain.
This works for all normal build rules, but not for the invocation of a perl scripts which is meant to write that information into crypto/buildinf.h which is created via this rule:

$(PERL) <SRCDIR>/util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)" > $@
  • The rule doesn't properly handle quotes in CC or flags (at least for Windows host), so perl may see multiple arguments when it expects to see exactly two arguments.
  • mkbuildinf.pl doesn't consider the backslash in filepaths like CC when constructing a C string.

The new patch

  • handles multiple arguments, assuming only that the last one is the platform.
  • quotes all backslashes for C string construction.

NB the full path of the compiler is written as build information into binary aritfacts. If this isn't desired, a different approach must be taken.

Resolves #42740.
Resolves #41751.
Resolves #39912.
Resolves #38723.
Resolves #36175.
Related:

@dg0yt
Copy link
Contributor Author

dg0yt commented Jan 4, 2025

Upstream: openssl/openssl#26315.

@jimwang118 jimwang118 self-assigned this Jan 6, 2025
@jimwang118 jimwang118 added the category:port-bug The issue is with a library, which is something the port should already support label Jan 6, 2025
@jimwang118
Copy link
Contributor

Compile test pass with following triplets:

x86-windows
x64-windows
x86-windows-static

@jimwang118 jimwang118 added the info:reviewed Pull Request changes follow basic guidelines label Jan 6, 2025
@JavierMatosD JavierMatosD added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jan 7, 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 info:reviewed Pull Request changes follow basic guidelines requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look.
Projects
None yet
3 participants