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

Pod fails validation with Xcode 12 toolchain #213

Closed
mokagio opened this issue Oct 6, 2020 · 6 comments
Closed

Pod fails validation with Xcode 12 toolchain #213

mokagio opened this issue Oct 6, 2020 · 6 comments

Comments

@mokagio
Copy link

mokagio commented Oct 6, 2020

Hi all 👋 Thank you for the great work building and maintaining this library. We use it in one of our libraries at Automattic.

I'm experiencing an issue with the Xcode 12 toolchain and CocoaPods: the .podspec validation fails with this error:

❌ ld: in /path/to/CocoaPods-Lint/workspace/Pods/Sodium/Sodium/libsodium/libsodium-ios.a(libsodium_la-aead_xchacha20poly1305.o), 
building for iOS Simulator, 
but linking in object file built for iOS,
for architecture arm64

❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

You can reproduce this on 0.8.0 by running:

pod spec lint ./Sodium.podspec

I been able to get the validation to pass for version 0.8.0 for iOS and macOS, but not for watchOS. Here's the branch on my fork if you want to check it out.

But, master has changed the way libsodium is imported with the .xcframework (which is pretty neat) and unfortunately the pod validation fails there, too 😞 .

I tried with CocoaPods 1.9.3 and also 1.10.0.rc.1. Here's the validation output from the latter:

- NOTE  | [iOS] xcodebuild:  warning:
  [CP] Unable to find matching .xcframework slice in 
  'Sodium/Clibsodium.xcframework Clibsodium library
  ios-arm64_x86_64-maccatalyst ios-i386_x86_64-simulator
  ios-arm64_armv7_armv7s' for the current build architectures
  (arm64 i386 x86_64).
- ERROR | xcodebuild:  Sodium/Sodium/Aead.swift:2:8: error: 
  no such module 'Clibsodium'
- NOTE  | [OSX] xcodebuild:  clang: error:
  linker command failed with exit code 1 (use -v to see invocation)
- NOTE  | [watchOS] xcodebuild:  warning:
 [CP] Unable to find matching .xcframework slice in 
 'Sodium/Clibsodium.xcframework Clibsodium library 
 watchos-i386_x86_64-simulator watchos-arm64_32_armv7k'
 for the current build architectures (arm64 i386 x86_64).
Click here for the full output
 -> Sodium (0.9.0)
    - ERROR | xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Building targets in parallel
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description
    - NOTE  | xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | [iOS] xcodebuild:  warning: [CP] Unable to find matching .xcframework slice in 'Sodium/Clibsodium.xcframework Clibsodium library ios-arm64_x86_64-maccatalyst ios-i386_x86_64-simulator ios-arm64_armv7_armv7s' for the current build architectures (arm64 i386 x86_64).
    - ERROR | xcodebuild:  Sodium/Sodium/Aead.swift:2:8: error: no such module 'Clibsodium'
    - NOTE  | xcodebuild:  note: Using codesigning identity override: 
    - NOTE  | [OSX] xcodebuild:  clang: error: linker command failed with exit code 1 (use -v to see invocation)
    - NOTE  | [watchOS] xcodebuild:  warning: [CP] Unable to find matching .xcframework slice in 'Sodium/Clibsodium.xcframework Clibsodium library watchos-i386_x86_64-simulator watchos-arm64_32_armv7k' for the current build architectures (arm64 i386 x86_64).

This looks similar to #212, too.

Something that might be useful for debugging is running pod spec lint --no-clean to get access to the workspace that CocoaPods generates to do the linting. Something else is to use --platforms=ios (or macos, or watchos) to run the linting only on one platform.

Let me know what I can do to help solving this. I'll be poking around this more tomorrow.

@mokagio
Copy link
Author

mokagio commented Oct 7, 2020

Update. I was able to get the Pod build and validation to work on watchOS against 0.8.0.

I can't open a PR for it though, because you can only open PRs against branches and 0.8.0 is just a tag at this point. Here's the comparison against the tag, it's pretty straightforward.

I'll be looking at the .xcframework setup next.

