From: | Evan Jones <evan(dot)jones(at)datadoghq(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | [PATCH] pg_regress.c: Fix "make check" on Mac OS X: Pass DYLD_LIBRARY_PATH |
Date: | 2023-06-05 13:47:30 |
Message-ID: | CA+HWA9Zhz+QqaKrWkBd4UVfxL1FANJvRyCTFY5J_hq3AhDBpJQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
This makes "make check" work on Mac OS X. Without this patch, on Mac OS X a
default "./configure; make; make check" fails with errors like:
dyld[65265]: Library not loaded: /usr/local/pgsql/lib/libpq.5.dylib
Referenced from: <59A2EAF9-6298-3112-BEDB-EA9A62A9DB53>
/Users/evan.jones/postgresql-clean/tmp_install/usr/local/pgsql/bin/initdb
Reason: tried: '/usr/local/pgsql/lib/libpq.5.dylib' (no such file),
'/System/Volumes/Preboot/Cryptexes/OS/usr/local/pgsql/lib/libpq.5.dylib'
(no such file), '/usr/local/pgsql/lib/libpq.5.dylib' (no such file),
'/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no
such file, not in dyld cache)
The reason is that at some point, Mac OS X started removing the
DYLD_LIBRARY_PATH environment variable for "untrusted" executables [1]:
"Any dynamic linker (dyld) environment variables, such as
DYLD_LIBRARY_PATH, are purged when launching protected processes."
One solution is to explicitly pass the DYLD_LIBRARY_PATH environment
variable to to the sub-process shell scripts that are run by pg_regress. To
do this, I created an extra_envvars global variable which is set to the
empty string "", but on Mac OS X, is filled in with "DYLD_LIBRARY_PATH=%s",
where the %s is the current environment variable. The "make check" Makefile
sets this environment variable to the temporary install directory, so this
fixes the above errors.
I tested this on Mac OS X and on Linux (Ubuntu 23.04).
Thanks!
Evan Jones
Attachment | Content-Type | Size |
---|---|---|
pg_regress_mac_os_x_dyld.patch | application/octet-stream | 2.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hans Buschmann | 2023-06-05 14:40:35 | QUAL Pushdown causes ERROR on syntactically and semantically correct SQL Query |
Previous Message | Morris de Oryx | 2023-06-05 13:21:55 | Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function |