tpoechtrager / osxcross

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

Generating an SDK package without a full Xcode, including libc++ headers #240

Open torokati44 opened 4 years ago

torokati44 commented 4 years ago

There are many sources of MacOS SDK packages online, of varying quality. One common issue with the modern versions is that the C++ standard (libc++) headers are missing. This is because apparently they have been moved out of the SDK folders into a common location. New versions of gen_sdk_package.sh finds and includes these as well, but still, they are not included in the packages provided by phracker or alexey-lysiuk. Another possible source of issues might be that the SDK folder makes heavy use of symlinks, and some archive tools might mess those up.

Generating the SDK package from scratch is problematic because it requires an Xcode install (or at least an installer file), which is not easily acquired without an Apple Developer account, and to create that, you have to enter your (or at least "some") credit card info. This is ridiculous in my opinion.

So, I tried to generate this package from my macOS system, with no Xcode installed on it, just with the "Xcode Command Line Tools" installed. - Installing this, by the way, is really easy (at least on 10.15): just type gcc or make in the Terminal, and you get a nice dialog asking if you want to install them; no need for an Apple account or anything like that.

After this step, everything that should go into the package seemed to be present, so I stripped down the original gen_sdk_package.sh script to look for the folders in a different location. It seemed to generate a reasonable package that I could use to build OSXCross successfully.

Here it is: https://gist.github.com/torokati44/8d9a4b6f1d298f8cc4b0db677f9be515

I'm just putting it here in the hope that it will be useful for somebody in the future, or maybe even incorporated into the project. Note that not much thought went into it, this is just the first version that worked at least for me, at least once, on macOS 10.15. Feel free to improve it in any way you like.