mono0926 / LicensePlist

A license list generator of all your dependencies for iOS applications
https://www.slideshare.net/mono0926/licenseplist-a-license-list-generator-of-all-your-dependencies-for-ios-applications
MIT License
2.43k stars 146 forks source link

Build fails on Xcode 10.2(Swift 5.0) #102

Closed davidcorbin closed 5 years ago

davidcorbin commented 5 years ago

When I run brew upgrade license-plist I get the following error.

$ brew upgrade license-plist
==> Upgrading 1 outdated package:
mono0926/license-plist/license-plist 2.0.0 -> 2.3.0
==> Upgrading mono0926/license-plist/license-plist
==> Downloading https://github.com/mono0926/LicensePlist/archive/2.3.0.tar.gz
Already downloaded: /Users/davidcorbin/Library/Caches/Homebrew/downloads/fdbb23e4cbb10e97c178e8caf0d2aff6be4d3134ecf89b892773398384ccce25--LicensePlist-2.3.0.tar.gz
==> make install PREFIX=/usr/local/Cellar/license-plist/2.3.0
Last 15 lines from /Users/davidcorbin/Library/Logs/Homebrew/license-plist/01.make:
  "_swift_weakInit", referenced from:
      _$s6APIKit7SessionC14cancelRequests4with11passingTestyxm_SbxctAA7RequestRzlF in Session.swift.o
  "_swift_weakLoadStrong", referenced from:
      _$s6APIKit7SessionC14cancelRequests4with11passingTestyxm_SbxctAA7RequestRzlFySayAA0B4Task_pGcfU_SbAaH_pXEfU_ in Session.swift.o
  "_swift_willThrow", referenced from:
      _$s10Foundation4DataV6APIKitE11inputStream8capacityACSo07NSInputE0C_SitKcfCTf4gnd_n in Data+InputStream.swift.o
      _$s6APIKit28FormURLEncodedBodyParametersVAA0dE0A2aDP11buildEntityAA07RequestdG0OyKFTW in FormURLEncodedBodyParameters.swift.o
      _$s6APIKit18JSONBodyParametersV11buildEntityAA011RequestBodyE0OyKF in JSONBodyParameters.swift.o
      _$s6APIKit18JSONBodyParametersVAA04BodyC0A2aDP11buildEntityAA07RequestdF0OyKFTW in JSONBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersVAA0eF0A2aDP11buildEntityAA07RequesteH0OyKFTW in MultipartFormDataBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersV4PartV5value4name8mimeType8fileName8encodingAEyp_S2SSgAKSS10FoundationE8EncodingVtKcfC in MultipartFormDataBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersV4PartV7fileURL4name8mimeType0H4NameAE10Foundation0I0V_S2SSgAMtKcfC in MultipartFormDataBodyParameters.swift.o
      ...
ld: symbol(s) not found for architecture x86_64
make: *** [build] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/mono0926/homebrew-license-plist/issues
mono0926 commented 5 years ago

Thanks, for the report πŸ™

It reproduced on my environment. I don't know the cause, but after released 2.3.2, the issue seemed to be resolved. So, try again brew upgrade license-plist, please.

If the problem persists, try another install methods written here for now. https://github.com/mono0926/LicensePlist#installation

mono0926 commented 5 years ago

After 2.3.0, I released the tool with Xcode 10.2, and I think it was the cause.

I've released 2.4.0 with Xcode 10.1, so the problem will be fixed. Could you try it?

davidcorbin commented 5 years ago

I tried installing through homebrew again and got the same error with 2.4.0.

$ brew upgrade license-plist
==> Upgrading 1 outdated package:
mono0926/license-plist/license-plist 2.0.0 -> 2.4.0
==> Upgrading mono0926/license-plist/license-plist
==> Downloading https://github.com/mono0926/LicensePlist/archive/2.4.0.tar.gz
Already downloaded: /Users/davidcorbin/Library/Caches/Homebrew/downloads/f895de1e973f820618d1fcbfd0aaedd10065f3f7841c28a69c2d40520c07de47--LicensePlist-2.4.0.tar.gz
==> make install PREFIX=/usr/local/Cellar/license-plist/2.4.0
Last 15 lines from /Users/davidcorbin/Library/Logs/Homebrew/license-plist/01.make:
  "_swift_weakInit", referenced from:
      _$s6APIKit7SessionC14cancelRequests4with11passingTestyxm_SbxctAA7RequestRzlF in Session.swift.o
  "_swift_weakLoadStrong", referenced from:
      _$s6APIKit7SessionC14cancelRequests4with11passingTestyxm_SbxctAA7RequestRzlFySayAA0B4Task_pGcfU_SbAaH_pXEfU_ in Session.swift.o
  "_swift_willThrow", referenced from:
      _$s10Foundation4DataV6APIKitE11inputStream8capacityACSo07NSInputE0C_SitKcfCTf4gnd_n in Data+InputStream.swift.o
      _$s6APIKit28FormURLEncodedBodyParametersVAA0dE0A2aDP11buildEntityAA07RequestdG0OyKFTW in FormURLEncodedBodyParameters.swift.o
      _$s6APIKit18JSONBodyParametersV11buildEntityAA011RequestBodyE0OyKF in JSONBodyParameters.swift.o
      _$s6APIKit18JSONBodyParametersVAA04BodyC0A2aDP11buildEntityAA07RequestdF0OyKFTW in JSONBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersVAA0eF0A2aDP11buildEntityAA07RequesteH0OyKFTW in MultipartFormDataBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersV4PartV5value4name8mimeType8fileName8encodingAEyp_S2SSgAKSS10FoundationE8EncodingVtKcfC in MultipartFormDataBodyParameters.swift.o
      _$s6APIKit31MultipartFormDataBodyParametersV4PartV7fileURL4name8mimeType0H4NameAE10Foundation0I0V_S2SSgAMtKcfC in MultipartFormDataBodyParameters.swift.o
      ...
ld: symbol(s) not found for architecture x86_64
make: *** [build] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/mono0926/homebrew-license-plist/issues

However, I cloned the repository and ran make install and there were no problems. I will just use the version from source for now! Thanks!

el-hoshino commented 5 years ago

Same problem happens on my environment too. It turns out that it seems to be an issue of APIKit which LicensePlist uses as a dependency.

I tried to fork APIKit, update its dependencies as well as Xcode settings; and then fork LicensePlist and update its dependencies to include my forked APIKit, then it worked well.

There's already someone sent a PR to migrate APIKit to Swift 5, so hopefully it'll be resolved soon.

Reference:

mono0926 commented 5 years ago

@el-hoshino

I'm sorry, I forgot to push https://github.com/mono0926/LicensePlist/commit/2d793f20da00f1128e4e168c2b7f9c7c9d03b3be, which is needed to resolve https://github.com/mono0926/LicensePlist/issues/103 to master branch.

https://github.com/el-hoshino/LicensePlist/commits/master + https://github.com/mono0926/LicensePlist/commit/2d793f20da00f1128e4e168c2b7f9c7c9d03b3be was failed to build with Xcode 10.2(Swift 5.0).

mono0926 commented 5 years ago

It seems that the build result depends on Command Line Tools versions.

image

Xcode 10.1

$ swift --version
$ Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
$ Target: x86_64-apple-darwin18.5.0

Xcode 10.2

$ swift --version
$ Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
$ Target: x86_64-apple-darwin18.5.0

Build Result

. Swift 4.2.1 Swift 5.0
with -Xswiftc -static-stdlib βœ… ❌
without -Xswiftc -static-stdlib βœ… βœ…

https://github.com/mono0926/LicensePlist/blob/2d793f20da00f1128e4e168c2b7f9c7c9d03b3be/Makefile#L5-L6

But, without -Xswiftc -static-stdlib, the tool which is installed by CocoaPods doesn't work on Xcode 10.1(Swift 4.2.1) or earlier(ABI not supported version) as written #103. So, I think it is prioritized.


I added about this to README.

mono0926 commented 5 years ago

@el-hoshino

If -Xswiftc -static-stdlib is removed from Makefile's build, the build succeeds on Xcode 10.1 or Xcode 10.1 on my environment. I can't figure out your changes is needed πŸ€”

el-hoshino commented 5 years ago

@mono0926 Found a similar problem here: https://github.com/grpc/grpc-swift/issues/416

Seems that it's because Xcode no longer embeds Swift Standard Library πŸ€”

mono0926 commented 5 years ago

@el-hoshino

Seems that it's because Xcode no longer embeds Swift Standard Library πŸ€”

I think so too as referred to ABI below.

But, without -Xswiftc -static-stdlib, the tool which is installed by CocoaPods doesn't work on Xcode 10.1(Swift 4.2.1) or earlier(ABI not supported version) as written #103.

I think that It is difficult to satisfy both of the following πŸ€”

el-hoshino commented 5 years ago

Maybe CocoaPods may fix this later πŸ€” https://github.com/CocoaPods/CocoaPods/issues/8649

el-hoshino commented 5 years ago

I guess one of the workarounds we can do now is to deploy different versions for CocoaPods and Homebrew with different versions specified in .podspec file and formula file πŸ˜„

mono0926 commented 5 years ago

Closed by #104 mistakenly πŸ€•

mono0926 commented 5 years ago

I've released 2.5.0 and all problems have been fixed as far as I confirmed.

. Xcode 10.1(Swift 4.2.1) or earlier Xcode 10.2(Swift 5.0) or later
Build βœ… βœ…
Homebrew βœ… βœ…
CocoaPods βœ… βœ…

My environment


I prepared different build, and use it for CocoaPods build with Xcode 10.1:

https://github.com/mono0926/LicensePlist/blob/439d7ae9d7afe976228a7207bdee167ff4103182/Makefile#L8-L11

https://github.com/mono0926/LicensePlist/blob/2a2fcb1eacebe6696dcbaf3e65fa0a56411b9d19/Makefile#L29-L34

https://github.com/mono0926/LicensePlist/blob/2a2fcb1eacebe6696dcbaf3e65fa0a56411b9d19/release.sh#L70

el-hoshino commented 5 years ago

Confirmed on both my personal environment and my CI (Bitrise) environment πŸŽ‰

el-hoshino commented 5 years ago

But BTW, DEVELOPER_DIR=/Applications/Xcode-10.1.app/Contents/Developer ←does it work for those who don't have Xcode-10.1.app app in their /Application directory...?

mono0926 commented 5 years ago

@el-hoshino

Thanks for the confirmation πŸ‘

But BTW, DEVELOPER_DIR=/Applications/Xcode-10.1.app/Contents/Developer ←does it work for those who don't have Xcode-10.1.app app in their /Application directory...?

No, but it is used for releasing new CocoaPods version, so there are no problems for normal users. Maintainer(only me, currently) should have Xcode-10.1.app app in their /Application directory.

zandercodes commented 5 years ago

I am using xcode 10.2.1 and installed it via brew without any problems.

mono0926 commented 5 years ago

@zandercodes Thanks πŸ‘