giginet / Scipio

A new build tool to generate XCFramework

Home Page:https://giginet.github.io/Scipio/documentation/scipio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not possible to use Scipio to build some of the popular frameworks

mikeger opened this issue Β· comments

Hey πŸ‘‹

I've tried to use Scipio for my project, but I've found a couple of issues.
The following frameworks cannot be compiled:

SDWebImage

Compilation error

The following build commands failed:
	CompileC /Users/m.gerasymenko/Library/Developer/Xcode/DerivedData/RiderAppDependencies-hemauyjxyusqbydjtqogvbdpzofn/Build/Intermediates.noindex/ArchiveIntermediates/SDWebImageMapKit/IntermediateBuildFilesPath/RiderAppDependencies.build/Release-iphoneos/SDWebImage.build/Objects-normal/arm64/UIColor+SDHexString.o /Users/m.gerasymenko/Projects/logistics-rider-app-ios/.build/checkouts/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'SDWebImage' from project 'RiderAppDependencies')

GoogleTagManager

Compilation error

The following build commands failed:
	CompileC /Users/m.gerasymenko/Library/Developer/Xcode/DerivedData/RiderAppDependencies-hemauyjxyusqbydjtqogvbdpzofn/Build/Intermediates.noindex/ArchiveIntermediates/GoogleTagManagerTarget/IntermediateBuildFilesPath/RiderAppDependencies.build/Release-iphoneos/GoogleUtilities-NSData.build/Objects-normal/arm64/GULNSData+zlib.o /Users/m.gerasymenko/Projects/logistics-rider-app-ios/.build/checkouts/GoogleUtilities/GoogleUtilities/NSData+zlib/GULNSData+zlib.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'GoogleUtilities_NSData' from project 'RiderAppDependencies')
(1 failure)

Firebase

Seems that one of the sub-dependencies are not automatically linked.

xcodebuild: error: The project named "RiderAppDependencies" does not contain a scheme named "FirebaseStorageSwift". The "-list" option can be used to find the names of the schemes in the project.

Example Package.swift

// swift-tools-version:5.6

import PackageDescription

let package = Package(
    name: "RiderAppDependencies",
    platforms: [
        .iOS(.v11),
    ],
    products: [],
    dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk.git", exact: "8.15.0"),
        .package(url: "https://github.com/googleanalytics/google-tag-manager-ios-sdk.git", exact: "7.4.1"),
        .package(url: "https://github.com/vadymmarkov/Fakery", exact: "5.1.0"),
        .package(url: "https://github.com/SDWebImage/SDWebImage.git", exact: "5.8.2")
    ],
    targets: [
        .target(
            name: "RiderAppDependencies",
            dependencies: [
                .productItem(name: "FirebaseRemoteConfig", package: "firebase-ios-sdk"),
                .productItem(name: "FirebasePerformance", package: "firebase-ios-sdk"),
                .productItem(name: "FirebaseAnalytics", package: "firebase-ios-sdk"),
                .productItem(name: "FirebaseCrashlytics", package: "firebase-ios-sdk"),

                .productItem(name: "GoogleTagManager", package: "google-tag-manager-ios-sdk"),
                .productItem(name: "Fakery", package: "Fakery"),
                .productItem(name: "SDWebImage", package: "SDWebImage"),
                .productItem(name: "SDWebImageMapKit", package: "SDWebImage")
            ])
    ]
)

SDWebImage uses cSettings on Package.swift. Scipio can't treat this declaration correctly.
I'm going to fix this.

https://github.com/SDWebImage/SDWebImage/blob/master/Package.swift#L36-L37

I'm unable to build Firebase either. There is a third-party Package manifest that includes pre-built xcframework files though: https://github.com/akaffenberger/firebase-ios-sdk-xcframeworks

There is an in-depth discussion about this repo here: firebase/firebase-ios-sdk#6564

I've found another package that wouldn't build called SVGKit. This is an objective-c framework, which I suspect some parts of Firebase are too. Perhaps this could be a problem?

I had a look into this with another Objective-C library we use, that is a little simpler than Firebase. It's called SnowplowTracker.

Trying to build this with scipio produces build errors:

