Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
Hello everyone, I have a couple questions. I have built gcc10-bootstrap on my G5 using macports. Can this be used to build ports other than newer versions of gcc? I'm trying to get numpy building again on ppc and one of the issues is the lack of gcc >= 8.4. My second question is, does it take much more than adding three lines to the gcc11+ portfiles to get them to build?

Hi, thanks for the interest.

As long as you builds for ppc (not ppc64 and not universal), getting gcc13 should be smooth: https://github.com/macports/macports-ports/pull/16843

I suggest going that way rather than making a custom hack to one portfile, which may work, but potentially introduces a further mess with Python stuff.

P. S. If the procedure does work and you have an extra minute, please comment in the PR linked, otherwise some folks there are uninterested to test personally but insist on multiple third-party confirmations… What can I say.
 

alphaer

macrumors newbie
Oct 6, 2021
12
1
Hi all,
I read the thread, but still cant get in mind: I have 10.5.8 ppc32 , what steps I should do to compile gcc 11 or 12
Please help
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
Hi all,
I read the thread, but still cant get in mind: I have 10.5.8 ppc32 , what steps I should do to compile gcc 11 or 12
Please help

Wait a couple of days in fact, I am sorting that out for Macports now.

P. S. If this is urgent, you can try from here: https://github.com/barracuda156/macports-ports/tree/gcc_move
(Do not use gcc-powerpc port yet (!): it builds fine, but will not work with the current Macports base. gcc13 should be usable.)
 
  • Like
Reactions: Aaferti_Kuazar

iMacker20

macrumors newbie
May 12, 2020
12
5
Could you provide an installer please? To create one in MacPorts use this command:
sudo port mpkg gcc14
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
Could you provide an installer please? To create one in MacPorts use this command:
sudo port mpkg gcc14

For which OS? For 10.6 I have it available as pre-built port. For 10.5 I did not build it myself, as of now.
 

iMacker20

macrumors newbie
May 12, 2020
12
5
I use Mac OS 10.5 x86 64-bit, so maybe I could use the PowerPC version thru Rosetta. If a native x86 version was made that would be better. Thank you.
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
I use Mac OS 10.5 x86 64-bit, so maybe I could use the PowerPC version thru Rosetta. If a native x86 version was made that would be better. Thank you.

Oh. Why won’t you just use 10.6 on Intel? If Rosetta is a requirement, 10.6 has it.

If you plan to use the compiler for building native x86_64 code, Rosetta one is useless, since it is not universal (it will only build ppc binaries). You could build gcc10-bootstrap first (this should work on 10.5 with official MacPorts) and then use that to build gcc14. While I have never tried that on 10.5 x86, there is no reason why it should not work. If anything, GCC upstream should be able to test Intel better than PPC (due to hardware availability).
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
I use Mac OS 10.5 x86 64-bit, so maybe I could use the PowerPC version thru Rosetta. If a native x86 version was made that would be better. Thank you.

P. S. I don’t have hardware to run 10.5 on 64-bit Intel (there is a 32-bit old MacMini, which can run 10.5, but as 32-bit, and MacMini i7, which can run 10.6 with a hacked kernel, but not earlier OS), but if you like pain LOL, I can give suggestions how to tweak MacPorts to use gcc14 instead of gcc7. (Probably it will be the same as for ppc, I need to check what MacPorts has for x86.)
 

iMacker20

macrumors newbie
May 12, 2020
12
5
I wish MacPorts would provide binaries instead of making us build from source. I spend hours on the gcc10 bootstrap only for the Terminal application freeze. Would you know of a way to download binaries of compilers for Mac OS 10.5?
 

doctor_dog

macrumors regular
Dec 19, 2022
109
107
As a matter of fact, we do. Barracuda and I provide unofficial binary repos for Macports on 10.6 and 10.5, respectively. You can find his thread on 10.6 PPC if you also have a 10.6 PPC machine: https://forums.macrumors.com/thread...lt-ports-unofficial-testing-welcomed.2433458/

I have gcc 7,11,12, and 13 for 10.5 available through the repo, along with many other packages. The main issue right now is I have not done an upgrade in several months, so you may find some ports are out of date. If you only want a compiler, you can always create a local Macports repository and change the version of the port you want to match what I have on my server. As an aside, I'm in the misdst of planning my next build run, so there should be freshly updated binaries on my repo in the next week or so.

You can view the full list of 10.5 packages here: http://hairypotter.org (yes, that is the domain I chose, I have no rational explanation).
Instructions on how to use my 10.5 repo here: https://forums.macrumors.com/threads/unofficial-macports-10-5-binary-repo.2376248/post-31879173

@barracuda156 I think we need to find a better way to advertise these repos lol =)
 
  • Like
