Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Cross compilation is always easy when there are no dependencies to the target platform SDKs. When it goes beyond basic libc stuff, then it is when the fun starts.


It seems fairly straightforward - copy over the SDK header files and libraries to the project and then add these envs to the build:

    CC="/path/to/cross/compiler" CGO_CFLAGS=—I/path/to/sdk/header/files/include" CGO_LDFLAGS="-L/path/to/sdk/obj/files/lib”
I suppose with .so files, you might have to specify "-Wl,-rpath" if the SDK libraries don’t reside under /usr/lib or /usr/local/lib on the target system. But I haven’t actually tried any of this yet, so I could be wrong. Are there any gotchas that I’m missing?


Now do the same as Windows UWP SDK, or iOS SDK.

You're missing all the tooling and OS specific steps required to produce a proper package.



Doesn't seem to do IO Kit, DriverKit, Metal, Instruments Plugins, UI frameworks, XPC, and plenty of other stuff dependent on Objective-C/Swift.


I believe it would work for all of that, given that it links to the same libraries an app made with Xcode would.

That repository won't compile Swift, but it does compile objective C.

Either way, you don't need to be able to compile Swift/Obj C to link to a library that was written in Swift/Obj C.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: