Skip to content

XCFramework: Unknown library type with extension 'so' in library 'linux-aarch64' #1250

Description

@vsarunas

Trying to compile on Linux with 6.3:

swift build --build-system swiftbuild --experimental-xcframeworks-on-linux

Gives an error:

error: Failed to load XCFramework at '.build/artifacts/ordo-sdk/OrdoSDK-OrdoPublic/OrdoPublic.xcframework': Unknown library type with extension 'so' in library 'linux-aarch64'.

It seems need to do add additional support in swift-build to handle Linux and dynamic libraries for Linux?
@owenv , is it just a matter of changing several ifdef definitions depending on which platform the code is running on and picking the correct name? I can help out with this.

Running this test fails slightly differently:

swift test --filter FunctionalTests.SwiftPMTests/libraryEvolutionLinuxXCFramework --build-system swiftbuild --experimental-xcframeworks-on-linux

stderr: error: 'swiftframework': Invalid manifest (compiled with: ["/usr/local/share/toolchains/6.3.0/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.6DK79V/vfs.yaml", "-L", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-swift-version", "6", "-I", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-package-description-version", "6.0.0", "-module-cache-path", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "/tmp/Miscellaneous_LibraryEvolutionLinuxXCF.AzjUMO/SwiftFramework/Package.swift", "-o", "/tmp/TemporaryDirectory.lR8kV8/swiftframework-manifest"])
/tmp/TemporaryDirectory.lR8kV8/swiftframework-manifest: error while loading shared libraries: /libPackageDescription.so: cannot open shared object file: No such file or directory
error: 'swiftframework': Invalid manifest (compiled with: ["/usr/local/share/toolchains/6.3.0/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.MNO5NI/vfs.yaml", "-L", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-swift-version", "6", "-I", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-package-description-version", "6.0.0", "-module-cache-path", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "/tmp/Miscellaneous_LibraryEvolutionLinuxXCF.AzjUMO/SwiftFramework/Package.swift", "-o", "/tmp/TemporaryDirectory.LS5RlY/swiftframework-manifest"])
/tmp/TemporaryDirectory.LS5RlY/swiftframework-manifest: error while loading shared libraries: /libPackageDescription.so: cannot open shared object file: No such file or directory

✘ Test libraryEvolutionLinuxXCFramework() recorded an issue at LibraryEvolutionXCFLinuxTests.swift:18:6: Caught error: terminated(1): /export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux/swift-build --package-path /tmp/Miscellaneous_LibraryEvolutionLinuxXCF.AzjUMO/SwiftFramework --configuration debug --build-system native --scratch-path /tmp/TemporaryDirectory.csevYp/.build output:
    error: 'swiftframework': Invalid manifest (compiled with: ["/usr/local/share/toolchains/6.3.0/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.6DK79V/vfs.yaml", "-L", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-swift-version", "6", "-I", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-package-description-version", "6.0.0", "-module-cache-path", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "/tmp/Miscellaneous_LibraryEvolutionLinuxXCF.AzjUMO/SwiftFramework/Package.swift", "-o", "/tmp/TemporaryDirectory.lR8kV8/swiftframework-manifest"])
    /tmp/TemporaryDirectory.lR8kV8/swiftframework-manifest: error while loading shared libraries: /libPackageDescription.so: cannot open shared object file: No such file or directory
    error: 'swiftframework': Invalid manifest (compiled with: ["/usr/local/share/toolchains/6.3.0/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.MNO5NI/vfs.yaml", "-L", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-swift-version", "6", "-I", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "-package-description-version", "6.0.0", "-module-cache-path", "/export/home/sarunas/swift-package-manager/.build/out/Products/Debug-linux", "/tmp/Miscellaneous_LibraryEvolutionLinuxXCF.AzjUMO/SwiftFramework/Package.swift", "-o", "/tmp/TemporaryDirectory.LS5RlY/swiftframework-manifest"])
    /tmp/TemporaryDirectory.LS5RlY/swiftframework-manifest: error while loading shared libraries: /libPackageDescription.so: cannot open shared object file: No such file or directory
✘ Test libraryEvolutionLinuxXCFramework() failed after 0.950 seconds with 1 issue.
✘ Suite SwiftPMTests failed after 0.951 seconds with 1 issue.

Can start locally Linux via:

container run -ti  -v ./swift-package-manager:/swift-package-manager  swiftlang/swift:nightly-main-noble bash
apt-get update
apt-get install libsqlite3-dev libncurses6 libncurses5-dev libncursesw5-dev -y

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions