Opened 2 years ago

Closed 22 months ago

#66180 closed defect (worksforme)

m4: cannot compile for x86_64 on arm64

Reported by: astroboylrx (Rixin Li) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.0
Keywords: arm64 Cc:
Port: m4

Description

port fails to configure m4 on the latest macOS Ventura 13.0 (22A380). There is too much stuff ongoing in config.log so I don't quite understand what caused the error. It looks like many headers files are missing.

Attachments (2)

config.log (3.0 MB) - added by astroboylrx (Rixin Li) 2 years ago.
configuration log for m4
main.log (2.7 MB) - added by astroboylrx (Rixin Li) 2 years ago.
main log for m4

Change History (10)

Changed 2 years ago by astroboylrx (Rixin Li)

Attachment: config.log added

configuration log for m4

comment:1 Changed 2 years ago by jmroot (Joshua Root)

Keywords: ventura added; m4 Ventura removed
Priority: HighNormal

Please attach the main.log as well.

Changed 2 years ago by astroboylrx (Rixin Li)

Attachment: main.log added

main log for m4

comment:2 in reply to:  1 Changed 2 years ago by astroboylrx (Rixin Li)

Replying to jmroot:

Please attach the main.log as well.

Just attached. Thanks a lot for the fast response.

comment:3 Changed 2 years ago by astroboylrx (Rixin Li)

To add some info, after upgrading to macOS 13 (and updating the latest Xcode/command-line tools), I followed the migration guide and reinstalled MacPorts base system.

Then I started to reinstall ports. Uninstalling them was fine. But when I began to restore them, I found that port downloaded and installed the x86_64 versions of all ports, which is really confusing. I then edited /opt/local/etc/macports/macports.conf with build_arch arm64 and universal_archs arm64 x86_64. After that, port finally began to download and install the arm64 version.

Inspired by HomeBrew's error message, I just tried arch -arm64 port install m4, which luckily seems to work.

comment:4 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Sounds like you may be using an x86_64 terminal program. When you do that, MacPorts will understand that it is on an x86_64 system and should install x86_64 ports. If you want to install arm64 ports, use an arm64 terminal program.

The errors in your config.log remind me of problems we saw in several other ports on Monterey on arm64 systems. I don't think we found a solution and I can't find those tickets now.

Last edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:5 in reply to:  4 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

The errors in your config.log remind me of problems we saw in several other ports on Monterey on arm64 systems. I don't think we found a solution and I can't find those tickets now.

#65815 is one of the tickets I was thinking about. The problem there surfaced only when using the universal variant, however if you are building for x86_64 on arm64, that may trigger the same problem as building universal on arm64.

comment:6 in reply to:  4 Changed 2 years ago by astroboylrx (Rixin Li)

Replying to ryandesign:

Sounds like you may be using an x86_64 terminal program. When you do that, MacPorts will understand that it is on an x86_64 system and should install x86_64 ports. If you want to install arm64 ports, use an arm64 terminal program.

The errors in your config.log remind me of problems we saw in several other ports on Monterey on arm64 systems. I don't think we found a solution and I can't find those tickets now.

Indeed. I was using the built-in Terminal.app (normally I used iTerm, but somehow everything crashes after I uninstall every port so I switched to the built-in one). I would never thought Terminal is x86_64, but it turns out "Open using Rosetta" was checked. I unchecked it and everything works as expected now.

Thank you sooo much for this life saver clue!!

comment:7 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: arm64 added; ventura removed
Summary: m4 Fail to configure m4 macOS 13 Venturam4: cannot compile for x86_64 on arm64

To be more precise, any program you sub-launch from a program will prefer to use the same architecture even if a "better" architecture is available. So an x86_64 terminal program, when launching the shell, will prefer to launch the x86_64 slice of the shell even if an arm64 slice is available. And the x86_64 shell will prefer to launch the x86_64 slice of port-tclsh, the version of tclsh that MacPorts runs under. And MacPorts decides how to build things based on the architecture it was started as.

comment:8 Changed 22 months ago by kencu (Ken)

Resolution: worksforme
Status: newclosed

as noted above, m4 does indeed install universal on an M1 Mac, when macports is used in it's default configuration of using an arm terminal program to run it.

% port -v installed m4
The following ports are currently installed:
  m4 @1.4.19_1+universal requested_variants='+universal' platform='darwin 22' archs='arm64 x86_64' date='2022-12-28T09:33:21-0800'
Note: See TracTickets for help on using tickets.