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

The following build commands failed: PhaseScriptExecution [CP-User]\ Download\ libsignal-ffi\ if\ not\ in\ cache #574

Closed
amirvatani opened this issue May 7, 2024 · 9 comments

Comments

@amirvatani
Copy link

amirvatani commented May 7, 2024

**when i try to use a path-based dependency to treat LibSignalClient as a development pod.

this command finished successfuly :

CARGO_BUILD_TARGET=x86_64-apple-ios swift/build_ffi.sh --release

but in this command. :

pod lib lint \
  --platforms=ios \
  --include-podspecs=../SignalCoreKit/SignalCoreKit.podspec \
  --skip-import-validation \
  --verbose

i get this error :**

Copy /X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Products/Debug-iphonesimulator/LibSignalClient_Unit_Tests.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo /X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/LibSignalClient-Unit-Tests.build/Objects-normal/arm64/LibSignalClient_Unit_Tests.swiftsourceinfo (in target 'LibSignalClient-Unit-Tests' from project 'Pods')
        cd /var/folders/t8/9ypzgkj93l5fnl31960krc1h0000gn/T/CocoaPods-Lint-20240508-12519-6eudz8-LibSignalClient/Pods
        builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks -rename /X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/LibSignalClient-Unit-Tests.build/Objects-normal/arm64/LibSignalClient_Unit_Tests.swiftsourceinfo /X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Products/Debug-iphonesimulator/LibSignalClient_Unit_Tests.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo
    
    SwiftDriverJobDiscovery normal arm64 Compiling TestCaseBase.swift, TestUtils.swift (in target 'LibSignalClient-Unit-Tests' from project 'Pods')
    
    /var/folders/t8/9ypzgkj93l5fnl31960krc1h0000gn/T/CocoaPods-Lint-20240508-12519-6eudz8-LibSignalClient/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'CocoaLumberjack' from project 'Pods')
    warning: Run script build phase '[CP-User] Download and cache libsignal-ffi' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'LibSignalClient' from project 'Pods')
    
    Testing failed:
    Test session results, code coverage, and logs:
    	/X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Logs/Test/Run-LibSignalClient-Unit-Tests-2024.05.08_02-28-06-+0330.xcresult
    	No such file or directory: '/X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Intermediates.noindex/Pods.build/libsignal_ffi/target/aarch64-apple-ios-sim/release/libsignal_ffi.a'
    
    	Testing cancelled because the build failed.
    
    ** TEST FAILED **
    
    
    The following build commands failed:
    	Ld /X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Products/Debug-iphonesimulator/LibSignalClient/LibSignalClient.framework/LibSignalClient normal (in target 'LibSignalClient' from project 'Pods')
    (1 failure)
 -> LibSignalClient (0.44.0)
    - ERROR | xcodebuild: Returned an unsuccessful exit code.
    - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    - NOTE  | xcodebuild:  note: Building targets in dependency order
    - NOTE  | [iOS] xcodebuild:  note: Target dependency graph (3 targets)
    - NOTE  | xcodebuild:  note: Metadata extraction skipped. No AppIntents.framework dependency found. (in target 'SignalCoreKit' from project 'Pods')
    - WARN  | xcodebuild:  /X/Desktop/libsignal/swift/Sources/LibSignalClient/Logging.m:44:18: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
    - WARN  | xcodebuild:  /X/Desktop/libsignal/swift/Sources/LibSignalClient/Logging.m:49:53: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
    - NOTE  | xcodebuild:  clang: error: no such file or directory: '/X/Library/Developer/Xcode/DerivedData/App-gdkmgucnghnbhwgolhgdpkrgdtsh/Build/Intermediates.noindex/Pods.build/libsignal_ffi/target/aarch64-apple-ios-sim/release/libsignal_ffi.a'
    - NOTE  | xcodebuild:  warning: Run script build phase '[CP-User] Download and cache libsignal-ffi' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'LibSignalClient' from project 'Pods')
    - NOTE  | xcodebuild:  Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'CocoaLumberjack' from project 'Pods')
    - NOTE  | [iOS] xcodebuild:  note: Target dependency graph (4 targets)

[!] LibSignalClient did not pass validation, due to 1 error and 2 warnings.
You can use the `--no-clean` option to inspect any issue.


and when i try to use libsignal as CocoaPod in my react native ( Expo ) ios using, again it fails at The following build commands : PhaseScriptExecution [CP-User]\ Download\ libsignal-ffi\ if\ not\ in\ cache

logs :

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
To view more error logs, try building the app with Xcode directly, by opening /Users/amirhossein/Desktop/expo-libsignal-client/example/ios/expolibsignalclientexample.xcworkspace.

Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace /Users/amirhossein/Desktop/expo-libsignal-client/example/ios/expolibsignalclientexample.xcworkspace -configuration Debug -scheme expolibsignalclientexample -destination id=D38D8572-3E98-465F-8554-9146F04EC375

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Prepare packages

ComputeTargetDependencyGraph
note: Building targets in dependency order
note: Target dependency graph (65 targets)
    Target 'expolibsignalclientexample' in project 'expolibsignalclientexample'
        ➜ Implicit dependency on target 'Pods-expolibsignalclientexample' in project 'Pods' via file 'Pods_expolibsignalclientexample.framework' in build phase 'Link Binary'
        ➜ Implicit dependency on target 'CocoaLumberjack' in project 'Pods' via options '-framework CocoaLumberjack' in build setting 'OTHER_LDFLAGS'
        


--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:D38D8572-3E98-465F-8554-9146F04EC375, OS:17.4, name:iPhone SE (3rd generation) }
{ platform:iOS Simulator, id:D38D8572-3E98-465F-8554-9146F04EC375, OS:17.4, name:iPhone SE (3rd generation) }
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution [CP-User]\ Download\ libsignal-ffi\ if\ not\ in\ cache /Users/amirhossein/Library/Developer/Xcode/DerivedData/expolibsignalclientexample-bzodidldhyimvpevehgkkklhqvsr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/LibSignalClient.build/Script-46EB2E0001EEC0.sh (in target 'LibSignalClient' from project 'Pods')
(1 failure)
Build logs written to /Users/amirhossein/Desktop/expo-libsignal-client/example/.expo/xcodebuild.log

and it is my pod file :

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']

platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4'
install! 'cocoapods',
  :deterministic_uuids => false

prepare_react_native_project!
flipper_config = FlipperConfiguration.disabled
if ENV['NO_FLIPPER'] == '1' then
  flipper_config = FlipperConfiguration.disabled
elsif podfile_properties.key?('ios.flipper') then
  if podfile_properties['ios.flipper'] == 'true' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"])
  elsif podfile_properties['ios.flipper'] != 'false' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] })
  end
end

target 'expolibsignalclientexample' do
  pod 'LibSignalClient', :git => 'https://github.com/signalapp/libsignal.git'
  pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git' , :modular_headers => true 
  ENV['LIBSIGNAL_FFI_PREBUILD_CHECKSUM'] = 'efa1ba4cef14c220714fbc657bd104b5c01df0b9e15a33836c112278150460d6'
          
  use_expo_modules!
  config = use_native_modules!

  use_frameworks! 
 
  

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    :flipper_configuration => flipper_config
  )

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )


    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

full XCode Build logs are here

@jrose-signal
Copy link
Contributor

The pod lib lint error is because pod lib lint expects both simulator targets to be present, even though it'll only test one of them. For the xcodebuild failure, you'd need to share the full error logs for that build phase for us to make any guesses about what went wrong.

@amirvatani
Copy link
Author

@jrose-signal i just edited the issue , you can find the full logs file at the end of the issue

@matinrn
Copy link

matinrn commented May 12, 2024

same here

@amirvatani
Copy link
Author

report

i add ENV['LIBSIGNAL_FFI_PREBUILD_ARCHIVE'] = 'libsignal-client-ios-build-v0.46.0.tar.gz' to my podFile ,

and also build manually using (CARGO_BUILD_TARGET=aarch64-apple-ios-sim swift/build_ffi.sh --release)

now all errors fixed in all tests pass successfully,

now i get the following error when trying to run ios from terminal ( errors generated in xcode attached in the image )

› Copying   ios/expolibsignalclientexample/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling expolibsignalclientexample » SplashScreen.storyboard
› Preparing expolibsignalclientexample » Info.plist
› Compiling expolibsignalclientexample » main.m
› Compiling expolibsignalclientexample » expolibsignalclientexample_vers.c
› Compiling expolibsignalclientexample » AppDelegate.mm
› Linking   expolibsignalclientexample » expolibsignalclientexample
⚠️  ld: ignoring duplicate libraries: '-lc++'
⚠️  ld: Could not find or use auto-linked library 'signal_ffi': library 'signal_ffi' not found
⚠️  ld: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
❌  Undefined symbols for architecture arm64
┌─ Symbol: _signal_address_clone
└─ Referenced from: static LibSignalClient.ProtocolAddress.cloneNativeHandle(_: inout Swift.OpaquePointer?, currentHandle: Swift.OpaquePointer?) -> Swift.OpaquePointer? in LibSignalClient[5](Address.o)


❌  ld: symbol(s) not found for architecture arm64



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



› 3 error(s), and 3 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
xcode error

@jrose-signal
Copy link
Contributor

ld: Could not find or use auto-linked library 'signal_ffi': library 'signal_ffi' not found

Now that you're building for a real device, you have to use the real device's target triple for CARGO_BUILD_TARGET when you build_ffi.sh. x86 simulator, arm64 simulator, and arm64 device are all separate.

@amirvatani
Copy link
Author

@jrose-signal i get the above errors ( in xcode image )when i run using pod in xcode ,
but when i want to build it manually using :

CARGO_BUILD_TARGET=x86_64-apple-ios swift/build_ffi.sh --release --generate-ffi

i got these errors ( available in the url ) : Logs

my toolchain list

`
amirhossein@Amirhosseins-MacBook-Pro libsignal % rustup toolchain list

  • stable-aarch64-apple-darwin
  • nightly-2024-01-08-aarch64-apple-darwin (override)
  • nightly-2024-01-08-x86_64-apple-darwin
  • nightly-aarch64-apple-darwin (default)

`

my target list

`
amirhossein@Amirhosseins-MacBook-Pro libsignal % rustup target list

  • aarch64-apple-darwin
  • aarch64-apple-ios
  • aarch64-apple-ios-sim
  • x86_64-apple-darwin (installed)
  • x86_64-apple-ios (installed)

`

@jrose-signal
Copy link
Contributor

Ah, you need a newer version of cbindgen too. Sorry the instructions for that are incorrect! The latest version should work instead of the ^16.0 that's listed.

@amirvatani
Copy link
Author

@jrose-signal now it ends with lots of warning ( log ),
now i get xcode error ( avaiable in above image ) using both of these :

Screenshot 2024-05-14 at 22 10 31

@jrose-signal
Copy link
Contributor

As noted, you need to build all three targets for libsignal_ffi.a if you are using LibSignalClient as a path-based dependency.

This is ultimately not a support channel. Please take this to https://community.signalusers.org.

@jrose-signal jrose-signal closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants