s_lock_test no longer works - Mailing list pgsql-hackers

From Alvaro Herrera
Subject s_lock_test no longer works
Date
Msg-id 202401241114.ied53jcich72@alvherre.pgsql
Whole thread Raw
Responses Re: s_lock_test no longer works
Re: s_lock_test no longer works
List pgsql-hackers
I just discovered that doing "make -C src/backend/storage/lmgr check" no
longer works, because commit 92daeca45df6 ("Add wait event for
pg_usleep() in perform_spin_delay()") added a requirement for
my_wait_event_info to be present at link time:

$ LC_ALL=C make -C src/backend/storage/lmgr/ s_lock_test
make: Entering directory '/home/alvherre/Code/pgsql-build/master/src/backend/storage/lmgr'
gcc -I. -I../../../../src/include -I/pgsql/source/master/src/include  -D_GNU_SOURCE  -Wall -Wmissing-prototypes
-Wpointer-arith-Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute
-Wimplicit-fallthrough=3-Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-Wno-format-truncation -Wno-stringop-truncation -g -O2 -DS_LOCK_TEST=1
/pgsql/source/master/src/backend/storage/lmgr/s_lock.c\
 
     -L ../../../../src/common -lpgcommon \
    -L ../../../../src/port -lpgport -lm -o s_lock_test
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: warning: relocation against `my_wait_event_info' in read-only
section`.text'
 
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: in function `pgstat_report_wait_start':
/pgsql/source/master/src/include/utils/wait_event.h:94: undefined reference to `my_wait_event_info'
/usr/bin/ld: /run/user/1000/alvherre-tmp/ccMaAvVj.o: in function `pgstat_report_wait_end':
/pgsql/source/master/src/include/utils/wait_event.h:107: undefined reference to `my_wait_event_info'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:35: s_lock_test] Error 1
make: Leaving directory '/home/alvherre/Code/pgsql-build/master/src/backend/storage/lmgr'


This is after I added -lm, to fix these other problems:

/home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269:
undefinedreference to `log'
 
/usr/bin/ld:
/home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269:
undefinedreference to `sin'
 
/usr/bin/ld:
/home/alvherre/Code/pgsql-build/master/src/common/../../../../../../../pgsql/source/master/src/common/pg_prng.c:269:
undefinedreference to `sqrt'
 


On my machine, it's enough to patch s_lock_test.c to have a local definition
for the missing symbol.  Since the file already has a test mode, it
turns out to be quite simple -- attached.


I do wonder if we want to keep this around, given that it's been more
than one year broken and nobody seems to have noticed, and the Meson
build does not support the test as a target.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
 Are you not unsure you want to delete Firefox?
       [Not unsure]     [Not not unsure]    [Cancel]
                   http://smylers.hates-software.com/2008/01/03/566e45b2.html

Attachment

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Synchronizing slots from primary to standby
Next
From: Fujii Masao
Date:
Subject: Re: Network failure may prevent promotion