Swift cross compile to single linux binary

前端 未结 2 824
傲寒
傲寒 2021-02-04 02:19

Is it possible to compile a swift binary from an OS X computer so that it runs on a server running Linux as a single binary without no extra libraries that need to be dynamicall

2条回答
  •  忘了有多久
    2021-02-04 02:31

    From reading the sources on github

    • target would be Linux
    • machine would be x86_64

    This gets called by the primary build script

    This how ever answers a part of the question

    The exact value for -target seems to be rather elusive.

    Install a GCC toolchain for Mac OSX that can retarget Linux, one repo that I can see is OSXCross, for example.

    Supply the values to the environment variables to GCC prior to running the script, that references that toolchain.

    Unfortunately, that does not guarantee it will work, but give it a try and see what happens.

提交回复
热议问题