CCryptoBoringSSL_ex_data.h:207:8: note: definition has no member 'ctx'
New Issue Checklist
- [X] I'm using the latest version of Swift Crypto (
mainbranch) - [X] I read the Contribution Guidelines
- [X] I searched for existing GitHub issues
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 / 33f65a3cbc52f8c19295723af9cbecc2195484e1
Environment
Stand in the root of the repo and run ./scripts/environment.sh and paste the output below
We're also having similar errors in Penny's tests: https://github.com/vapor/penny-bot/pull/208
@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.
@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.
@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?
@MahdiBM https://github.com/apple/swift-crypto/releases/tag/3.5.1 should hopefully resolve your penny build.
@simonjbeaumont I think it's not necessary because I just tried 3.5.1 and it fixes the issue, thank you very much!
@diegotl thanks for confirming, and that's good to hear.
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.
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.
@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:
swift package clean && swift buildfails.swift buildagain 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.
@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.
@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!
I can confirm Penny's problem is solved: https://github.com/vapor/penny-bot/pull/212
Thanks @simonjbeaumont 🙂
Yes, #246 is good! Thank you @simonjbeaumont!