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

First build fails with "No such module 'Clibsodium'" when paired with CocoaLumberjack #233

Open
jnross opened this issue Dec 21, 2020 · 10 comments

Comments

@jnross
Copy link
Contributor

jnross commented Dec 21, 2020

When I create a framework build target which includes both swift-sodium and CocoaLumberjack, the first build always fails on Aead.swift with the error "No such module 'Clibsodium'". The second build succeeds. This repeats any time I clean the workspace. The first build in a clean environment always fails.

The trouble is that this prevents me from archiving the framework, since the archive operation always performs a clean at the beginning.

I wonder if there might be a problem with parallel builds here in which the Sodium target is trying to reference Clibsodium before it is ready, and building the CocoaLumberjack module triggers this timing condition.

I've attached a project demonstrating this issue. This project contains a framework, not an app, and I've disabled code signing. So you should be able to download and reproduce the issue without any modifications to the project.

SodiumBuildTest.zip

This might be related to #226

@jnross
Copy link
Contributor Author

jnross commented Dec 21, 2020

And now I find that if I switch the project workspace to use the legacy build system, this problem goes away. Makes me think this is an Xcode issue. I'll file a bug with Apple and provide a reference here.

@jnross
Copy link
Contributor Author

jnross commented Dec 21, 2020

Nevermind. The "passed" build with the legacy build system was a red herring, as the legacy build system doesn't support packages from SPM. I'm not sure why it told me the build succeeded.

@jnross
Copy link
Contributor Author

jnross commented Dec 21, 2020

Splitting Clibsodium into its own package and declaring the dependency at the package level instead of at the target level seems to be working so far. I'll keep poking at this.

@jnross
Copy link
Contributor Author

jnross commented May 17, 2021

I retested this with Xcode 12.5 and the first build after clean still fails. But fortunately archiving no longer fails as described in #226.

@simonmcl
Copy link

I'm facing the same issue. I have a Swift Package that depends on Sodium. When using github actions to build tests I frequently get CI failures with the below. I've seen it happen once or twice if I clean the project locally

  ▸ Compiling Aead.swift
  
  ❌  /Users/runner/Library/Developer/Xcode/DerivedData/kukai-core-swift-feonpcdldioifeevuzivqxyyxcty/SourcePackages/checkouts/swift-sodium/Sodium/Aead.swift:2:8: no such module 'Clibsodium'
  
  import Clibsodium
      ~~~~~~ ^~~

@EldarLis
Copy link

EldarLis commented Aug 5, 2021

Same trouble arises every build i do. And I don't even know what I do to fix it for one build, next time - same trouble again and again.

@jnross
Copy link
Contributor Author

jnross commented Aug 7, 2021

I'm going to close this issue. When I try the attached sample project with 12.5.1 (12E507), I get no build failures when doing a simple debug build for both device and simulator, and also encounter no errors when archiving for device.

@jnross jnross closed this as completed Aug 7, 2021
@jnross
Copy link
Contributor Author

jnross commented Aug 8, 2021

Nevermind. When I closed this yesterday, I was testing with my M1 Mac mini. I tried again today on my Intel Macbook Pro, and this failure still happens reliably on the first build after clean.

I agree with @jedisct1 that the blame here seems to be in Apple's tools, but that doesn't change the fact that this is disrupting progress for some folks.

@jnross jnross reopened this Aug 8, 2021
@simonmcl
Copy link

simonmcl commented Aug 9, 2021

It was called out as fixed in one of the Xcode 13 beta's, and then called out as a known issue in the one after it, as it wasn't actually fixed. Fingers crossed they fix it, and it doesn't take months for github actions and other providers to add support for it like it did 12.5. These build issues and integration blocks are unbearable

@markshiz
Copy link

Xcode 12.5, 12.5.1, and the workaround suggested above all still break the first build for me. 😭

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

Successfully merging a pull request may close this issue.

4 participants