swift icon indicating copy to clipboard operation
swift copied to clipboard

[static-stdlib] Move static-executable-args.lnk under stdlib/public/Resources/linux

Open kateinoigakukun opened this issue 2 years ago • 6 comments

This is a preparatory change for adding a static executable support for WASI

kateinoigakukun avatar Jun 07 '23 19:06 kateinoigakukun

@swift-ci Please smoke test

kateinoigakukun avatar Jun 07 '23 19:06 kateinoigakukun

@swift-ci Please smoke test

kateinoigakukun avatar Jun 08 '23 11:06 kateinoigakukun

@swift-ci build toolchain

MaxDesiatov avatar Jun 08 '23 14:06 MaxDesiatov

I tested the built toolchain and it looks working at least for a simple scenario

$ curl https://download.swift.org/tmp/pull-request/66423/470/ubuntu2004/PR-ubuntu2004.tar.gz | tar xz
$ echo 'print("Hello")' > main.swift
$ ./usr/bin/swiftc main.swift -static-executable
$ ./main

kateinoigakukun avatar Jun 09 '23 07:06 kateinoigakukun

Please also test a simple async @main function with static linking on Linux, which implicitly requires Dispatch. We had multiple regressions in that area recently, so I'm cautious about changes in that area.

MaxDesiatov avatar Jun 09 '23 07:06 MaxDesiatov

Sure! I've tested with the following snippets and they work well

@main
struct Main {
  static func main() {
    print("ok")
  }
}
@main
struct Main {
  static func main() async {
    try! await Task.sleep(nanoseconds: 1000)
    print("ok")
  }
}
import Foundation

@main
struct Main {
  static func main() {
    print("ok", UUID())
  }
}

And checked .lnk is installed in the correct place usr/lib/swift_static/linux/static-executable-args.lnk

kateinoigakukun avatar Jun 09 '23 08:06 kateinoigakukun