Reactions: barracuda156

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
I wish MacPorts would provide binaries instead of making us build from source. I spend hours on the gcc10 bootstrap only for the Terminal application freeze. Would you know of a way to download binaries of compilers for Mac OS 10.5?

As a quite note, MacPorts builds are resumable, just do not modify portfile and do not run port clean, of course.

(As a note on hacking, you could even modify configure settings directly in the source file after the build fails, and in most cases build system picks that up, rebuilding only what is needed. This is not advisable for the compiler though: you want a reproducible and robust build here. Resuming after a freeze is perfectly fine.)
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514

saxfun

macrumors regular
Mar 14, 2016
138
24
Germany
Just out of interest I was reading through this thread and tried to compile gcc and maybe as next project gcc11 and 12.

One Question though: is it useful to set one compiler as a system wide standard and when yes, ho is it accomplished?

My original cmd in terminal was:

sudo port install mpich-gcc10

it failed at the very end while configuring mpich-gcc10, but gcc10 and all other dependencies were installed successfully (after 3 days I think . . . ). bootstrap-gcc10 is installed too.
(how to display the timestamps in the terminal? is there some viewing setting or just one cmd to add while building?)

maybe smth about fortran?


Code:
port -v installed gcc10
The following ports are currently installed:
  gcc10 @10.4.0_5 (active) requested_variants='' platform='darwin 9' archs='ppc' date='2024-09-18T11:10:46+0200'
geekbook:~ admin$ sw_vers
ProductName:    Mac OS X
ProductVersion:    10.5.8
BuildVersion:    9L31a

And is mpich-gcc10 nessesary to build gcc11 or 12?

Greetings, saxfun :)
 

Attachments

  • main.txt
    144.3 KB · Views: 10

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
Just out of interest I was reading through this thread and tried to compile gcc and maybe as next project gcc11 and 12.

One Question though: is it useful to set one compiler as a system wide standard and when yes, ho is it accomplished?

My original cmd in terminal was:

sudo port install mpich-gcc10

it failed at the very end while configuring mpich-gcc10, but gcc10 and all other dependencies were installed successfully (after 3 days I think . . . ). bootstrap-gcc10 is installed too.
(how to display the timestamps in the terminal? is there some viewing setting or just one cmd to add while building?)

maybe smth about fortran?


Code:
port -v installed gcc10
The following ports are currently installed:
  gcc10 @10.4.0_5 (active) requested_variants='' platform='darwin 9' archs='ppc' date='2024-09-18T11:10:46+0200'
geekbook:~ admin$ sw_vers
ProductName:    Mac OS X
ProductVersion:    10.5.8
BuildVersion:    9L31a

And is mpich-gcc10 nessesary to build gcc11 or 12?

Greetings, saxfun :)

No, you do not need mpich to build gcc, and likely do need mpich altogether. (And technically, you need a corresponding version of gcc first to build mpich.)
Mpich is a dependency for quite a number of ports, but those are hardly a general user-relevant. Mostly math, science, visualization.
Why configure failed is perhaps because you did not change its settings, so it probably believes it should use gcc7. Anyway, there is no point building it for the sake of itself. If you will have a port which you want and it requires mpich, we can sort this out.

What I would suggest is having gcc10-bootstrap, then using that to build libgcc14 and gcc14. I.e. make 10.5 behave like 10.6.
 

saxfun

macrumors regular
Mar 14, 2016
138
24
Germany
Thx for your valuable information!
i have gcc10-bootstrap installed, atm I'm building gcc11. do I understand you correctly that I do not have to build each version number of gcc in order to upgrade to the next version but to build libgcc14 and gcc14 DIRECTLY after building gcc10-bootstrap?
shall I abort building gcc11? and how to set the newest compiler as system default?
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
Thx for your valuable information!
i have gcc10-bootstrap installed, atm I'm building gcc11. do I understand you correctly that I do not have to build each version number of gcc in order to upgrade to the next version but to build libgcc14 and gcc14 DIRECTLY after building gcc10-bootstrap?
shall I abort building gcc11? and how to set the newest compiler as system default?

You definitely do not need to build every gcc sequentially, and I do not think there is any point in having any version below 13.
Why gcc10-bootstrap is required is because gcc10 is the last version which can be built with a pre-C++11 compiler. So you cannot use gcc-4.2 to build gcc11+.

How to: my GH repo has a branch gcc_switch or something similar. It may be a bit outdated, but you can get an idea, what to change. (Default branch also has this, but it has much more and may be difficult to search.)

From memory,
– compilers/gcc.tcl
– groups/compilers.tcl
– libgcc port
– gcc7 port (drop the setting for < 10.6 there)
– gcc14 port

You can borrow gcc10-bootstrap block from my gcc14 port. You don’t really need to enable stdlib_flag variant, so that can be skipped, but if you plan to use Fortran, borrow a patch from my port.

I’m on mobile, so can’t pull exact links. If you cannot figure out what to do, ping me tomorrow, I will try to make “howto”.
 

saxfun

macrumors regular
Mar 14, 2016
138
24
Germany
Thanks. I quit building gcc11, for some hours I'm building now libgcc14, let's see.

A short tutorial would be nice.
 

saxfun

macrumors regular
Mar 14, 2016
138
24
Germany
After nearly 2 days installation of libgcc14 went fine. only at the very end I had to deactivate libgcc7, thereafter I could activate libgcc14.
configuring gcc14 failed at the beginning with following log:
 

Attachments

  • main.txt
    143 KB · Views: 10

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
After nearly 2 days installation of libgcc14 went fine. only at the very end I had to deactivate libgcc7, thereafter I could activate libgcc14.
configuring gcc14 failed at the beginning with following log:

> checking for gcc... /opt/local/bin/gcc-mp-7 -arch ppc

Please do not build anything with gcc7.

Add this to gcc14 portfile: https://github.com/barracuda156/pow...80cd467035271/lang/gcc14/Portfile#L67C1-L76C2 (exact place does not matter).

If you get silly circular dependency on itself error, delete gcc-4.2 from this line (here it is already deleted): https://github.com/barracuda156/pow...a875d0980cd467035271/lang/gcc14/Portfile#L374 (you can delete right away, it does not hurt, this is just a workaround for a bug in MacPorts).

You will need to install libgcc port (it is a wrapper, nothing to build), it will ask for it, agree.
Make sure you have changed setting in it here: https://github.com/barracuda156/pow...d0980cd467035271/lang/libgcc/Portfile#L34-L38
Either make it <9 or replace the whole block with `set gcc_version 14`.
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
If the build is picking gcc7, you have probably not changed settings for compiler choice. It is necessary, though you can do it after building gcc14 (assuming you build with gcc10-bootstrap, that should override MacPorts-wide defaults).
 

saxfun

macrumors regular
Mar 14, 2016
138
24
Germany
After DAYS of compiling libgcc14 and gcc14 are ready to use. I compiled gcc14 with configure.compiler=macports-gcc-10 after you told me NOT to use gcc7. I deactivated libgcc7 (but not gcc7, shall I do that or remove both?)
is there a SIMPLE solution for making gcc14 the default compiler? or gcc10? you talked about some kind of switcher.

one question though:
I think I compiled libgcc14 with gcc7 (or gcc10, I don't know) and gcc14 definitely with gcc10. is there now any kind of incompatibility between the both ports?
 

barracuda156

macrumors 68020
Original poster
Sep 3, 2021
2,295
1,514
After DAYS of compiling libgcc14 and gcc14 are ready to use. I compiled gcc14 with configure.compiler=macports-gcc-10 after you told me NOT to use gcc7. I deactivated libgcc7 (but not gcc7, shall I do that or remove both?)
is there a SIMPLE solution for making gcc14 the default compiler? or gcc10? you talked about some kind of switcher.

one question though:
I think I compiled libgcc14 with gcc7 (or gcc10, I don't know) and gcc14 definitely with gcc10. is there now any kind of incompatibility between the both ports?

gcc rebuilds itself, so I think it should be fine.

On a general note: using some completely random recipes of building stuff makes debugging problematic (assuming you expect someone else to deal with that, if such a need arises). When you force a compiler on a command line, you won’t even be able to know how exactly a port was built, since portfile packaged into its tarball will reflect something else.
(I am not saying that should never be done, and I do that myself occasionally, just be aware of downsides.)

I think I have explained a number of times in several related threads how to set the desired gcc as the default, but anyway:
1. [I hope this already was done:] remove a setting in gcc7 portfile which sets libgcc7 as the latest supported version. No need to add anything there, just delete the special case. Also delete restriction in gcc14 port in platforms field.
2. Edit these three files:
Code:
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/compilers/gcc_compilers.tcl
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/compilers/gcc_dependencies.tcl
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/compilers-1.0.tcl
3. Edit libgcc port.
4. If you use R ports or Fortran ports, edit these:
Code:
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/R-1.0.tcl
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/fortran-1.0.tcl
Notice, `port sync` will overwrite these files. So keep edited versions locally and replace them on every port sync (yes, it is silly, but complain to MacPorts upstream for that).
Edited portfiles you can have in an overlay local repo, then those will not be overwritten. For portgroups that does not work, so those you will still need to replace manually.

Should be it. Edits amount to change 10 to 9 (so that 10.5 uses same defaults as 10.6 now).
 
Last edited:
  • Like
Reactions: saxfun
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.