[MacPorts] #66529: postgresql15 +universal: darwin/x86_64 cross-compile to arm64 results in broken build

MacPorts noreply at macports.org
Thu Dec 22 02:20:39 UTC 2022


#66529: postgresql15 +universal: darwin/x86_64 cross-compile to arm64 results in
broken build
-------------------------+--------------------
 Reporter:  FabianPonce  |      Owner:  (none)
     Type:  defect       |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  ports        |    Version:
 Keywords:               |       Port:
-------------------------+--------------------
 I ran two different installations of postgresql15, one on my M1 MacBook
 Pro, and another on an EC2 instance running x86_64. Both machines are
 running the latest release of Ventura. In both builds, I request a
 universal build, so the intended output should be a fat binary containing
 both x86_64 and arm64 architecture executables.

 On my M1, this succeeds without issue.

 On my x86_64 EC2 instance, the build fails with the following error:
 {{{
 "./data/tzdata.zi", line 4194: input line of unknown type
 "./data/tzdata.zi", line 4195: input line of unknown type
 "./data/tzdata.zi", line 4196: input line of unknown type
 gnumake[2]: *** [install] Error 1
 gnumake[2]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_postgresql15/postgresql15/work/postgresql-15.1-arm64/src/timezone'
 gnumake[1]: *** [install-timezone-recurse] Error 2
 gnumake[1]: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_postgresql15/postgresql15/work/postgresql-15.1-arm64/src'
 gnumake: *** [install-world-src-recurse] Error 2
 gnumake: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_postgresql15/postgresql15/work/postgresql-15.1-arm64'
 }}}

 It took me a fair bit to figure out what was happening. The native Mac
 `zic` compiler does not support the format that postgresql ships with it's
 src. This is the _same_ compiler on both M1 and Intel machines, so why
 does one succeed and the other doesn't?

 Postgres attempts to build zic.c as part of its build process and output a
 binary file. It then attempts to _use_ that binary to generate the
 compiled tzdata. In the case of the M1 machine, this succeeds because of
 Rosetta 2. In the case of the Intel machine, this fails and the system
 falls back to the /usr/sbin/zic which was shipped with macOS, and the
 build process fails.

 I hacked my build together by doing:
 {{{
 cp
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_databases_postgresql15/postgresql15/work/postgresql-15.1-x86_64/src/timezone/zic
 /opt/local/bin/
 export ZIC=/opt/local/bin/zic
 }}}

 I then re-ran the normal port install postgresql15 +universal, and this
 succeeded.

 I believe this issue affects all recent versions of the postgresql port as
 well, though I only attempted postgresql14.

-- 
Ticket URL: <https://trac.macports.org/ticket/66529>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list