1

I'm building a Swift package which should work for MacOS and Linux.

I have tried specifying the platform like so:

let package = Package(
    name: "MyPackage",
    platforms: [
        .macOS,
        .linux
    ],
...

However I get this error:

| /.../Package.swift:10:10: Type 'Array.ArrayLiteralElement' (aka 'SupportedPlatform') has no member 'linux'

It seems like this should be allowed according to the documentation:

Supporting Linux

static let linux: Platform

The Linux platform.

What am I missing here?

sak
  • 2,612
  • 24
  • 55
  • In my experience with SPM, we need to specify the platform and version. `.iOS(.v15)` – Jake Jul 30 '22 at 23:35

1 Answers1

1

I know it doesn't sound right, but so far (2/7/2023) you don't have to add .linux in your Package.swift. This is what I have:

platforms: [
    .macOS(.v10_12),
],

And the package can be compiled under Ubuntu. Give it a try.

superarts.org
  • 7,009
  • 1
  • 58
  • 44