-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
What happened?
When attempting to link with a SPM package that contains both iOS & macOS dependencies, an .o file is not generated for the macOS dependency and the binary target .xcframework it includes is not copied to DerivedData.
This results in the following error:
If I manually edit the .xcconfig and remove -l"SamplePackageB-macOS.o", I am met with a new error related to the .xcframework it includes (LAME.xcframework):
If I remove both -l"SamplePackageB-macOS.o" and -framework "LAME" I am able to compile successfully.
When importing SamplePackageA through native SPM (not via cocoapods-spm), this is not an issue.
Since the .xcconfig is generated upon pod install, you will need to do that locally, but feel free to use this branch on my fork: kalub92/macos-dependency-framework-issue
CocoaPods environment
Stack
CocoaPods : 1.14.3
Ruby : ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21]
RubyGems : 3.3.3
Host : macOS 14.5 (23F79)
Xcode : 15.4 (15F31d)
Git : git version 2.44.0
Ruby lib dir : /Users/cstultz/.rvm/rubies/ruby-3.1.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
Installation Source
Executable Path: /Users/cstultz/.rvm/gems/ruby-3.1.0/bin/pod
Plugins
cocoapods-compact-spec : 0.0.3
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-spm : 0.1.5
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
cocoapods-xcconfig-hooks : 0.0.1
Podfile
platform :ios, "16.0"
linkage = (ENV["LINKAGE"] || :static).to_sym
use_frameworks! :linkage => linkage
puts "Using linkage: #{linkage}"
@checksum = "dummy-checksum-to-prevent-merge-conflicts"
plugin "cocoapods-spm"
plugin "cocoapods-xcconfig-hooks"
def dont_use_macros?
ENV["NO_MACROS"] == "true"
end
config_compact_spec(
extra: ->(s) { s.ios.deployment_target = "16.0" }
)
config_cocoapods_spm(
dont_prebuild_macros: true,
default_macro_config: "debug"
)
def spm_pods
spm_pkg "SamplePackageA",
:git => "https://github.com/kalub92/SamplePackageA.git",
:branch => "withHyphenatedDependency"
end
abstract_target 'Example' do
spm_pods
target "EX" do
pod "Logger", :path => "LocalPods/Logger"
# pod "Services", :path => "LocalPods/Services"
spm_pkg "SnapKit",
:url => "https://github.com/SnapKit/SnapKit.git",
:version => "5.7.1",
:products => ["SnapKit-Dynamic"]
spm_pkg "SwiftUIX", :git => "https://github.com/SwiftUIX/SwiftUIX.git", :tag => "0.1.9"
spm_pkg "SwiftyBeaver", :git => "https://github.com/SwiftyBeaver/SwiftyBeaver.git", :tag => "2.0.0"
spm_pkg "opentelemetry-swift",
:git => "https://github.com/open-telemetry/opentelemetry-swift.git",
:branch => "main",
:products => ["OpenTelemetrySdk"]
spm_pkg "GoogleMaps",
:git => "https://github.com/googlemaps/ios-maps-sdk.git",
:version => "8.4.0",
:products => ["GoogleMaps", "GoogleMapsBase", "GoogleMapsCore"]
spm_pkg "DebugKit", :path => "LocalPackages/debug-kit"
spm_pkg "braze-segment-swift",
:url => "https://github.com/braze-inc/analytics-swift-braze.git",
:version => "2.2.0",
:products => [
"SegmentBraze",
"SegmentBrazeUI"
]
spm_pkg "Segment",
:url => "https://github.com/segmentio/analytics-swift.git",
:version => "1.5.11"
spm_pkg "SegmentFirebase",
:url => "https://github.com/segment-integrations/analytics-swift-firebase.git",
:version => "1.1.3"
end
target "EXTests" do
pod "NetworkTestKit", :path => "LocalPods/NetworkTestKit"
pod "AppTestKit", :path => "LocalPods/AppTestKit"
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete "IPHONEOS_DEPLOYMENT_TARGET"
end
end
if dont_use_macros?
path = Pathname.new(".xcconfigs/__base__.xcconfig")
path.parent.mkpath
path.write("SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) NO_MACROS")
end
endAnything else?
No response

