[MacPorts] #58442: gcc9 (and other gccN) fails to install on Mojave, Xcode-10.2.1

MacPorts noreply at macports.org
Sun May 5 17:46:39 UTC 2019


#58442: gcc9 (and other gccN) fails to install on Mojave, Xcode-10.2.1
-------------------------+--------------------
  Reporter:  mouse07410  |      Owner:  (none)
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  gcc9        |
-------------------------+--------------------

Comment (by kencu):

 Replying to [comment:6 mouse07410]:
 > how do I disable something in a Portfile???

 I think your level of expertise, questions, and interest has evolved to
 the point where you can probably dig in helpfully now.

 All the instructions for how things in MacPorts are built are kept in
 fairly simple-to-read recipes called Portfiles. Every port has one, inside
 a directory named after the port (usually...).

 So to see the gcc9 Portfile, you could do something like this:
 {{{
 $ port file gcc9
 /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/gcc9/Portfile
 }}}

 and to edit it, just use your favourite capable editor -- I like bbedit,
 like this:
 {{{
 bbedit
 /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/gcc8/Portfile
 }}}

 or -- in one step, using backticks:
 {{{
 bbedit `port file gcc9`
 }}}

 And in there you would see a bit of `tcl` code that looks for various
 system versions, and sets a dependency on various `clang` versions. So you
 would comment that out that dependency using a `#` character, and that's
 how you disable something in a Portfile.

 Now -- don't make things worse for yourself. You have to know what you're
 doing here, and not do something silly and then blame us for it.

 BUT -- as you've just demonstrated again, you are having an assembler
 issue building gcc9 with clang-7.0 (and clang-8.0) -- so disable that, and
 use the Xcode clang instead. like this:

 In the current gcc9 Portfile, we see this:
 {{{
 # Make sure the MP clang version used by cctool's 'as' is available at
 build time and used.
 if { ${os.major} > 10 } {
     if {![catch {set installed [lindex [registry_active cctools] 0]}]} {
         # cctools already installed, so figure out from registry what
 variant to use
         # list here must have all possible variants from cctools in it
         foreach {llvm_v llvm_v_nodot} {3.4 34 3.7 37 3.9 39 4.0 40 5.0 50
 6.0 60 7.0 70 8.0 80 devel dev} {
             if {[active_variants cctools llvm${llvm_v_nodot} ""]} {
                 depends_build-append port:clang-${llvm_v}
                 configure.compiler macports-clang-${llvm_v}
                 break
             }
         }
     } else {
         # cctools is not yet installed, so have to play 'guess the default
 variant' :(
         # Logic here needs to match that used in cctools port.
         if { ${os.major} <= 11 } {
             set llvm_v 3.4
         } elseif { ${os.major} <= 13 } {
             set llvm_v 3.7
         } else {
             set llvm_v 7.0
         }
         depends_build-append port:clang-${llvm_v}
         configure.compiler macports-clang-${llvm_v}
     }
 }
 }}}

 So - for your purposes right now, just delete that whole block (it's going
 to be restored again next time you `sudo port selfpudate` anyway). Then
 deactivate clang-7.0, clang-8.0, and then try your build of gcc9 again.

 It should not ask for and clang any longer (as you just deleted the part
 that made it ask for clang) and you will now get the Xcode clang called
 instead. We all hope that one works for you.

 If it does, we can use that information to figure out what has gone wrong
 with the clang-7+ assembler.

 Don't forget to be neat and tidy. Clean between attempts, or you just get
 sausage. REMEMBER any mods you make to other ports, or NOBODY will be able
 to help you.

 But if you're ready for the next step, we can always use help!

-- 
Ticket URL: <https://trac.macports.org/ticket/58442#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list