`make check` doesn't pass on MacOS Catalina - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject `make check` doesn't pass on MacOS Catalina
Date
Msg-id CAJ7c6TN6QONSsM3=GPdp2DtPgFpL1cY+txVwfNREWuYX9V1P=Q@mail.gmail.com
Whole thread Raw
Responses Re: `make check` doesn't pass on MacOS Catalina  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi hackers,

While trying to build PostgreSQL from source (master branch, 95c3a195) on a MacBook I discovered that `make check` fails:

```
============== removing existing temp instance ==============
============== creating temporary instance ==============
============== initializing database system ==============
============== starting postmaster ==============
sh: line 1: 33559 Abort trap: 6           "psql" -X postgres < /dev/null 2> /dev/null
sh: line 1: 33562 Abort trap: 6           "psql" -X postgres < /dev/null 2> /dev/null
...
sh: line 1: 33742 Abort trap: 6           "psql" -X postgres < /dev/null 2> /dev/null

pg_regress: postmaster did not respond within 60 seconds
Examine /Users/eax/projects/c/postgresql/src/test/regress/log/postmaster.log for the reason
make[1]: *** [check] Error 2
make: *** [check] Error 2
```

A little investigation revealed that pg_regres executes postgres like this:

```
PATH="/Users/eax/projects/c/postgresql/tmp_install/Users/eax/pginstall/bin:$PATH" DYLD_LIBRARY_PATH="/Users/eax/projects/c/postgresql/tmp_install/Users/eax/pginstall/lib" "postgres" -D "/Users/eax/projects/c/postgresql/src/test/regress/./tmp_check/data" -F -c "listen_addresses=" -k "/Users/eax/pgtmp/pg_regress-S34sXM" > "/Users/eax/projects/c/postgresql/src/test/regress/log/postmaster.log"
```

... and checks that it's online by executing:

```
PATH="/Users/eax/projects/c/postgresql/tmp_install/Users/eax/pginstall/bin:$PATH" DYLD_LIBRARY_PATH="/Users/eax/projects/c/postgresql/tmp_install/Users/eax/pginstall/lib" psql -X postgres
```

The last command fails with:

```
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory. Is the server running locally and accepting connections on that socket?
```

This is because the actual path to the socket is:

```
~/pgtmp/pg_regress-S34sXM/.s.PGSQL.5432
```

While debugging this I also discovered that psql uses /usr/lib/libpq.5.dylib library, according to the `image list` command in LLDB. The library is provided with the system and can't be moved or deleted. In other words, it seems to ignore DYLD_LIBRARY_PATH. I've found an instruction [1] that suggests that this is a behavior of MacOS integrity protection and describes how it can be disabled. Sadly it made no difference in my case, psql still ignores DYLD_LIBRARY_PATH.

While I'm still in the progress of investigating this I just wanted to ask if anyone is developing on MacOS and observes anything similar and had any luck solving the problem? I tried to search through the mailing list but didn't find anything relevant. The complete script that reproduces the issue is attached. I'm using the same script on Ubuntu VM, where it works just fine.


--
Best regards,
Aleksander Alekseev
Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_amcheck option to install extension
Next
From: Andrew Dunstan
Date:
Subject: Re: Free port choosing freezes when PostgresNode::use_tcp is used on BSD systems