-
-
Notifications
You must be signed in to change notification settings - Fork 416
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: improve MinGW support on Windows #6079
base: dev
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
if jom then | ||
package:add("deps", "jom", {private = true}) | ||
elseif is_subhost("windows") then | ||
package:add("deps", "strawberry-perl", { private = true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove {system = false}
, it will break some things. it will use incorrect perl in some systems and ci envs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please share more details about the scenarios where the system Perl might fail? There might be a workaround we can implement to address this issue. Using the system Perl helps save disk space.
For your reference, I tested with Perl installed via scoop
, and it seemed to work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't reproduce it because I don't remember what happened before. But since there is a clear comment to fix this problem by passing system = false
, we shouldn't just remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment indicated that Perl bundled with GitForWindows fails to build OpenSSL. I encountered this issue too at the beginning. The error message is as follows:
Can't locate Pod/Usage.pm in @INC (you may need to install the Pod::Usage module) (@INC entries checked: . /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at configdata.pm line 11398.
BEGIN failed--compilation aborted at configdata.pm line 11398.
Compilation failed in require.
BEGIN failed--compilation aborted.
I looked into the config script and found that Pod::Usage
is only used to generate help messages, which are shown with the ./Configure help
command. I guess that the help message is not needed when installing the package. So, I removed the use of the Pod::Usage
module, and it builds successfully using Perl from GitForWindows.
@@ -32,15 +32,18 @@ package("openssl") | |||
if package:is_plat("android") and is_subhost("windows") and os.arch() == "x64" then | |||
-- when building for android on windows, use msys2 perl instead of strawberry-perl to avoid configure issue | |||
package:add("deps", "msys2", {configs = {msystem = "MINGW64", base_devel = true}, private = true}) | |||
elseif is_subhost("windows") and not package:is_precompiled() then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and why not remove not package:is_precompiled()
?
If you are using the build-artifacts binary, you do not need to compile openssl and install its build dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, there is no is_precompiled
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, there is no
is_precompiled
now
but we need is_precompiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misunderstood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are downloading a precompiled binary, then all build dependencies do not need to be installed.
https://github.com/xmake-mirror/build-artifacts/releases?q=openssl&expanded=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the outer if not package:is_precompiled() then
might work .
xmake-repo/packages/o/openssl/xmake.lua
Lines 30 to 31 in a7144ca
on_load(function (package) | |
if not package:is_precompiled() then |
Supported Combinations of Targets and Windows Environments
Unsupported Combinations of Targets and Environments
|
packages/o/openssl/xmake.lua
Outdated
package:add("deps", "msys2", {configs = {msystem = "MINGW64", base_devel = true}, private = true}) | ||
elseif is_subhost("windows") then | ||
import("lib.detect.find_tool") | ||
local perl = find_tool("perl", {paths={"$(env PERL)"}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not call find_tool
in on_load
packages/o/openssl/xmake.lua
Outdated
if on_check then | ||
on_check(function (package) | ||
import("lib.detect.find_tool") | ||
local perl = assert(find_tool("perl", {paths={"$(env PERL)"}}), "package(openssl): perl not found!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use package:find_tool and add spaces =
packages/o/openssl/xmake.lua
Outdated
@@ -83,7 +102,13 @@ package("openssl") | |||
table.insert(configs, "no-makedepend") | |||
table.insert(configs, "/FS") | |||
end | |||
os.vrunv("perl", configs) | |||
import("lib.detect.find_tool") | |||
local perl = assert(find_tool("perl", {paths={"$(env PERL)"}}), "package(openssl): perl not found!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not call find_tool
, we should use add_deps
to bind perl path end and run perl
I'm sorry but I don't understand what benefit this PR does, it seems complicated to just use the system perl instead of installing strawberry perl or am I missing something? |
Thank you for your feedback. Let me clarify the reasoning behind this PR:
Additionally, when building OpenSSL in I hope this clarifies the purpose of the changes. |
OpenSSL targeting MinGW can be built on Linux or MSYS2, but not directly on Windows. This PR introduces a workaround to enable building on Windows using Git Bash.