A little while ago, the pltcl tests starting crashing for me on macOS. I don't know what had changed, but I suspect it was either an operating system update or something like an xcode update.

Here is a backtrace:

  * frame #0: 0x00007ff7b0e61853
    frame #1: 0x00007ff803a28751 libsystem_c.dylib`hash_search + 215
frame #2: 0x0000000110357700 pltcl.so`compile_pltcl_function(fn_oid=16418, tgreloid=0, is_event_trigger=false, pltrusted=true) at pltcl.c:1418:13 frame #3: 0x0000000110355d50 pltcl.so`pltcl_func_handler(fcinfo=0x00007fb6f1817028, call_state=0x00007ff7b0e61b80, pltrusted=true) at pltcl.c:814:12
...

Note that the hash_search call goes into some system library, not postgres.

The command to link pltcl is:

gcc ... -ltcl8.6 -lz -lpthread -framework CoreFoundation -lc -bundle_loader ../../../src/backend/postgres

Notice the -lc in there.  If I remove that, it works again.

The -lc is explicitly added in src/pl/tcl/Makefile, so it's our own doing. I tracked this back, and it's been moved and rearranged in that makefile a number of time. The original addition was

commit e3909672f12e0ddf3e202b824fda068ad2195ef2
Author: Tom Lane <t...@sss.pgh.pa.us>
Date:   Mon Dec 14 00:46:49 1998

    Build pltcl.so correctly on platforms that want dependent
    shared libraries to be listed in the link command.

Has anyone else seen this?

Note, I'm using the tcl-tk package from Homebrew. The tcl installation provided by macOS itself no longer appears to work for linking against.


Reply via email to