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

CCryptoBoringSSL_ex_data.h:207:8: note: definition has no member 'ctx' #243

Closed
3 tasks done
diegotl opened this issue Jun 28, 2024 · 14 comments
Closed
3 tasks done

Comments

@diegotl
Copy link

diegotl commented Jun 28, 2024

New Issue Checklist

Expected behavior

Build to succeed

Actual behavior

Since yesterday evening when I resolve package and build a certain Vapor swift package, this error pops up:

Building for production...
/usr/include/openssl/crypto.h:181:19: error: 'crypto_ex_data_st::ctx' from module 'OpenSSL' is not present in definition of 'struct crypto_ex_data_st' in module 'CCryptoBoringSSL'
    OSSL_LIB_CTX *ctx;
                  ^
/home/projects/app/.build/checkouts/swift-crypto/Sources/CCryptoBoringSSL/include/CCryptoBoringSSL_ex_data.h:207:8: note: definition has no member 'ctx'
struct crypto_ex_data_st {

Seems to be related to 3.5.0 release, because I see no issues when forcing 3.4.0 in Package.swift.

Steps to reproduce

Happens in a private repo but I can provide access upon request.

If possible, minimal yet complete reproducer code (or URL to code)

swift package resolve
swift package update
swift build -c release

Swift Crypto version/commit hash

3.5.0 / 33f65a3

Environment

Stand in the root of the repo and run ./scripts/environment.sh and paste the output below

Swift version: Swift version 5.10.1 (swift-5.10.1-RELEASE) Target: x86_64-unknown-linux-gnu\nUnix version: Linux pacotevicio-ash-1 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux\n
@MahdiBM
Copy link

MahdiBM commented Jun 28, 2024

We're also having similar errors in Penny's tests: vapor/penny-bot#208

@simonjbeaumont
Copy link
Contributor

@MahdiBM I'll try and take a look at this tomorrow. Looks like there are a couple of issues caused by our BoringSSL vendoring in the latest release, for which we needed to drop the @_implementationOnly.

@simonjbeaumont
Copy link
Contributor

@MahdiBM Looking at your CI output, I think your issue may not be the same as that in this issue description. You have these failures:

/__w/penny-bot/penny-bot/.build/checkouts/swift-crypto/Sources/CCryptoBoringSSL/include/CCryptoBoringSSL_x509.h:2714:1: error: 'sk_X509_ATTRIBUTE_delete_if' has different definitions in different modules; definition in module 'CCryptoBoringSSL' first difference is function body
DEFINE_STACK_OF(X509_ATTRIBUTE)
...

This should be addressed by #245. I'll ping you when we release that one and we can use this issue to investigate the OP issue.

@simonjbeaumont
Copy link
Contributor

@diegotl It's not clear that #245 will fix your issue. Are you able to provide a minimal reproducer and/or access to your project and steps to reproduce the failure?

@simonjbeaumont
Copy link
Contributor

@MahdiBM https://github.com/apple/swift-crypto/releases/tag/3.5.1 should hopefully resolve your penny build.

@diegotl
Copy link
Author

diegotl commented Jul 2, 2024

@simonjbeaumont I think it's not necessary because I just tried 3.5.1 and it fixes the issue, thank you very much!

@simonjbeaumont
Copy link
Contributor

@diegotl thanks for confirming, and that's good to hear.

@simonjbeaumont
Copy link
Contributor

I have chatted with @MahdiBM offline and 3.5.1 wasn't enough to fix for penny https://github.com/vapor/penny-bot/actions/runs/9767425786/job/26962669715?pr=211.

@diegotl
Copy link
Author

diegotl commented Jul 3, 2024

That's interesting, what I did was set 3.5.1 and built the module myself on Ubuntu (same as I was doing when I opened the issue) and it worked. For this I reported as fixed. But Github actions failed to build the tests when I commited the change.

Will do more tests today and try to provide a minimal project with the problem.

@simonjbeaumont
Copy link
Contributor

@diegotl while surprising, that tallies with what I expect after my investigations. Specifically, this kind of error (where the compiler complains about conflicting symbols) causes a build error BUT it has emitted the module. That means (very surprisingly) if you just run swift build it will then succeed 🙃

This is why we're more likely to see projects fail in CI because they always do a clean build.

It would be very helpful if you could confirm that for me. Specifically confirm that:

  1. swift package clean && swift build fails.
  2. swift build again succeeds.

Now, this is not a fix but it will be useful data because I feel we should file a bug report on the Swift compiler for that.

@simonjbeaumont
Copy link
Contributor

@diegotl for a proper fix, I'm proposing #246, which needs review. If you have time, could you also confirm that your project builds fine (from clean) with that PR branch? Would be super helpful.

@diegotl
Copy link
Author

diegotl commented Jul 3, 2024

@simonjbeaumont Just tried it here, step 1 fails but step 2 also fails!

Haven't tried #246 yet, but for now here's a sample project that fails to build. Will test the proposal later today when I find a little time. Thank you!

sampleproject.zip

@MahdiBM
Copy link

MahdiBM commented Jul 3, 2024

I can confirm Penny's problem is solved: vapor/penny-bot#212

Thanks @simonjbeaumont 🙂

@diegotl
Copy link
Author

diegotl commented Jul 3, 2024

Yes, #246 is good! Thank you @simonjbeaumont!

@diegotl diegotl closed this as completed Jul 3, 2024
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

No branches or pull requests

3 participants