[sr-dev] minor issues building on NetBSD

Greg Troxel gdt at lexort.com
Tue Mar 17 00:36:05 CET 2020


I'm working on adding 5.3.3 to pkgsrc, and have run into a few minor
things.  I'm mentioning them here in the hopes of being steered towards
the preferred way to fix.

(I hope this belongs on -dev; let me know if not.)

1) -ldl

In src/Makefile.defs, I had to do:

  -LD_PMUTEX_OPTS = -pthread -rdynamic -ldl -Wl,-Bsymbolic-functions
  +LD_PMUTEX_OPTS = -pthread -rdynamic -Wl,-Bsymbolic-functions

because on NetBSD there is no -ldl and dlopen is just in libc.

My suggested fix is to define a LD_LIBDL per OS and use that variable
instead when it would be needed.

2) lib64

I did

  -LIBDIR ?=
  -ifeq ($(LIBDIR),)
  -ARCHBSZ= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
  -ifeq ($(ARCHBSZ),64b)
  -       LIBDIR = lib64
  -else
  -       LIBDIR = lib
  -endif
  -endif
  +LIBDIR = lib

because on NetBSD native libs always go in lib, and we put emulated
(other arch that can be run, so i386 on amd64 is considered emulated) in
/emul/foo.  As I understand it this is true on other BSDs, Solaris, and
probably things like AIX and IRIX.

So I would suggest that this be guarded with an "if linux".  Perhaps
there are other systems that also want lib64.

3) namespace visibility

In src/lib/srdb1/db_ut.c there is some complicated namespace visibility
macro use, to ensure strptime is vailable.   Then after setting one,
there are others to recover from that.  On NetBSD, it didn't recover.  I
ripped it all out and

+#define _NETBSD_SOURCE
+#include <sys/types.h>

which isn't right either of course.

What I'd suggest is to avoid any namespace mucking except on a
particular system and version of that system known to need it, as mostly
things seem to go better with no visibility definitions.

I also have found problems with changing the visibility defines, running
into a situation where one header hid something but then later when it
shouldn't have been some other header wanted to include the first
header, but it had already been processed. 

And, the code as is doens't seem to undo the defines after including,
even though it seems to try to.


Thanks for any hints,
Greg



More information about the sr-dev mailing list