Opened 23 months ago
Closed 14 months ago
#66529 closed defect (fixed)
postgresql15 +universal: darwin/x86_64 cross-compile to arm64 results in broken build
Reported by: | FabianPonce (Fabian Ponce) | Owned by: | dgilman (David Gilman) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | FabianPonce (Fabian Ponce) | |
Port: | postgresql15 |
Description
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.
Change History (3)
comment:1 Changed 23 months ago by FabianPonce (Fabian Ponce)
Cc: | FabianPonce added |
---|
comment:2 Changed 23 months ago by jmroot (Joshua Root)
Port: | postgresql15 added |
---|
comment:3 Changed 14 months ago by dgilman (David Gilman)
Owner: | set to dgilman |
---|---|
Resolution: | → fixed |
Status: | new → closed |
In bfbd57e500d63729bd89d599cfc23b3232abf387/macports-ports (master):