pkgsrc-Bugs archive

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

pkg/58383: Cannot build databases/db4 on NetBSD/sh3 and cannot specify a 'posixmutexes' option when configure



>Number:         58383
>Category:       pkg
>Synopsis:       Cannot build databases/db4 on NetBSD/sh3 and cannot specify a 'posixmutexes' option when configure
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 30 19:00:01 +0000 2024
>Originator:     Yasushi Oshima
>Release:        pkgsrc-current
>Organization:
>Environment:
NetBSD usl5p 10.0_STABLE NetBSD 10.0_STABLE (GENERIC) #0: Fri Jun 28 03:34:19 JST 2024  oshima@sudachi:/export/netbsd-10/20240628/obj/landisk/sys/arch/landisk/compile/GENERIC landisk
>Description:
NetBSD/sh3 does not have HAVE_MUTEX_(arch)_GCC_ASSEMBLY in dbinc/mutex_int.h of db4, so db4 configure fails as below:

-----
checking for mutexes... UNIX/fcntl
configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM
configure: Unable to find a mutex implementation
*** ERROR code 1
-----

So some pkgsrc pacakges that depends to db4 cannot build on NetBSD/sh3.

To fix this, it will be necessary to create a GCC_ASSEMBLY for sh3 in db4, just like any other arch.

However, by specifying --enable-posixmutexes in configure without creating a new code, it uses the POSIX standard mutexes of the pthread library which is provided as a standard library in all NetBSDs.
This option will not be checked automatically, so must be enabled manually.  

When add PKG_OPTIONS to be able to specify --enable-posixmutexes, it will be able to build on NetBSD/sh3.

In addition, an another arch which also does not have GCC_ASSEMBLY in db4 (ex. vax) will become buildable by posixmutexes, too.
If a new arch is added in NetBSD in the future, it will not be necessary to create a special assembly code in db4, as a GENERIC code.
(Of course, for performance or other reason, no problem to create a new code for a specific arch/cpu...)

However, db4's configure has a bug. This not to be able evaluate correctly the type of pthread implementation.

NetBSD's pthread does not have pthread_condattr_setpshared(), pthread_mutexattr_setpshared().
So, it is expected to be generated by configure as follows:

 #define	HAVE_MUTEX PTHREADS 1
 #define	HAVE_MUTEX_THREAD_ONLY 1

This is recognized to 'POSIX/pthreads/library/private' by 'configure --enable-posixmutexes'.
However it matches POSIX/pthreads* because the order of pthreads-style type in 'case' syntax. HAVE_MUTEX_THREAD_ONLY is not defined.

This reason, fix to db_cv_mutex case in configure.
The db5's configure has been fixed to be correct order.
The db4 is so old, it will be never fixed in upstream, just as everyone expected.

>How-To-Repeat:
In pkgsrc/databases/db4 on NetBSD/sh3(ex. landisk, hpcsh, ...)
   or NetBSD/vax

1. configure failed
 # make

2. build failed
 # make CONFIGURE_ARGS=--enable-posixmutexes

>Fix:
1. To add NEW option (for example:'posixmutexes') in options.mk for --enable-posixmutexes.
2. Add this to PKG_SUGGESTED_OPTIONS when sh3* or vax by default.
3. Fix the case for checking pthreads-style in configure.

An example is here:
https://github.com/oshimaya/pkgsrc/commit/e1d8cab7d349a1519e2e1869b6a1a1e80712f5e5

The 'posixmutexes' PKG_OPTION may be a good choice in databases/db5 and db6, however I have not used them, so no any test or verified it.


Home | Main Index | Thread Index | Old Index