-
-
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
libreSSL support #4676
Comments
We use the OpenSSL version numbers to determine which OpenSSL API we should follow. If LibreSSL uses a custom scheme, well... that's complicated :( |
libgit2 (C) uses the following for example: #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// this is NOT openssl version 1.1.0
#endif But there's no way we can access these constants from crystal, right? Could get the library version using |
Yes, Crystal can't access C headers at compile time. Is libressl installing another |
Or what does |
The package installs
Contents of /usr/lib/pkgconfig/openssl.pc:
|
Sigh, that won't help. |
Shall we close this or add a label? |
perhaps we could run something through the C preprocessor quickly to determine the status of |
@RX14 the C preprocessor may be the only viable solution. |
Apparently we can use OPENSSL_VERSION = {{ `echo "#include <openssl/opensslv.h>\nSHLIB_VERSION_NUMBER" | cc -E -`.chomp.split('\n').last.id }}
puts OPENSSL_VERSION #=> 1.0.0 or 1.1 That doesn't help to detect features introduced in 1.0.2 thought (SHLIB reports 1.0.0), and we can't rely on |
So why not assume that anything above 2.0.0 in pkg-config is LibreSSL? |
(Originally suggested by @Vaelatern on voidlinux/void-packages#9831) LibreSSL has a new TLS library called |
|
Although LibreSSL/OpenSSL version conflict requires a hack to resolve, calling |
|
@LVMBDV just because libtls is present doesn't mean libssl refers to libressl. You could have a libtls from libressl and a libssl from openssl on the same system. Yes, calling |
Seems |
Calling Guessing based on the presence of a library file (that we don't even use) is... well... just pure guess. IMHO: using a C preprocessor is a good solution we have at hand. Just as hacky as guessing from |
I'm having same problem on Crystal 0.24.1 (2017-12-22). Build an application fails with following error:
openssl v1.0.2 |
Am having the exact same issue as @vtambourine trying to build Amber using ysbaddaden/crystal-alpine as Docker base image. |
May someone that reproduces the issue prepare a pull request to replace pkg-config to use the cc preprocessor command instead, as proposed above? That would be awesome. Thanks! |
On it :) |
https://crystal-lang.org/ The Crystal Programming Language
Did anyone even try this on a Mac? I can't compile anything right now:
Mac doesn't use OpenSSL, so those headers will never exit there. How can we fix this? |
Sigh. I'm bored with C bindings. I wish we could just do Maybe the current hack can be fixed with a |
EDIT: Nevermind that
AFAIK (from my research for that PR) Mac used OpenSSL AND included its headers until Sierra or something. Then they clumsily removed the headers between some subversion of Sierra until they switched to LibreSSL in High Sierra. From the blog posts I found, most developers just used homebrew openssl the during that shitshow. |
@LVMBDV Good catch, thank you! |
This has all been reverted - we need to come up with a better way of detecting libressl. |
Fixed with #6917 |
I first encountered this issue while install Crystal on my Mac and second time while installing Easiest way I was able to make it work was by doing:
(Make sure your openssl version is correct) and then
Then continue with installation... |
I also ran into a similar problem while compiling Crystal and running the specs on my Mac (Catalina 10.15.1):
Then I ran these
I've installed all these required libraries using brew. |
@ndbroadbent In https://crystal-lang.org/install/on_mac_os/ there's an alternative fix that might work. Could you try it out?
|
I saw that I needed LLVM 8.0, so I downgraded:
Then ran that command to add it to my I also removed the symlinks I added earlier:
And saw this article about issues with Crystal and openssl. They recommended setting the
After that, I got this error:
I realized that's probably because I changed the LLVM version and/or setting I saw that the Circle CI config already has a It would be really nice if there was some way to automate this and use a shared file somewhere, so that the docs + CI are always in sync. |
Thanks @asterite, I also found that I installed a fresh copy of macOS last week, and I already had |
In addition to the |
crystal version >= 0.22 fails using libressl:
The problem seem to be here:
crystal/src/openssl/lib_ssl.cr
Line 5 in da48f82
pkg-config --atleast-version=1.1.0 libssl
This is a check for libssl version >= 1.1.0
libreSSL reports (in my case) version 2.5.4
The libreSSL API follows (asfaik) openssl version 1.0.1
The text was updated successfully, but these errors were encountered: