1

I am trying to compile GCC9 on macOS Catalina. The closest tutorial I've found is this one.

The tutorial states:

In order to build GCC install the required header files in the old location:

1 cd /Library/Developer/CommandLineTools/Packages/
2 open .

Command 1 doesn't work because my file structure is as follows:

 - Users/user/Library/Developer/Xcode
 - Users/user/Library/Developer/XCTestDevices
 - /Library/Developer/CommandLineTools/SDKs/
- /Library/Developer/CommandLineTools/Library/

The package directory is not available.

Also, as can be seen, the Library/Developer path associated with my user has no CommandlineTools, while that directly on Macintosh HD does.

Should I run the above commands from root /? Or should the CommandLineTools also be available directly to my user?

rrz0
  • 2,182
  • 5
  • 30
  • 65
  • Is there a particular reason you're wanting to do this by hand rather than using a source distro with automation? – Charles Duffy Oct 11 '19 at 20:48
  • I've been having trouble for the past two days since the Catalina update, so I was trying the whole process over again by hand. Any reliable source distro with automation you would recommend? Thanks! – rrz0 Oct 11 '19 at 20:50
  • 1
    For example -- I run Nix (on Catalina, yes), so `NIX_PATH=nixpkgs=${NIX_PATH%%:*}/nixpkgs nix run nixpkgs.gcc9 -c gcc --version` installs GCC 9, and then runs `gcc --version`, emitting `gcc (GCC) 9.2.0`. – Charles Duffy Oct 11 '19 at 20:50
  • (since there's a prebuilt binary it uses that, but you can force it to really install from source if you want to). – Charles Duffy Oct 11 '19 at 20:51
  • ...if you want to go that route, see https://github.com/NixOS/nix/issues/2925 for discussion of changes to the install process pertinent to Catalina. (The `NIX_PATH=...` thing is also a workaround for a bug that'll presumably be fixed in a Nix release newer than today's version 2.3). – Charles Duffy Oct 11 '19 at 20:52
  • Thank you for the suggestion. I'll look into it – rrz0 Oct 11 '19 at 20:53
  • (One handy thing about Nix is that you can have different sets of software installed for different projects / in different shell windows; if you want gcc 9 when you work on thing-A, and gcc 8 when you work on thing-B, and the default Apple clang wrapper when you *haven't* explicitly put your current shell into a different per-project mode... well, trivially done). – Charles Duffy Oct 11 '19 at 20:57

0 Answers0