Thread: BUG #18672: failing to link postgresql

BUG #18672: failing to link postgresql

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      18672
Logged by:          Thierry Bastian
Email address:      bastian.thierry@laposte.net
PostgreSQL version: 16.4
Operating system:   macOS
Description:

In short, in src/interfaces/libpq/Makefile there is a check for lib-a to not
contain a call to exit. But the issue is that on macOS, it still uses
_atexit and pthread_exitm which are fine.
My fix to this is to apply the following patch:

diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 0919d8f..65b07d3 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -118,7 +118,7 @@ backend_src = $(top_srcdir)/src/backend
 libpq-refs-stamp: $(shlib)
 ifneq ($(enable_coverage), yes)
 ifeq (,$(filter aix solaris,$(PORTNAME)))
-    @if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then \
+    @if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep -v _atexit |
grep -v pthread_exit | grep exit; then \
         echo 'libpq must not be calling any function which invokes exit'; exit 1;
\
     fi
 endif


Re: BUG #18672: failing to link postgresql

From
Tom Lane
Date:
PG Bug reporting form <noreply@postgresql.org> writes:
> In short, in src/interfaces/libpq/Makefile there is a check for lib-a to not
> contain a call to exit. But the issue is that on macOS, it still uses
> _atexit and pthread_exitm which are fine.

Nobody else has reported any such problem.  What build modifications
did you make to cause this?

            regards, tom lane



Re: BUG #18672: failing to link postgresql

From
Thierry Bastian
Date:
Hello Tom and thank you for the feedback.

I believe that comes from the fact that I build openssl myself and I build static libs. That makes it so some
additionalsymbols are pulled in. 


Regards,
Thierry Bastian

> On 24 Oct 2024, at 22:30, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> PG Bug reporting form <noreply@postgresql.org> writes:
>> In short, in src/interfaces/libpq/Makefile there is a check for lib-a to not
>> contain a call to exit. But the issue is that on macOS, it still uses
>> _atexit and pthread_exitm which are fine.
>
> Nobody else has reported any such problem.  What build modifications
> did you make to cause this?
>
>             regards, tom lane