GoogleSignIn-iOS icon indicating copy to clipboard operation
GoogleSignIn-iOS copied to clipboard

Undefined symbol: __llvm_profile_runtime when running unit/UI tests

Open ralzuhouri opened this issue 3 years ago • 2 comments

If I try to run my unit/UI tests, after I installed the GoogleSignIn package with the swift package manager I get this error:

`CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'CioMessagingPush' from project 'Customer.io') cd /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/SourcePackages/checkouts/customerio-ios export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name CioMessagingPush -Onone -enable-batch-mode -enforce-exclusivity=checked @/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/Objects-normal/arm64/CioMessagingPush.SwiftFileList -DSWIFT_PACKAGE -DDEBUG -DXcode -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk -target arm64-apple-ios13.0-simulator -g -module-cache-path /Users/ramy/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -profile-coverage-mapping -profile-generate -enable-testing -index-store-path /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Index/DataStore -swift-version 5 -I /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Products/Debug-iphonesimulator -I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib -F /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Products/Debug-iphonesimulator -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.4.sdk/Developer/Library/Frameworks -c -j8 -output-file-map /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/Objects-normal/arm64/CioMessagingPush-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/Objects-normal/arm64/CioMessagingPush.swiftmodule -Xcc -I/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/swift-overrides.hmap -Xcc -I/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/DerivedSources-normal/arm64 -Xcc -I/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/DerivedSources/arm64 -Xcc -I/Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/Build/Intermediates.noindex/Customer.io.build/Debug-iphonesimulator/CioMessagingPush.build/Objects-normal/arm64/CioMessagingPush-Swift.h -working-directory /Users/ramy/Library/Developer/Xcode/DerivedData/FavouritesPlus-ebpbztniqhhdnzguteiyrzhmjwoj/SourcePackages/checkouts/customerio-ios

Command CompileSwiftSources failed with a nonzero exit code `

Plus if I check the info panel in xCode I see the error: "Undefined symbol: __llvm_profile_runtime" until the GMTSessionFetcherCore target.

I am compiling with the flag '-fprofile-instr-generate'.

I also tried to enable code coverage for my target and for GTMSessionFetcherCore in my scheme, but I still get the error. Anybody has it? Any solution/workaround?

ralzuhouri avatar Jul 12 '22 16:07 ralzuhouri

to expand on the error a little, this is more of the error we get building for testing

Undefined symbols for architecture arm64:
  "___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in GTMSessionFetcherCore.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I see that this library is using s.dependency 'GTMSessionFetcher/Core', '~> 1.1' which resolves to the version of 1.7.2 is it possible for this library to support the latest 2.0.0 release which seems to have better support?

not sure if its a solution as unsure how to confirm if this would help or not.

simonarcher avatar Jul 12 '22 21:07 simonarcher

It seems like the issue we had was having imported both GoogleSignIn and GoogleSignInSwift packages when adding the package via SPM. After removing the package and re-adding it with just GoogleSignInSwift, then the error seems to have gone away. :) This issue can be closed then 🥳

simonarcher avatar Aug 10 '22 15:08 simonarcher