@jedisct1, if I don't get anywhere with it or if you don't think the changes currently in master are ready to be shipped as part of a new version (I can see 0.9.0 has already been tagged, but hasn't been pushed to CocoaPods yet?) would you consider cutting out a patch version, 0.8.1, to incorporate those CocoaPods fixes?

mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Oct 8, 2020
Because of the build system changes in Xcode 12 due to the support of
Apple Silicon, we now need to explicitly exclude the arm64 architecture
from the build, otherwise xcodebuild will fail to build.

I opened an issue in the Sodium repo, see
jedisct1/swift-sodium#213, but I haven't
received feedback yet.

In order to unblock our progress, I created a fork of Sodium,
Sodium-Fork, which incorporate the necessary changes to pass the
validation.

I published the fork on CocoaPods, but unfortunately CI seems to fail to
find it.
See this build:
https://app.circleci.com/pipelines/github/Automattic/Automattic-Tracks-iOS/380/workflows/c0206d34-0f8a-4913-8b5d-b05e6dcb7c5b/jobs/936

I tried to set the `update-specs-sources` parameter to true, but it
didn't make any difference.
Interestingly, CI shows that the command runs, but there is no output
and the execution time is 1s, too little to fetch the CocoaPods specs
repo.
This makes me think there might be something wrong in the setup or in
how CI runs it.

To address this issue, I published the pod on my private specs repo, and
added its URL to the sources for the validation.

Funny enough, while the spec validation fails to find the new pod, the `pod
install` command in a different job has no problems with it.
@mokagio
Copy link
Author

mokagio commented Oct 8, 2020

While waiting for feedback from the maintainers on this issue, I published a fork of this repo with the fix to make it work with CocoaPods 1.9.3 and the Xcode 12.0 toolchain, on top of the 0.8.0 tag.

# Podfile
pod 'Sodium-Fork'
# YourPod.podspec
spec.dependency 'Sodium-Fork'

You might need to run pod install --repo-update or pod repo update to find it.

I also opened #214 against the main branch of the repo. Unfortunately, it doesn't get to the bottom of the issue –the validation still fails– but I think it's a step in the right direction so I thought I'd put it out there.

mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Oct 8, 2020
Because of the build system changes in Xcode 12 due to the support of
Apple Silicon, we now need to explicitly exclude the arm64 architecture
from the build, otherwise xcodebuild will fail to build.

I opened an issue in the Sodium repo, see
jedisct1/swift-sodium#213, but I haven't
received feedback yet.

In order to unblock our progress, I created a fork of Sodium,
Sodium-Fork, which incorporate the necessary changes to pass the
validation.

I published the fork on CocoaPods, but unfortunately CI seems to fail to
find it.
See this build:
https://app.circleci.com/pipelines/github/Automattic/Automattic-Tracks-iOS/380/workflows/c0206d34-0f8a-4913-8b5d-b05e6dcb7c5b/jobs/936

I tried to set the `update-specs-sources` parameter to true, but it
didn't make any difference.
Interestingly, CI shows that the command runs, but there is no output
and the execution time is 1s, too little to fetch the CocoaPods specs
repo.
This makes me think there might be something wrong in the setup or in
how CI runs it.

To address this issue, I published the pod on my private specs repo, and
added its URL to the sources for the validation.

Funny enough, while the spec validation fails to find the new pod, the `pod
install` command in a different job has no problems with it.
mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Oct 8, 2020
Because of the build system changes in Xcode 12 due to the support of
Apple Silicon, we now need to explicitly exclude the arm64 architecture
from the build, otherwise xcodebuild will fail to build.

I opened an issue in the Sodium repo, see
jedisct1/swift-sodium#213, but I haven't
received feedback yet.

In order to unblock our progress, I created a fork of Sodium,
Sodium-Fork, which incorporate the necessary changes to pass the
validation.

I published the fork on CocoaPods, but unfortunately CI seems to fail to
find it.
See this build:
https://app.circleci.com/pipelines/github/Automattic/Automattic-Tracks-iOS/380/workflows/c0206d34-0f8a-4913-8b5d-b05e6dcb7c5b/jobs/936

I tried to set the `update-specs-sources` parameter to true, but it
didn't make any difference.
Interestingly, CI shows that the command runs, but there is no output
and the execution time is 1s, too little to fetch the CocoaPods specs
repo.
This makes me think there might be something wrong in the setup or in
how CI runs it.

To address this issue, I published the pod on my private specs repo, and
added its URL to the sources for the validation.

Funny enough, while the spec validation fails to find the new pod, the `pod
install` command in a different job has no problems with it.
@mokagio
Copy link
Author

mokagio commented Oct 9, 2020

After chatting with @jedisct1, we established that #214 will fix this issue on the main branch once CocoaPods 1.10.0 is released.

@fishercraigj
Copy link

Bumping to follow. Same issue. Kind of in a hole waiting for cocoapods to release v1.10.0 if that's the solution.

@FabioTacke
Copy link

Same here. ☝️
We've been waiting for the 1.10.0 release for a couple of weeks now. But at the moment there doesn't seem to be much movement around the issues being part of the 1.10.0 milestone.

@mokagio
Copy link
Author

mokagio commented Oct 22, 2020

CocoaPods 1.10.0 is out 🎉

mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Dec 8, 2020
Now that CocoaPods 1.10.0 is out, we can go back to the original Sodium
library and decommission the fork we've been recently to work around
some Apple Silicon related limitations.

You can verify this works by running

```
bundle exec pod lib lint --allow-warnings
```

For extra context see:

- jedisct1/swift-sodium#213
- jedisct1/swift-sodium#214
- #148
mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Dec 9, 2020
Now that CocoaPods 1.10.0 is out, we can go back to the original Sodium
library and decommission the fork we've been recently to work around
some Apple Silicon related limitations.

You can verify this works by running

```
bundle exec pod lib lint --allow-warnings
```

For extra context see:

- jedisct1/swift-sodium#213
- jedisct1/swift-sodium#214
- #148
mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Dec 9, 2020
Now that CocoaPods 1.10.0 is out, we can go back to the original Sodium
library and decommission the fork we've been recently to work around
some Apple Silicon related limitations.

You can verify this works by running

```
bundle exec pod lib lint --allow-warnings
```

For extra context see:

- jedisct1/swift-sodium#213
- jedisct1/swift-sodium#214
- #148
mokagio added a commit to Automattic/Automattic-Tracks-iOS that referenced this issue Jan 11, 2021
Now that CocoaPods 1.10.0 is out, we can go back to the original Sodium
library and decommission the fork we've been recently to work around
some Apple Silicon related limitations.

You can verify this works by running

```
bundle exec pod lib lint --allow-warnings
```

For extra context see:

- jedisct1/swift-sodium#213
- jedisct1/swift-sodium#214
- #148
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

4 participants