Opened 6 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#70512 closed defect (fixed)

x86_64 base installation on arm64 is still x86_64 after migration

Reported by: dzogrim (Séв(aѕтιen) L.) Owned by:
Priority: High Milestone: MacPorts 2.10.1
Component: base Version: 2.10.0
Keywords: Cc: jmroot (Joshua Root), githubbjs (BJS), jhoyt4
Port:

Description (last modified by dzogrim (Séв(aѕтιen) L.))

Hi!

Just upgraded to macOS Sonoma 14.6.1 (Darwin Kernel Version 23.6.0) and every port command I try to launch, even after a clean install of MacPorts-2.10.0-14-Sonoma.pkg or a sudo port -f -v migrate and so on (migration wiki page), I have platform mismatch errors (even if 23==23; guess it's minor related)

Warning: MacPorts is configured to use an older rsync URL for the ports tree. Please edit sources.conf and change 'rsync://rsync.macports.org/release/tarballs/ports.tar' to 'rsync://rsync.macports.org/macports/release/tarballs/ports.tar'.
Migration will first upgrade MacPorts and then reinstall all installed ports. Would you like to continue? [Y/n]: Y
Upgrading MacPorts...
--->  Checking for newer releases of MacPorts
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    63  100    63    0     0    234      0 --:--:-- --:--:-- --:--:--   235
MacPorts base version 2.10.0 installed,
MacPorts base version 2.10.0 available.
--->  MacPorts base is outdated, installing new version 2.10.0
Verified existing file for https://github.com/macports/macports-base/releases/download/v2.10.0/MacPorts-2.10.0.tar.bz2
--->  Extracting MacPorts 2.10.0
--->  Installing new MacPorts release in /opt/local as root:admin; permissions 0755
checking build system type... x86_64-apple-darwin23.6.0
[…]
/usr/bin/install -c    -o "root" -g "admin" -m 444 ./keys/base/*.pub  "/opt/local/share/macports/keys/base/"
/opt/local/libexec/macports/bin/tclsh8.6 ./src/upgrade_sources_conf_default.tcl "/opt/local"
/opt/local/libexec/macports/bin/tclsh8.6 ./src/images_to_archives.tcl
Error: Current platform "darwin 23" does not match expected platform "darwin 23"
Error: Please run 'sudo port migrate' or follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options"
    (file "./src/images_to_archives.tcl" line 15)
make: *** [install] Error 1
Command failed: CC=/usr/bin/cc SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk ./configure --prefix=/opt/local --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk make -j16 SELFUPDATING=1 && make install SELFUPDATING=1
Exit code: 2
Error: Upgrading port command failed. Try running 'sudo port -v selfupdate' and then 'sudo port migrate'.

or simply sudo port selfupdate -fc for example:

Error: Current platform "darwin 23" does not match expected platform "darwin 23"
Error: Please run 'sudo port migrate' or follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

Package install shows no error and finish normally. So what should I do now? I'm running it on Apple M3 Max. I even can't get back ports installed, uninstall things and all …

Thanks!

Change History (17)

comment:1 Changed 6 weeks ago by dzogrim (Séв(aѕтιen) L.)

Description: modified (diff)
Summary: MacPorts won't works anymore after macOS 14.6.1 (23G93) updateMacPorts won't work anymore after macOS 14.6.1 (23G93) update

comment:2 Changed 6 weeks ago by dzogrim (Séв(aѕтιen) L.)

Something came to my attention, while debugging. iTerm's set to run /opt/local/bin/bash -l (the bash from port) and arch command returns i386 in place of arm64!

How's that possible, and why? Help please? If that's the root cause, the ticket should be changed to request a clearer error message about the platform "darwin 23" (arch) … isn't it? Thx

Here's the mac port cons for i in ./*.conf ; do grep -iv -e ^$ -e ^# $i ; done

prefix              	/opt/local
portdbpath          	/opt/local/var/macports
applications_dir    	/Applications/MacPorts
frameworks_dir      	/opt/local/Library/Frameworks
sources_conf        	/opt/local/etc/macports/sources.conf
variants_conf       	/opt/local/etc/macports/variants.conf
/opt/local/share/macports/macports-pubkey.pem
rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
+bash_completion

And of course none of iTerm or Terminal apps have checked box on "Open using Rosetta".

Last edited 6 weeks ago by dzogrim (Séв(aѕтιen) L.) (previous) (diff)

comment:3 Changed 6 weeks ago by jmroot (Joshua Root)

There has been some discussion of this on the mailing list as well: https://lists.macports.org/pipermail/macports-users/2024-August/052832.html

The error message is indeed misleading, which has been fixed in git: [567fa444ea14564ad1095cb54d71e600d6d64e30/macports-base]

I guess you may have an x86_64-only iTerm or bash? That results in everything it runs being run as x86_64 as well if possible. Maybe that even causes the compiler to generate x86_64 code by default, so rebuilding does nothing? :(

I guess the most expedient way out of this would be to switch to a native arm64 terminal emulator (and shell) and reinstall MacPorts using the .pkg.

Last edited 6 weeks ago by jmroot (Joshua Root) (previous) (diff)

comment:4 Changed 6 weeks ago by jmroot (Joshua Root)

Component: portsbase
Keywords: platform sonoma darwin removed
Summary: MacPorts won't work anymore after macOS 14.6.1 (23G93) updatex86_64 base installation on arm64 is still x86_64 after migration

comment:5 Changed 6 weeks ago by jmroot (Joshua Root)

In e2913036ee257c52f66f87451617f8e531a126c0/macports-base (master):

selfupdate: attempt to force a native build on arm64

See: #70512

comment:6 Changed 6 weeks ago by jmroot (Joshua Root)

If you'd like to help test a potential fix, please try applying the change linked in the previous comment to your /opt/local/libexec/macports/lib/macports1.0/selfupdate.tcl.

comment:7 Changed 6 weeks ago by dzogrim (Séв(aѕтιen) L.)

Thanks I could handle it by running bash another way in iTerm and reinstall. Thanks.

Version 0, edited 6 weeks ago by dzogrim (Séв(aѕтιen) L.) (next)

comment:8 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

Can you confirm that you are using an x86_64-only iTerm, and if so, why don't you get the arm64 version?

comment:9 Changed 6 weeks ago by jmroot (Joshua Root)

In 9eb441f714c58a4bbc0c3abbc1f563ac591eadb6/macports-base (master):

Better check for whether to migrate due to Rosetta 2

Only consider migration to be needed if there is also no arm64 slice in
our binary. This prevents migrating when base is correctly universal
but the x86_64 slice is being run for whatever reason.

See: #70512

comment:10 Changed 6 weeks ago by jmroot (Joshua Root)

If someone with access to Apple Silicon hardware could check if the recent changes on master fix these problems, that would be very helpful. Theoretically, starting with an x86_64-only MacPorts should now prompt to migrate and end up native arm64, and running a universal MacPorts under Rosetta should not prompt to migrate, but it should become arm64 on the next selfupdate.

comment:11 Changed 6 weeks ago by jmroot (Joshua Root)

Milestone: MacPorts 2.10.1

comment:12 Changed 6 weeks ago by jmroot (Joshua Root)

Cc: jmroot added

comment:13 Changed 5 weeks ago by githubbjs (BJS)

Cc: githubbjs added

comment:14 Changed 5 weeks ago by jhoyt4

Cc: jhoyt4 added

comment:15 Changed 5 weeks ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

I did some testing on someone else's hardware and it seems to work well. Further testing by others still very welcome.

comment:16 Changed 5 weeks ago by krousen

I can't list my packages. I can't list outdated packages. This is the message I get when I run port outdated:

Mac-Studio:~ neal$ port outdated
Error: Current platform "darwin 23" does not match expected platform "darwin 23"
Error: Please run 'sudo port migrate' or follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch
Mac-Studio:~ neal$ 

I have a Mac Studio with the M2 Pro chip. This is what I get when I run uname -a:

Mac-Studio:~ neal$ uname -a
Darwin Mac-Studio.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 x86_64

This is what I get when I run arch:

Mac-Studio:~ neal$ arch
i386

All of this started after I updated MacOS Sonoma 14.6.1. Don't close this ticket, something is wrong. Macports will not update.

comment:17 in reply to:  16 Changed 5 weeks ago by jmroot (Joshua Root)

The fix is in the release-2.10 branch, but is not yet released. In the meantime, you have to avoid running via Rosetta. Check the architecture of your MacPorts installation:

lipo -info /opt/local/libexec/macports/bin/tclsh8.6

If it's universal (arm64 and x86_64), simply using a native terminal emulator and shell will work. If it's x86_64 only, you will first need to install a universal version of MacPorts base using the .pkg installer (or installing a native arm64 version from source will also work.)

Note: See TracTickets for help on using tickets.