-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Detecting OpenSSL's version on Windows #11492
Comments
Thanks for resuming the discussion. Yes, this needs to be solved. If we don't come up with an even better solution than the one you initially suggested with storing a version file, I think we should actually revert directly to that solution. One user of https://github.com/crystal-lang/install-crystal already expressed confusion. Quote:
And indeed that's all you see whenever trying to require OpenSSL currently. And despite the fact that this never worked in the first place, now it doesn't work in a confusing way. And I don't think that hardcoding this variable in downstream solutions like install-crystal would be a good solution at all. |
We have a unique situation regarding libraries: On Linux, BSDs and Macos, it's common that libraries are globally available and discoverable on the system. And the OS usually provides an easy tool for installing dependency packages. So we don't have to care about providing libraries with Crystal, just naming them as dependencies is usually enough. That's different on Windows. AFAIK, except for system libs, there are typically no libraries shared between different applications. Programs usually bring all their dependencies themselves, including shared libraries. Even package managers like chocolatey and scoop don't provide libraries, they seem to be used only for applications. So I would assume that we need distribution packages for Windows to ship with all libraries used by stdlib. And yes, that means we're in full control of which versions are available. I suppose you can still provide other versions of the libraries, but you may need to change some configuration for that. Placing the information about library versions in the lib directory sounds like a good idea. I'm wondering though, if maybe we should use a single file for that, or have one for each library. We need version information for libllvm as well. |
But I guess the libllvm version number is relevant if a project uses the |
Yeah, I'm talking about distribution, not the compiler build environment. LLVM is part of stdlib, so I would expect that we should ship libllvm as well for all batteries included. I'm not sure we actually need llvm-config for that. When we're packaging the lib ourselves, we should have all the configuration info. |
We would essentially need to replicate this part without llvm-config: Lines 11 to 17 in 07b2065
On my machine this gives:
If we move to dynamic linking on Windows then most likely there will be a single libLLVM.dll instead. In theory, each option here can be encoded in a separate text file. |
For now, regarding OpenSSL, shall we commit the file-based solution? |
@HertzDevil , please indeed open a pull request with such content. |
I think the LLVM static libraries would be prohibitively large compared to the rest of the files we distribute. Most people won't use the |
Crystal detects libssl and libcrypto's versions during compilation time to bind to their APIs correctly. This is normally achieved using
pkg-config
; Windows doesn't have it, but we currently control all third-party libraries distributed together with Crystal, at least for portable packages (insofar as places like neatorobito/scoop-crystal and crystal-lang/install-crystal already rely on the Windows CI build artifacts). That means we can hardcode OpenSSL or LibreSSL's version number somewhere.The current situation is to set the
CRYSTAL_OPENSSL_VERSION
environment variable. One way to improve it is writing the version number in a file calledopenssl_VERSION
(orlibressl_VERSION
) placed somewhere underCrystal::LIBRARY_PATH
, so that it can be read with macros:This is the original approach pursued in #11477.
The text was updated successfully, but these errors were encountered: