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

macos-latest (macos-12) trufferuby-head (23.1.0-dev-b64cd1d4): native extentsion compiling with both OpenSSL 3.1 and 1.1 include directories. #2220

Closed
junaruga opened this issue Jul 20, 2023 · 3 comments
Labels

Comments

@junaruga
Copy link

junaruga commented Jul 20, 2023

We see an issue on the macos-latest trufferuby-head case on the GitHub Actions on ruby/openssl. The issue ticket is ruby/openssl#650. I don't know where the issue comes from. But my guess is that the trufferuby-head was built with both OpenSSL 3.1 and 1.1 include directories unintentionally.


Steps to reproduce the behavior

  1. Fork the repository: https://github.com/ruby/openssl.
  2. Push an dummy empty commit to your repository.
  3. Check the macos-latest truffleruby-head case on the GitHub Actions on the repository.

Expected vs. actual behavior

Expected: The case succeeds. There is no compiler warning.

Actual: The case fails. There is a compiler warning.

/Users/runner/.rubies/truffleruby-head/lib/sulong/native/bin/graalvm-native-clang -I. -I/Users/runner/.rubies/truffleruby-head/lib/cext/include -I/Users/runner/.rubies/truffleruby-head/lib/cext/include/ruby/backward -I/Users/runner/.rubies/truffleruby-head/lib/cext/include -I../../../../ext/openssl -I/usr/local/Cellar/openssl@3/3.1.1_1/include -DRUBY_EXTCONF_H=\"extconf.h\"  -D_DARWIN_C_SOURCE -DTRUFFLERUBY_ABI_VERSION=3.1.3.9 -I/usr/local/opt/openssl@1.1/include -fPIC   -Werror=implicit-function-declaration -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types -Wno-format-invalid-specifier -Wno-format-extra-args -ferror-limit=500  -Werror  -o ossl.o -c ../../../../ext/openssl/ossl.c 
In file included from ../../../../ext/openssl/ossl.c:10:
In file included from ../../../../ext/openssl/ossl.h:175:
../../../../ext/openssl/openssl_missing.h:195:11: error: 'TS_VERIFY_CTS_set_certs' macro redefined [-Werror,-Wmacro-redefined]
#  define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
          ^
/usr/local/Cellar/openssl@3/3.1.1_1/include/openssl/ts.h:426:11: note: previous definition is here
#  define TS_VERIFY_CTS_set_certs(ctx, cert) TS_VERIFY_CTX_set_certs(ctx,cert)
          ^

I suppose that the problem is both OpenSSL 1.1 include directory -I/usr/local/opt/openssl@1.1/include and OpenSSL 3.1 directory -I/usr/local/Cellar/openssl@3/3.1.1_1/include are specified in the command line. I assume the truffleruby-head was built with both the include directories.

Logs

https://github.com/ruby/openssl/actions/runs/5580792815/job/15113450849#step:8:91

@junaruga junaruga added the bug label Jul 20, 2023
@junaruga junaruga changed the title macos-latest (macos-12) trufferuby-head (23.1.0-dev-b64cd1d4) macos-latest (macos-12) trufferuby-head (23.1.0-dev-b64cd1d4): native extentsion compiling with both OpenSSL 3.1 and 1.1 include directories. Jul 20, 2023
@junaruga
Copy link
Author

I suspect that the following codes may cause this issue.

use_homebrew_openssl

local ssldir="$(brew --prefix openssl@1.1 2>/dev/null || true)"

@junaruga
Copy link
Author

junaruga commented Jul 21, 2023

Here is a temporary workaround for this issue in Ruby OpenSSL binding repository.

ruby/openssl#652

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 36609e2..4e5def4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -51,6 +51,12 @@ jobs:
         run:  echo "RUBY_OPENSSL_EXTCFLAGS=-Werror" >> $GITHUB_ENV
         if: ${{ !matrix.skip-warnings }}
 
+      # A temporary workaround to pass the CI case.
+      # https://github.com/ruby/openssl/issues/650
+      - name: remove openssl 3 include directory.
+        run:  rm -rfv "$(brew --prefix openssl@3)/include"
+        if: matrix.os == 'macos-latest' && matrix.ruby == 'truffleruby-head'
+
       # Enable provider search path for OpenSSL 3.0 in MSYS2.
       # Remove when Ruby 3.2 build is updated
       - name: enable windows provider search path

@eregon
Copy link
Member

eregon commented Jul 21, 2023

IIRC use_homebrew_openssl has no effect on TruffleRuby, TruffleRuby has its own logic to find the system libssl:
https://github.com/oracle/truffleruby/blob/16db2e64472e5f4d88176ae122815b6b291c0947/lib/truffle/truffle/openssl-prefix.rb
So let's continue in ruby/openssl#650

@eregon eregon closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants