Re: [PATCH] pg_regress.c: Fix "make check" on Mac OS X: Pass DYLD_LIBRARY_PATH

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_regress.c: Fix "make check" on Mac OS X: Pass DYLD_LIBRARY_PATH
Date: 2023-06-22 19:08:05
Message-ID: 76582eb0-a363-92db-c357-0a9997fee2db@highgo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

After conducting a further investigation into this issue, I have made
some discoveries. The previous patch successfully resolves the problem
when running the commands `./configure && make && make check` (without
any previous sudo make install or make install). However, it stops at
the 'isolation check' when using the commands `./configure
--enable-tap-tests && make && make check-world`.

To address this, I attempted to apply a similar approach as the previous
patch, resulting in an experimental patch (attached). This new patch
helps progress the 'make-world' process and passes the 'isolation
check', but there are still several remaining issues that need to be
addressed.

Currently, there is a description suggesting a workaround by running a
'make install' command first, but I find it to be somewhat inaccurate.
It would be better to update the existing description to provide more
precise instructions on how to overcome this issue. Here are the changes
I would suggest.

from:
"You can work around that by doing make install before make check. Most
PostgreSQL developers just turn off SIP, though."

to:
"You can execute sudo make install if you do not specify a prefix during
the configure step, or make install without sudo if you do specify a
prefix (assuming proper permissions) before make check. Most PostgreSQL
developers just turn off SIP, though."

Otherwise, following the current description, if you run `./configure 
&& make install` you will get error: "mkdir: /usr/local/pgsql:
Permission denied"

Below are the steps I took that led to the discovery of additional issues.

git apply  pg_regress_mac_os_x_dyld.patch
./configure
make
make check

... ...
# All 215 tests passed.

./configure --enable-tap-tests
make
make check-world

... ...
echo "# +++ isolation check in src/test/isolation +++"
... ...
dyld[32335]: Library not loaded: /usr/local/pgsql/lib/libpq.5.dylib
  Referenced from: <EB3758C5-A87B-36C5-AA29-C1E31AD89E70>
/Users/david/hg/sandbox/postgres/src/test/isolation/isolationtester
  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)
no data was returned by command
""/Users/david/hg/sandbox/postgres/src/test/isolation/isolationtester" -V"

git apply pg_regress_mac_os_x_dyld_isolation_check_only.patch
./configure --enable-tap-tests
make
make check-world

... ...
# All 215 tests passed.
... ...
# +++ isolation check in src/test/isolation +++
... ...
# All 112 tests passed.

echo "# +++ tap check in src/test/modules/brin +++"
... ...
# +++ tap check in src/test/modules/brin +++
t/01_workitems.pl ........ Bailout called.  Further testing stopped: 
command "initdb -D
/Users/david/hg/sandbox/postgres/src/test/modules/brin/tmp_check/t_01_workitems_tango_data/pgdata
-A trust -N" died with signal 6
t/01_workitems.pl ........ Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run

Any thoughts ?

Thank you

David

On 2023-06-16 2:25 p.m., David Zhang wrote:
> I have applied the patch to the latest master branch and successfully executed './configure && make && make check' on macOS Ventura. However, during the process, a warning was encountered: "mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]". Moving the declaration of 'result' to the beginning like below can resolve the warning, and it would be better to use a unique variable instead of 'result'.
>
> #ifdef __darwin__
> static char extra_envvars[4096];
> +int result = -1;
> ... ...
> -int result = snprintf(extra_envvars, sizeof(extra_envvars), "DYLD_LIBRARY_PATH=%s",
> +result = snprintf(extra_envvars, sizeof(extra_envvars), "DYLD_LIBRARY_PATH=%s",

Attachment Content-Type Size
pg_regress_mac_os_x_dyld_isolation_check_only.patch text/plain 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2023-06-22 20:50:35 Re: Improving btree performance through specializing by key shape, take 2
Previous Message Andres Freund 2023-06-22 19:02:10 Re: OK to build LLVM (*.bc) with CLANG but rest of postgresql with CC (other compiler)?