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 compilation on windows msvc and ninja #461

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

Conversation

dan-42
Copy link

@dan-42 dan-42 commented Aug 11, 2021

  • I've followed this guide
    step by step carefully. [Yes]

  • This update will fix a toolchain.

    • ninja-vs-15-2017-win64-cxx17

The issue boils down that url_sha1_openssl_windows_1_1_plus.cmake calls configure_1_1_plus.cmake
And CMake populates CXX, CC and other environment variables.

The build fails because, the content of these variables are absolute file paths without any quotes and they are not escaped.
But openssl will use them and fails upon calling them.

The same goes for many other projects (e.g. Boost during b2) and I created this PR to show it for openssl* and get a conversation going.
My guess is that CMake actually sets these variables wrong, or Hunter should set them manually.

So I'm hoping for some feedback on how this might be solved in a better more general way.

*) unfortunately since the last version of hunter, the CI does not run the builds anymore 🤷

@dan-42 dan-42 changed the title Fix compilation on windows msvc and ninja OpenSSL: Fix compilation on windows msvc and ninja Aug 11, 2021
set(log_opts "")
endif()


execute_process(COMMAND
perl Configure @arch@ @opt@ @shared@ "--prefix=@openssl_install_dir@" "--openssldir=@openssl_dir@" RESULT_VARIABLE result)
Copy link
Member

Choose a reason for hiding this comment

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

I've found that the perl command will fail depending on whether it is the mingw perl (failure) or the Strawberry/Windows perl (success). Can we fix that too?

Copy link
Author

Choose a reason for hiding this comment

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

@rbsheth
Sure
I did not look to close into it.
But it looks like the command expects a linux bash but in fact it is a windows cmd

Not yet sure how to solve that, but I'm also not so familiar with mingw and I need to set it up first.

@dan-42
Copy link
Author

dan-42 commented Aug 28, 2021

@rbsheth Thanks for commenting
I really would like to know if my fix is the way to go? I'm really unsure.

I discovered (working on my toy project) when running cmake the first time openSSL fails, but then running it the second time it works. It is still the same reason, the CXX and co env-variables are set the fist run.

So I still suspect somehow CMake or some other entity doing something funny.

@rbsheth
Copy link
Member

rbsheth commented Oct 27, 2021

Sorry, I haven't taken a look in a while. But I suspect something more fundamental is going on here

@dan-42
Copy link
Author

dan-42 commented Oct 28, 2021

@rbsheth no worries, I also could not find the time to look more into this.
But yes it looks like something fundamental might be wrong.

But as the OpenSSL's perl-script is figuring things out on it's own (which does go wrong)
I think it would be hunter's responsibility to to always correctly set the compiler paths (CC, CXX, etc) so the perl-script does not try to guess anything.

and there is your point, that it will depend on the installed perl-version (Strawberry or mingw) maybe that is the root cause and we just need to differentiate between those two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants