pinterest / PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X
Apache License 2.0
2.66k stars 361 forks source link

`make carthage` Fails On Xcode 12 #285

Closed altonlau closed 4 years ago

altonlau commented 4 years ago

Error

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_PINOperationGroup", referenced from:
      objc-class-ref in PINCache.o
  "_OBJC_CLASS_$_PINOperationQueue", referenced from:
      objc-class-ref in PINCache.o
      objc-class-ref in PINMemoryCache.o
      objc-class-ref in PINDiskCache.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Repro Steps

I am using Xcode 12 You will need to use the workaround introduced in https://github.com/Carthage/Carthage/issues/3019#issuecomment-664099506.

  1. Create a file called carthage_workaround.xcconfig with the workaround mentioned above
    EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
    EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))
  2. Run XCODE_XCCONFIG_FILE=carthage_workaround.xcconfig make carthage

Investigation

I suspect this has something to do with how PINCache links PINOperations twice for Carthage:

Testing Theory

https://github.com/pinterest/PINCache/pull/282 addresses the theory about Carthage building PINOperations twice causing some linking confusion. I ran the repro steps with that branch and the error went away.

garrettmoon commented 4 years ago

@altonlau is this fixed now that #282 is merged?

altonlau commented 4 years ago

@garrettmoon yes I can close this. Thanks!