Verbose build output
$ mint run scipio prepare . --verbose
πŸ” Resolving Dependencies...
loading manifest for 'dependencies' v. unknown from cache
loading manifest for 'snowplow-objc-tracker' v. 5.0.0 from cache
loading manifest for 'fmdb' v. 2.7.7 from cache
loading manifest for 'dependencies' v. unknown from cache
/usr/bin/xcrun clang --version
/usr/bin/xcrun clang --version
⚠️ Existing FMDB.xcframework is outdated.
πŸ—‘οΈ Delete FMDB.xcframework
πŸ“¦ Building FMDB for iOS
/usr/bin/xcrun xcode-select -p
/usr/bin/xcrun --sdk iphoneos --show-sdk-path
/usr/bin/xcrun xcode-select -p
/Applications/Xcode-14.3.0.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild build /path/to/Dependencies/.build/scipio/manifest-Dependencies-iphoneos.pif --configuration Release --derivedDataPath /path/to/Dependencies/.build/scipio/DerivedData --buildParametersFile /path/to/Dependencies/.build/scipio/build-parameters-iphoneos.json --target FMDB
πŸš€ Combining into XCFramework...
/usr/bin/xcrun xcode-select -p
/Applications/Xcode-14.3.0.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild createXCFramework -framework /path/to/Dependencies/.build/scipio/DerivedData/Products/Release-iphoneos/PackageFrameworks/FMDB.framework -output /path/to/Dependencies/XCFrameworks/FMDB.xcframework
πŸ“¦ Building SnowplowTracker for iOS
/usr/bin/xcrun xcode-select -p
/usr/bin/xcrun --sdk iphoneos --show-sdk-path
/usr/bin/xcrun xcode-select -p
/Applications/Xcode-14.3.0.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild build /path/to/Dependencies/.build/scipio/manifest-Dependencies-iphoneos.pif --configuration Release --derivedDataPath /path/to/Dependencies/.build/scipio/DerivedData --buildParametersFile /path/to/Dependencies/.build/scipio/build-parameters-iphoneos.json --target SnowplowTracker
Unable to build for iOS
⚠️ Execution was terminated:
Build description signature: e810aa82ab806c81ffd2b0d4c4752809

Build description path: /path/to/Dependencies/.build/scipio/DerivedData/Intermediates.noindex/XCBuildData/e810aa82ab806c81ffd2b0d4c4752809.xcbuilddata

Building targets in dependency order
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FMDatabaseQueue", referenced from:

      objc-class-ref in SQLiteEventStore.o

ld: symbol(s) not found for architecture arm64

Undefined symbol: _OBJC_CLASS_$_FMDatabaseQueue
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Linker command failed with exit code 1 (use -v to see invocation)
πŸš€ Combining into XCFramework...
/usr/bin/xcrun xcode-select -p
/Applications/Xcode-14.3.0.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild createXCFramework -framework /path/to/Dependencies/.build/scipio/DerivedData/Products/Release-iphoneos/PackageFrameworks/SnowplowTracker.framework -output /path/to/Dependencies/XCFrameworks/SnowplowTracker.xcframework
Something went wrong during building
Execution was terminated:
error: unable to read the file at '/path/to/Dependencies/.build/scipio/DerivedData/Products/Release-iphoneos/PackageFrameworks/SnowplowTracker.framework/SnowplowTracker'


Error: Execution was terminated:
error: unable to read the file at '/path/to/Dependencies/.build/scipio/DerivedData/Products/Release-iphoneos/PackageFrameworks/SnowplowTracker.framework/SnowplowTracker'
Package.swift
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Dependencies",
    platforms: [
        .iOS(.v14),
    ],
    products: [],
    dependencies: [
        .package(url: "https://github.com/snowplow/snowplow-objc-tracker", exact: "5.0.0"),
    ],
    targets: [
        .target(
            name: "Dependencies",
            dependencies: [
                .product(name: "SnowplowTracker", package: "snowplow-objc-tracker"),
            ]),
    ]
)

However I was able to build with swift-create-xcframework:

$ swift create-xcframework --platform ios SnowplowTracker
...
xcframework successfully written out to: /path/to/snowplow-objc-tracker/SnowplowTracker.xcframework

Perhaps it might be worth comparing the differences between the generated xcodebuild commands of scipio and swift-create-xcframework?