-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixincludes problem with SDKs 16.0 #11
Comments
there are some fixes queued up - waiting for some time to do release tests - I have, however, pushed the ones under test to the gcc-14-2-darwin branch (but not yet made a release) - is that what you've tested? |
@fxcoudert - ISTR you had a fix for this ? (I guess that also needs back-porting) |
I think it is r15-1697-g1dc14318155057 - will look at doing the back port to 14. over the weekend |
No, mine was gcc-14.2-darwin-r1 [edit] I don’t recognise the "gcc-14.2-darwin-r1 branch"? [edit2] I meant to say "gcc-14.2-darwin branch" -- which I've now found, after a 'git fetch' |
Is that error from a fresh compilation against the new Xcode and CLT? Or is that using a compiler built against CLT 15 on a system with CLT 16? Also, what SDK version was it compiled against, and is it being run against? I have one fix related to |
The compiler was built against CLT 15.3 and was reported to me having being run on a system with macOS 14.7 and Xcode 16.0. I find the same behaviour with macOS 15.0.1 and CLT 16.0 (and also with GCC 13.2, built from gcc-13.2-darwin-r0 against CLT 14.2). |
That's the issue: the compiler should be used with the same SDK they were built against. We don't have a systematic way to support running against a different SDK than the build one. |
so should I do the noted back port or is it not needed (assuming the criterion above is applied)? |
Commit 1dc143181550573c9c902fb7a3b495e9b409d0b0 should be backported to all branches. But I don't think this bug is related. |
Homebrew's GCC 14.2 (installed just now) manages to run just fine on a Sonoma system with CLT 16.0 and also with CLT 15.3. It looks to me as though HB builds GCC using the FSF distribution + patches derived from Iain's distribution here, is that right? I just applied those patches of FSF GCC 14.2.0, built with CLT 15.3, but the result fails with CLT 16.0. My interest is in supporting Ada users, and I need to minimise the difficulty they encounter in the macOS environment. Since raising this issue, I've of course advised people not to allow their machines to update to SDK 16 -- which isn't ideal. |
The fact is that SDKs from different Xcode releases can contain incompatible changes. Since the process of building GCC (unfortunately) captures some information from the SDK into the build - we cannot (as things stand) guarantee that a build made with Xcode N will work with Xcode N-1 or N+1 (it might, but that's a matter of luck). To make things as simple as possible for your end-users, I guess you could provide builds against Xcode 15 and 16, then they have to update their GCC if they update their Xcode? Everything is fixable - if we had a team of folks working on GCC for macOS for their $dayjob, we could surely do better - - but that's a long way from reality at the moment ;) |
Not sure how to do that. Trying to use a GCC built against CLT 15 to build a compiler against CLT 16 fails very early on in configure .. unable to build a C executable. |
Do you have both the CLT installations available? |
IFF you have Xcode CLT 16 installed, but you built the XC 15 one using on your configure line Where NN is the relevant Darwin version for the bootstrap toolchain (i.e. the one built against the MacOS14 SDK in Xcode 15). |
The goal here is for the bootstrap toolchain to use the SDK it was built against - not to try and use the updated one installed in Under these circumstances it can be better to be specific about the SDK you are using. Yes, we want it to be easier - which is why there's been an effort to reduce the dependency on fixincludes - but we cannot, unfortunately, get that dependency to 0 as things stand. |
In /Library/Developer I have CommandLineTools-15.3 and CommandLineTools-16.0, and a symlink CommandLineTools selecting which one I want to use. It would be great if xcode-select --switch worked, but it doesn’t (it looks OK, but fails when you try to use it). I’ll try your suggestion tomorrow when rested! I suspect I may have to build an intermediate compiler that doesn’t have my adventurous specs fix, which I still haven’t posted a BZ about, sorry:
|
At the risk of being repetitive - this is known to be broken - in particular, w.r.t. fixincludes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7988 |
Is this documented somewhere when using the precompiled gcc versions from gcc? Currently, I am also struggling with compiling gRPC. I don't want and will hijack this thread ;-). But this detail would interest me if this is documented somewhere. |
This worked just fine.
You won't be surprised to learn that this compiler fails against CLT 15.3!
|
actually, that might be the one fixed by the pending backport - don't know if I'll get to it today - still doing the weekly rebases. |
I've now pushed that back port too - tested on macOS 12 only so far - so not making a release just yet - but if you want to test if the latest allows you some more flexibility ... |
where are we with this issue? AFAIK I have now applied the relevant back ports - and just pushed a fix for another GCC/clang incompatibility. |
fixed in gcc-14.2-darwin-r2 |
Hi Iain, @iains I did a new xPack GCC build with r2. The x64 binaries are fine (built on 10.14.6 with CLT 10.3 and MACOSX_DEPLOYMENT_TARGET=10.13, tested on macOS 12.7.6 with CLT 14.2), but unfortunately the arm64 binaries still fail when running in a newer environment (my build machine is macOS 11.7 with CLT 13.2, and the GitHub test machine is a 14.7.1 with Xcode 15.4). The error is the well known stdio.h mismatch:
I read your comments about the lack of resources for fixing this. Unfortunately, apart from testing, there is not much I can do to help you. If your final resolution is that there is nothing to do to fix the arm64 GCC such that builds performed on 11.7 (+CLT 13.2) to run on later environments, I'm afraid all I can do is to document it as unusable and move forward. :-( |
Can you not update your build machine to a newer OS ? macOS11 is a bit of an odd version to stick with, particularly on an ARM machine - the later OS versions improve arm support quite a bit... |
Unfortunately not :-( xPack GCC is one of the 20+ projects that I build, and all binaries are based on older OSes (Ubuntu 18 for Linux, macOS 10.13 for x64 and macOS 11.7 for arm64). I have only one M1 Mac Mini, and it'll stay on 11.7 for the foreseeable future. It is a pity that only macOS GCC has this problem, all other projects built on older machines run just fine on recent versions. |
My previous statement that the x64 GCC is functional is not true. I paid one month of GitHub Team to get access to all GitHub runners, and so I was able to run tests on more versions. It looks like there is no difference between x64 and arm64, both fail on macOS 14 and 15. To conclude, with gcc-14.2-darwin-r2:
The Xcode version was obtained with I'm a bit confused why on macOS 14.7.1 CLT is 16.1 and Xcode is 15.4. The two runs are:
I'm running out of ideas of what else I can do to help. :-( @iains, any conclusion to this? Any chance to find a solution, or building GCC on an older version of macOS is a lost struggle? |
I regularly build GCC [x86_64 and arm64] on macOS 11, 12, 13 and 14 (with the relevant Xcode CLT for each) As we have noted - there is no easy solution for the fix includes incompatibilities between CLT versions (sometimes). However a compiler version for (e.g.) macOS11 should still be able to build binaries that run on macOS 12..14 .. after all you do not expect your existing apps to stop working when you update the OS, do you? That is, I would expect you can build perfectly functional compilers on all the versions where an earlier version is capable of building binaries that will run on a later one - and a later one is able to use -mmacosx-version-min= as needed. What is not currently and without significant effort supported is a compiler built with one SDK using a different SDK. Again, I would expect you can build working compilers for each platform version - maybe that's a pain - but after all you cannot run Xcode for macOS N on some arbitrary earlier macOS .. there are some constraints even there. limited hardware means I don't have a setup for macOS15 yet.. ... because of WG21 commitments I will not be able to poke at this for the next couple of weeks, I'd be very happy to make this my $dayjob and then we could try these extra improvements .. but until then .. |
Well, I have such a program built on macOS 11, which runs perfectly fine on macOS 11, 12 & 13. After I upgraded to 14 & 15, it failed. This program is called...
My build machine is 11.7 and I use
Yes, this seems to be a big challenge for GCC. :-(
For now I'll update the documentation to mention that the binaries work up to macOS 13, and switch all my test to clang. If, before the next major GCC release, you'll find a solution to make a GCC built on macOS 11 run properly on macOS 14 & 15, I'll gladly adopt it, otherwise I have no choice but discontinue the GCC binaries for macOS. :-( |
That's not the full situation - IFF the SDKs did not contain headers that needed correction, we would not have this issue. Since we cannot change the SDKs .. we have no choice but to work around issues. Anyway, you are free to do whatever you wish - the compiler will work within its constraints. |
I know it is different, but didn't clang manage to work around these issues? |
It does not have to work around some of the issues - because the extensions it supports (either accidentally or intentionally) like (for ex) using C++ features in C code, are obviously compatible with the SDK headers. However - the following still fires on clang. cat t.c:
FAOD: I am not disputing that the use of these functions can lead to code vulnerabilities - however, the deprecation should be opt-in - not forced on the end-user. When code is built with WError, this becomes a build fail (sure, there are work-arounds - but that involves changing every project that uses the compiler ... ) So we patch the header to make the deprecation opt-in.
|
Ah, so the extra patches for GCC are needed only to avoid the clang extensions?
Good to know. I am probably lucky, in the xPack project I compiled from sources about 70 open source projects and I don't remember encountering this issue. |
XCode & CLT 16.0 were released with macOS 14.7, and now we get e.g.
What would help?
The text was updated successfully, but these errors were encountered: