pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/60797: devel/ncurses: configure rewrites /var/run/ld.so.hints on OpenBSD



>Number:         60797
>Category:       pkg
>Synopsis:       devel/ncurses: configure rewrites /var/run/ld.so.hints on OpenBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 26 10:45:01 +0000 2026
>Originator:     Showta Ishizaki
>Release:        pkgsrc-current
>Organization:
>Environment:
System: OpenBSD 7.9 amd64
Architecture: x86_64
Machine: amd64
>Description:
	Building devel/ncurses as root on OpenBSD leaves the system
	unable to run anything from /usr/local:

	  ld.so: rsync: can't load library 'liblz4.so.3.3'
	  ld.so: python3: can't load library 'libintl.so.8.2'

	CF_LD_SEARCHPATH in configure tries four things in turn, and on
	OpenBSD the first three give nothing:

	  ld --verbose               LLD 19.1.7, no SEARCH_DIR lines
	  ldconfig -NX -v            "ldconfig: unknown option -- N"
	  ldconfig -v  (first sed)   lists "Adding /usr/lib/..." lines,
	                             which that sed does not pick up
	  ldconfig -v  (second sed)  the branch written for OpenBSD;
	                             yields /usr/lib

	On Linux ldconfig -v lists directories.  On OpenBSD, with no
	directory arguments, it rebuilds /var/run/ld.so.hints from the
	default /usr/lib alone, dropping /usr/local/lib and
	/usr/X11R6/lib that rc put there at boot -- and the macro runs
	it twice.  The probe's own answer is /usr/lib either way.

	I found it because after a pkgsrc build the vmactions CI's
	rsync in the VM could no longer start; ldconfig -r showed
	"search directories: /usr/lib".  Anyone who builds ncurses, or
	anything that pulls it in, as root on OpenBSD gets the same
	until the next reboot.

>How-To-Repeat:
	On OpenBSD, as root: ldconfig -r; cd devel/ncurses && make
	configure; ldconfig -r.  The second listing has only /usr/lib.

>Fix:
	Give configure the answer it would arrive at anyway and skip
	the probe:

	  CONFIGURE_ENV.OpenBSD+= cf_cv_ld_searchpath=/usr/lib

	Diff against pkgsrc-current of 2026-09-26 (Makefile still
	1.124); it applies with no fuzz.

	Measured on OpenBSD 7.8/amd64, 7.9/amd64 and 7.9/arm64.  Each
	box ran make configure three times -- with the line, without
	it, with it again -- reading ldconfig -r after each and putting
	the hints back by hand before each run.  With the line the
	hints keep all three directories; without it they come back as
	/usr/lib alone; with the line again they stay at three.  The
	line does not repair a broken hints file, it only stops
	configure from breaking it.

	The middle step is there on purpose: without it, "the hints
	survived" and "this box never breaks" look identical.

	The order the three appear in is not the same everywhere -- rc
	and a hand-run ldconfig put them in different orders -- so what
	is worth reading is whether /usr/local/lib is there at all.

	configure reaches the same answer either way -- "checking for
	linker search path... /usr/lib" with the line absent, and the
	cached /usr/lib with it present -- so this changes the probe's
	side effect, not how ncurses is built.

	The probe itself is upstream's; I will report it there too.

	--- devel/ncurses/Makefile.orig
	+++ devel/ncurses/Makefile
	@@ -44,6 +44,13 @@
	 CONFIGURE_ARGS.Darwin+=	--disable-mixed-case
	 CONFIGURE_ARGS.SunOS+=	--disable-const
	 
	+# configure probes the linker search path by running "ldconfig -v".  On
	+# OpenBSD that does not list anything, it rewrites /var/run/ld.so.hints
	+# with only /usr/lib when run as root, and every binary under /usr/local
	+# then fails to load its libraries.  The answer it arrives at there is
	+# /usr/lib anyway, so give it that and skip the probe.
	+CONFIGURE_ENV.OpenBSD+=	cf_cv_ld_searchpath=/usr/lib
	+
	 CONFIGURE_ARGS.UnixWare+=	--disable-libtool-version
	 
	 # QNX libc is missing some functions.




Home | Main Index | Thread Index | Old Index