tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.85k stars 320 forks source link

any way to compile for osx with the distro provided clang and lld? #320

Closed dvc94ch closed 2 years ago

dvc94ch commented 2 years ago

seems like it should be possible in principle these days?

tpoechtrager commented 2 years ago

You can use your distro's provided clang but not lld.

dvc94ch commented 2 years ago

is this the reason?

ld64.lld: error: unable to locate re-export with install name /usr/lib/system/libcache.dylib
dvc94ch commented 2 years ago

so was able to cross compile a rust hello world with the following .cargo/config using the distro clang and lld. no idea if the binary works yet as I don't have a mac to test it on.

[target.x86_64-apple-darwin]
rustflags = [
    "-C", "link-arg=-target",
    "-C", "link-arg=x86_64-apple-darwin",
    "-C", "link-arg=-fuse-ld=lld",
    "-C", "link-arg=-mmacosx-version-min=10.10",
    "-C", "link-arg=-v",
    "-C", "link-arg=-isystem",
    "-C", "link-arg=/home/dvc/MacOSX10.10.sdk",
    "-L", "/home/dvc/MacOSX10.10.sdk/usr/lib",
    "-L", "/home/dvc/MacOSX10.10.sdk/usr/lib/system",
]
linker = "clang"