Mercury-Language / mercury

The Mercury logic programming system.
Other
904 stars 54 forks source link

Does it matter if a bootstrap C compiler supports C11? #128

Open barracuda156 opened 7 months ago

barracuda156 commented 7 months ago

macOS on PowerPC uses by default gcc-4.2, which does not support C11. Modern gcc is available and works fine (I use gcc-13.2.0 mostly on PowerPC), but it is an additional and quite heavy dependency to build. So if there is no benefit in using a modern gcc, we rather use the old Xcode one.

Could someone advise on this matter?

juliensf commented 7 months ago

Mercury requires support for fairly large subset of C99 (specifically, the subset that Microsoft have deigned to support in recent versions of MSVC). C11 support should not be required.

barracuda156 commented 7 months ago

C99 should be supported in gcc-4.2. Sometime requires passing -std=C99, but so far mercury is building without interventions beyond disabling -Werror (which, I think, will not be compiler-dependent, but rather a specificity of system headers).

barracuda156 commented 7 months ago

On a side note, for some reason different targets are picked on macOS PowerPC vs macOS aarch64: hlc + reg on the first but hlc + none on the second (plus java on aarch64, but no surprise it is unsupported on ppc).

juliensf commented 7 months ago

The configure script ought to be able to work out if enough of C99 is supported to compile Mercury. The different grade selection on PowerPC and aarch64 is deliberate. That said, I don't think the PowerPC port has been tested much since about 2010.

barracuda156 commented 7 months ago

@juliensf It is quite painful to build on PowerPC, since apparently only one cpu core is used by the build system. Running for 3 hrs already, and just began compiling reg.gc.debug.stseg. Even 1 core is not fully loaded. (Though to be honest it was slow to build even on M1.) But it seems to build smoothly. I am curious whether it gonna actually work, but chances are it will.

juliensf commented 7 months ago

Building using multiple cores should work. It should just be a matter of:

 $ make PARALLEL=-j4

(Or whatever your preferred number of cores is.)

barracuda156 commented 7 months ago

Oh, that would have saved me a few hours :) It will probably complete reasonably soon, I won’t risk interrupting already (Macports builds post-initial-bootstrap stages in destroot, and I am not sure it resumes if stopped).

UPD. I tried on arm64 now, and yes, it works. Thank you.