diff mbox series

[1/1] package/postgresql: needs threads

Message ID 20240903054622.14033-1-fido_max@inbox.ru
State Changes Requested
Headers show
Series [1/1] package/postgresql: needs threads | expand

Commit Message

Maxim Kochetkov Sept. 3, 2024, 5:46 a.m. UTC
Threads are mandantory since bump to version 16.3 in commit
https://github.com/postgres/postgres/commit/52afe563206e753f4c45c014fee2459ad0855826

fe-misc.c: In function 'libpq_binddomain':
fe-misc.c:1235:16: error: unknown type name 'pthread_mutex_t'
 1235 |         static pthread_mutex_t binddomain_mutex = PTHREAD_MUTEX_INITIALIZER;
      |                ^~~~~~~~~~~~~~~
fe-misc.c:1235:51: error: 'PTHREAD_MUTEX_INITIALIZER' undeclared (first use in this function)
 1235 |         static pthread_mutex_t binddomain_mutex = PTHREAD_MUTEX_INITIALIZER;
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
fe-misc.c:1235:51: note: each undeclared identifier is reported only once for each function it appears in
fe-misc.c:1246:24: warning: implicit declaration of function 'pthread_mutex_lock' [-Wimplicit-function-declaration]
 1246 |                 (void) pthread_mutex_lock(&binddomain_mutex);
      |                        ^~~~~~~~~~~~~~~~~~
fe-misc.c:1263:24: warning: implicit declaration of function 'pthread_mutex_unlock' [-Wimplicit-function-declaration]
 1263 |                 (void) pthread_mutex_unlock(&binddomain_mutex);
      |                        ^~~~~~~~~~~~~~~~~~~~

Fixes: 73dd1d6b96665574607c8b05189426ad3eb05a6f
 - http://autobuild.buildroot.org/results/43dea0d3b618e826e866477124284bf89204113e

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
 package/postgresql/Config.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni Sept. 3, 2024, 8:45 p.m. UTC | #1
Hello Maxim,

On Tue,  3 Sep 2024 08:46:22 +0300
Maxim Kochetkov via buildroot <buildroot@buildroot.org> wrote:

> Threads are mandantory since bump to version 16.3 in commit
> https://github.com/postgres/postgres/commit/52afe563206e753f4c45c014fee2459ad0855826

to which Buildroot was updated in commit
73dd1d6b96665574607c8b05189426ad3eb05a6f.

> diff --git a/package/postgresql/Config.in b/package/postgresql/Config.in
> index 899907d6a5..9faed419bc 100644
> --- a/package/postgresql/Config.in
> +++ b/package/postgresql/Config.in
> @@ -32,9 +32,9 @@ config BR2_PACKAGE_POSTGRESQL_FULL
>  
>  endif
>  
> -comment "postgresql needs a toolchain w/ dynamic library, wchar"
> +comment "postgresql needs a toolchain w/ dynamic library, wchar, threads"
>  	depends on BR2_USE_MMU
> -	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
> +	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
>  
>  comment "postgresql can't be built with Optimize for fast"
>  	depends on BR2_OPTIMIZE_FAST

Unfortunately, this is not sufficient to add a dependency, you also
need "depends on BR2_TOOLCHAIN_HAS_THREADS" in BR2_PACKAGE_POSTGRESQL.

Then, you need to go through all the reverse dependencies of postgresql:

package/bandwidthd/Config.in:   select BR2_PACKAGE_POSTGRESQL
package/collectd/Config.in:     select BR2_PACKAGE_POSTGRESQL
package/lighttpd/Config.in:     select BR2_PACKAGE_POSTGRESQL
package/php/Config.ext: select BR2_PACKAGE_POSTGRESQL
package/php/Config.ext: select BR2_PACKAGE_POSTGRESQL
package/poco/Config.in: select BR2_PACKAGE_POSTGRESQL
package/python-psycopg2/Config.in:      select BR2_PACKAGE_POSTGRESQL
package/qt5/qt5base/Config.in:  select BR2_PACKAGE_POSTGRESQL
package/qt6/qt6base/Config.in:  select BR2_PACKAGE_POSTGRESQL
package/zabbix/Config.in:       select BR2_PACKAGE_POSTGRESQL

and check that they all have a BR2_TOOLCHAIN_HAS_THREADS dependency,
and if not, add it. And then look at their reverse dependencies.

Also, another thing is that postgresql.mk has:

ifneq ($(BR2_TOOLCHAIN_HAS_THREADS_NPTL),y)
POSTGRESQL_CONF_OPTS += --disable-thread-safety
endif

so does it mean that this option is no longer supported? No longer
exists?

Also, does it now need thread support, or NPTL thread support
specifically? (You can figure out by building with a Buildroot
configuration that has BR2_PTHREADS instead of BR2_PTHREADS_NATIVE).

Thanks!

Thomas
Maxim Kochetkov Sept. 4, 2024, 5:52 a.m. UTC | #2
03.09.2024 23:45, Thomas Petazzoni via buildroot пишет:

> Also, another thing is that postgresql.mk has:
> 
> ifneq ($(BR2_TOOLCHAIN_HAS_THREADS_NPTL),y)
> POSTGRESQL_CONF_OPTS += --disable-thread-safety
> endif
> 
> so does it mean that this option is no longer supported? No longer
> exists?

It is totally dropped in PG 17:
https://github.com/postgres/postgres/commit/68a4b58eca032916e2aad78d63f717dcb147e906
But it is not released yet, and timescaledb have no PG 17 support.
It is looks like commit
https://github.com/postgres/postgres/commit/52afe563206e753f4c45c014fee2459ad0855826
is wrong. It has no #ifdef ENABLE_THREAD_SAFETY guard. All other code 
with pthreads has this guard:

#ifdef ENABLE_THREAD_SAFETY
	/* Interlock against concurrent executions of ECPGdebug() */
	pthread_mutex_lock(&debug_init_mutex);

	/* Prevent ecpg_log() from printing while we change settings */
	pthread_mutex_lock(&debug_mutex);
#endif
diff mbox series

Patch

diff --git a/package/postgresql/Config.in b/package/postgresql/Config.in
index 899907d6a5..9faed419bc 100644
--- a/package/postgresql/Config.in
+++ b/package/postgresql/Config.in
@@ -32,9 +32,9 @@  config BR2_PACKAGE_POSTGRESQL_FULL
 
 endif
 
-comment "postgresql needs a toolchain w/ dynamic library, wchar"
+comment "postgresql needs a toolchain w/ dynamic library, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR
+	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 
 comment "postgresql can't be built with Optimize for fast"
 	depends on BR2_OPTIMIZE_FAST