pkgsrc-Users archive

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

Re: Testing for Fossil on NetBSD, and runtime loading bug fixed



> From: Dan Shearer <dan%shearer.org@localhost>
> Date: Tue, 18 Aug 2026 13:49:25 +0100
> 
> If you're looking for a maintainers contact in the Fossil project,
> hello, wave.

Hi, welcome!

> I committed fixes for pkgsrc OSs to Fossil in this branch:
> https://fossil-scm.org/home/timeline?r=autodef-build-fixes . The
> latest one applies to NetBSD 11:

>  $ ./fossil version
>   /scratch/src/fossil/./fossil: Shared object "libssl.so.3" not found

That's a surprising failure mode, because if you just use `cc -lssl -o
fossil ...' on NetBSD 11, it will work fine: the build-time linker
will find /usr/lib/libssl.so from the -l name, and bake the library's
DT_SONAME `libssl.so.16' into the executable's DT_NEEDED; then the
run-time loader will find /usr/lib/libssl.so.16 from the DT_NEEDED.

It seems, based on a quick skim, like you have logic in auto.def to
search for any of various paths like /usr/pkg, and you ended
automagically adding -L/usr/pkg (but not -Wl,-R/usr/pkg, as you have
seen).  We strongly advise against doing this for NetBSD, in favour of
either using pkg-config or just accepting configure arguments like
LDFLAGS or --with-openssl to specify the path.

We will even often deliberately patch away hard-coded /usr/pkg in
software when we come across it.  We do this because in pkgsrc, the
prefix is not always /usr/pkg -- and pkgsrc is often used to build and
install packages with multiple prefixes at the same time, for various
reasons.  (Originally, /usr/pkg was chosen instead of /usr/local
precisely to avoid all the hard-coded search paths in various software
that automagically try /usr/local!)

Note that simply changing `-L/foo' to `-L/foo -Wl,-R/foo' is not, in
general, correct.  Where the libraries will be found at build-time
need not -- and often does not -- coincide with where the libraries
will be found at install-time, especially in cross-builds.  For
example, during the build, there might be

/obj/devel/fossil/work/.buildlink/lib/libfoo.so

so the correct -L argument is -L/obj/devel/fossil/work/.buildlink/lib.
But at runtime, the library may be found at

/opt/pkg/lib/libfoo.so.1

so the correct -Wl,-R argument is -Wl,-R/opt/pkg/lib.  (pkgsrc will
wrap the tools like cc and ld to massage these arguments because so
much software gets it wrong.)

Having said that...  It looks like the libssl.pc installed by the
security/openssl package (in contrast to OpenSSL in NetBSD's base
system) is missing the -Wl,-R option!  So maybe auto.def was just
using pkg-config after all and the libssl.pc file was broken.  I've
filed a bug report for this:

PR pkg/60643: security/openssl: missing -Wl,-R in pkg-config .pc files
https://gnats.NetBSD.org/60643

> Apart from that, we're coming up to a release in Fossil, and this is
> an important one since new fashions in egress filters mean that http
> 1.1 is often a requirement, and Fossil now has that in trunk:
> https://fossil-scm.org/home/timeline?r=http1-1-chunked (see my
> comment on the first commit there for more explanation about modern
> net filtering.)

> If releng CI maintainers are interested, there is a test harness for
> Fossil you could run each build (second item on the release list at
> https://fossil-scm.org/home/doc/tip/test/release-checklist.wiki ).

Cool!  We should incorporate the automated parts of that -- and a link
t othe wiki page -- into the do-test target in the devel/fossil
package's Makefile, which is currently missing:

https://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/devel/fossil/Makefile?rev=1.95;content-type=text%2Fplain


Home | Main Index | Thread Index | Old Index