You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+26-7
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# MacOS Software Development Kit changes #
2
2
3
-
These are experiments to cope with expected changes in Apple's approach to software development kits, specifically where to find the system headers (you'd expect `/usr/include`).
4
-
5
3
Apple's development environment is _Xcode_. They provide a cut-down version called the Command Line Tools for those of us who don't need to develop for iPhone or Apple Watch. Xcode includes SDKs for those platforms, the Command Line Tools just for macOS (MacOSX, internally).
6
4
5
+
## System includes ##
6
+
7
7
Up until Mojave, the Command Line Tools (which you get by `xcode-select --install`) automatically installed `/usr/include`. Apple's developer tools (`clang` etc) know where to find the includes in the current SDK, but GCC doesn't.
8
8
9
9
With Mojave, you need to install the headers by
@@ -21,7 +21,7 @@ However, [Apple say](https://developer.apple.com/documentation/xcode_release_not
21
21
22
22
So, what to do about it?
23
23
24
-
## GNAT CE 2019 ##
24
+
###GNAT CE 2019###
25
25
26
26
This work is prompted by AdaCore's GNAT GE 2019 release, which anticipates the lack of `/usr/include` by building the compiler using a system root inside the Xcode SDK:
27
27
```
@@ -38,10 +38,29 @@ You can fix the second by `-I/usr/local/include`, `-L/usr/local/lib`.
38
38
39
39
An alternative (without installing Xcode) would be to copy `ce2109-specs` to `$prefix/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/specs` (`ce2019-specs` was generated by `gcc -dumpspecs` and judicious editing).
40
40
41
-
## FSF GCC ##
41
+
I haven't done this for GNAT CE 2020.
42
+
43
+
### FSF GCC ###
44
+
45
+
A similar problem arises with FSF GCC, builds provided at [Sourceforge](https://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/). So far I've been building on El Capitan, which has none of these problems, but this approach will have to stop when the built compiler won't run on new macOS versions. A problem for another day! but, for now, the built compiler needs to be taught to look in the SDK.
46
+
47
+
I'm providing a modified `specs` on the same lines as above. `gcc9-specs` is the version for GCC 9.1.0; it adds both possible SDKs to the include search path, GCC will take the first one it finds (absent `/usr/include`). `gcc10-specs` is included (as just `specs`) in the native GCC 10.1.0 release at Sourceforge.
48
+
49
+
## Big Sur and system libraries ##
42
50
43
-
A similar problem arises with FSF GCC, builds provided at [Sourceforge](https://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/).
51
+
With Big Sur, Apple have carried this approach through to system libraries; there's no `/usr/lib`, instead the libraries that you need to link against are in the SDKs. The symptom of this problem is that FSF GCC won't link, reporting
52
+
```
53
+
ld: library not found for -lSystem
54
+
```
55
+
and the fix is to include `-L$SDK/usr/lib` in the linker command. This is in the latest version of `gcc10-specs` (commit 244ecb2).
44
56
45
-
The approach I'm planning to adopt for future releases is to disable System Integrity Protection (which prevents altering important system directories, and is normally Not Recommended) and copy `usr/include` from inside whichever SDK is installed to the normal place, then build the compiler as normal.
57
+
You can use this without installing by e.g. for Ada
58
+
```
59
+
gnatmake hello.adb -largs -specs=gcc10-specs
60
+
```
61
+
or for C (or C++, or Fortran!) by
62
+
```
63
+
gcc hello.c -specs=gcc10-specs
64
+
```
46
65
47
-
For users who haven't done this (the majority, I expect) I'll provide a modified `specs`on the same lines. `gcc9-specs` is the version for GCC 9.1.0; it adds both possible SDKs to the include search path, GCC will take the first one it finds (absent `/usr/include`).
66
+
You can install the change by copying `gcc10-specs`to `$prefix/lib/gcc/x86_64-apple-darwin15/10.1.0/specs` (note the file name change).
0 commit comments