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
Hello,
On 17.03.20 00:36, Greg Troxel wrote:
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.)
- -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.
we are open to adjust as needed to make it work on NetBSD, to my knowledge most of the active developers are using Linux, so maybe some compile switches diverted into a more Linux-specific form. You can make a pull request with the changes you want to be applied and we can test on linux to be sure nothing is broken.
- 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.
This is the default when compiling and installing from sources. Debian packages use a different path for libs. I think there is an option to overwrite the value from command line, if not, I am fine to add guard condition on linux or add the option to set it from command line.
- 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.
Indeed, some of these conditions got quite complex as we developed over the time, almost of 20 years of trying to support various versions of OSes and libs. Likely many are no longer needed because those OSes/libs versions are not used any more. I am suggesting the same thing here: try to make pull requests with what you know is good for netbsd and we will try to make it not break linux.
Cheers, Daniel
Thanks for any hints, Greg
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev