diff mbox series

[1/1] package/postgresql: fix service runtime

Message ID 20240117210756.265708-1-ju.o@free.fr
State Accepted
Headers show
Series [1/1] package/postgresql: fix service runtime | expand

Commit Message

Julien Olivain Jan. 17, 2024, 9:07 p.m. UTC
Since commit 2a8065e "package/postgresql: bump version to 16.1", the
postgresql service fail to start at runtime with an error:

    FATAL:  could not load library "/usr/lib/postgresql/dict_snowball.so": /usr/lib/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext

This is due to the Posgresql autotool configure script trying to
detect whether the toolchain linker needs --export-dynamic or not.
This test is done with a runtime execution of a test program, and
therefore cannot run in cross-compilation. In that case, the
configure script assumes it is not needed. See commit [1], included
in PostgreSQL v16.0.

This commit fixes the issue by forcing the value in _CONF_ENV. The
package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
value can be unconditionally set.

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
This patch was tested on branch master at commit b200632, and also
with patch from:
https://patchwork.ozlabs.org/project/buildroot/patch/20240111224003.243443-1-ju.o@free.fr/

with command:

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_postgresql
    ...
    OK
---
 package/postgresql/postgresql.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Maxim Kochetkov Jan. 18, 2024, 5:30 a.m. UTC | #1
On 18.01.2024 00:07, Julien Olivain wrote:
> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
> postgresql service fail to start at runtime with an error:
> 
>      FATAL:  could not load library "/usr/lib/postgresql/dict_snowball.so": /usr/lib/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
> 
> This is due to the Posgresql autotool configure script trying to
> detect whether the toolchain linker needs --export-dynamic or not.
> This test is done with a runtime execution of a test program, and
> therefore cannot run in cross-compilation. In that case, the
> configure script assumes it is not needed. See commit [1], included
> in PostgreSQL v16.0.
> 
> This commit fixes the issue by forcing the value in _CONF_ENV. The
> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
> value can be unconditionally set.
> 
> [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Reviewed-by: Maxim Kochetkov <fido_max@inbox.ru>
Julien Olivain Jan. 18, 2024, 6:08 p.m. UTC | #2
Hi,

On 17/01/2024 22:07, Julien Olivain wrote:
> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
> postgresql service fail to start at runtime with an error:
> 
>     FATAL:  could not load library 
> "/usr/lib/postgresql/dict_snowball.so": 
> /usr/lib/postgresql/dict_snowball.so: undefined symbol: 
> CurrentMemoryContext
> 
> This is due to the Posgresql autotool configure script trying to
> detect whether the toolchain linker needs --export-dynamic or not.
> This test is done with a runtime execution of a test program, and
> therefore cannot run in cross-compilation. In that case, the
> configure script assumes it is not needed. See commit [1], included
> in PostgreSQL v16.0.
> 
> This commit fixes the issue by forcing the value in _CONF_ENV. The
> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
> value can be unconditionally set.
> 
> [1] 
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> This patch was tested on branch master at commit b200632, and also
> with patch from:
> https://patchwork.ozlabs.org/project/buildroot/patch/20240111224003.243443-1-ju.o@free.fr/
> 
> with command:
> 
>     support/testing/run-tests \
>         -d dl -o output_folder \
>         tests.package.test_postgresql
>     ...
>     OK

For info, I tested this patch on branch master at
commit d622ea0 with commands:

utils/test-pkg -a -p postgresql
                              arm-aarch64 [ 1/45]: OK
                    bootlin-aarch64-glibc [ 2/45]: OK
                bootlin-arcle-hs38-uclibc [ 3/45]: OK
                     bootlin-armv5-uclibc [ 4/45]: OK
                      bootlin-armv7-glibc [ 5/45]: OK
                    bootlin-armv7m-uclibc [ 6/45]: SKIPPED
                       bootlin-armv7-musl [ 7/45]: OK
                 bootlin-m68k-5208-uclibc [ 8/45]: SKIPPED
                bootlin-m68k-68040-uclibc [ 9/45]: OK
              bootlin-microblazeel-uclibc [10/45]: OK
                 bootlin-mipsel32r6-glibc [11/45]: OK
                    bootlin-mipsel-uclibc [12/45]: OK
                      bootlin-nios2-glibc [13/45]: OK
                  bootlin-openrisc-uclibc [14/45]: OK
         bootlin-powerpc64le-power8-glibc [15/45]: OK
            bootlin-powerpc-e500mc-uclibc [16/45]: OK
                    bootlin-riscv32-glibc [17/45]: OK
                    bootlin-riscv64-glibc [18/45]: OK
                     bootlin-riscv64-musl [19/45]: OK
                  bootlin-s390x-z13-glibc [20/45]: OK
                       bootlin-sh4-uclibc [21/45]: OK
                    bootlin-sparc64-glibc [22/45]: OK
                     bootlin-sparc-uclibc [23/45]: OK
                     bootlin-x86-64-glibc [24/45]: OK
                      bootlin-x86-64-musl [25/45]: OK
                    bootlin-x86-64-uclibc [26/45]: OK
                    bootlin-xtensa-uclibc [27/45]: OK
                             br-arm-basic [28/45]: SKIPPED
                     br-arm-full-nothread [29/45]: OK
                       br-arm-full-static [30/45]: SKIPPED
                    br-i386-pentium4-full [31/45]: OK
                 br-i386-pentium-mmx-musl [32/45]: OK
                       br-mips64-n64-full [33/45]: OK
                  br-mips64r6-el-hf-glibc [34/45]: OK
                br-powerpc-603e-basic-cpp [35/45]: SKIPPED
                br-powerpc64-power7-glibc [36/45]: OK
                        linaro-aarch64-be [37/45]: OK
                           linaro-aarch64 [38/45]: OK
                               linaro-arm [39/45]: OK
                      sourcery-arm-armv4t [40/45]: OK
                             sourcery-arm [41/45]: OK
                      sourcery-arm-thumb2 [42/45]: OK
                          sourcery-mips64 [43/45]: OK
                            sourcery-mips [44/45]: OK
                           sourcery-nios2 [45/45]: OK
45 builds, 5 skipped, 0 build failed, 0 legal-info failed, 0 show-info 
failed

> ---
>  package/postgresql/postgresql.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/postgresql/postgresql.mk 
> b/package/postgresql/postgresql.mk
> index ec5b61b932..644f93d88a 100644
> --- a/package/postgresql/postgresql.mk
> +++ b/package/postgresql/postgresql.mk
> @@ -15,6 +15,7 @@ POSTGRESQL_INSTALL_STAGING = YES
>  POSTGRESQL_CONFIG_SCRIPTS = pg_config
>  POSTGRESQL_CONF_ENV = \
>  	ac_cv_type_struct_sockaddr_in6=yes \
> +	pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic=yes \
>  	LIBS=$(TARGET_NLS_LIBS)
>  POSTGRESQL_CONF_OPTS = --disable-rpath
>  POSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
> --
> 2.43.0

Best regards,

Julien.
Yann E. MORIN Jan. 21, 2024, 9:14 a.m. UTC | #3
Julien, All,

On 2024-01-17 22:07 +0100, Julien Olivain spake thusly:
> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
> postgresql service fail to start at runtime with an error:
> 
>     FATAL:  could not load library "/usr/lib/postgresql/dict_snowball.so": /usr/lib/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
> 
> This is due to the Posgresql autotool configure script trying to
> detect whether the toolchain linker needs --export-dynamic or not.
> This test is done with a runtime execution of a test program, and
> therefore cannot run in cross-compilation. In that case, the
> configure script assumes it is not needed. See commit [1], included
> in PostgreSQL v16.0.
> 
> This commit fixes the issue by forcing the value in _CONF_ENV. The
> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
> value can be unconditionally set.
> 
> [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d

I've added references to the ML thread upstream, with their position
that cross-compiling is not really a supoprted thing.

> Signed-off-by: Julien Olivain <ju.o@free.fr>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> This patch was tested on branch master at commit b200632, and also
> with patch from:
> https://patchwork.ozlabs.org/project/buildroot/patch/20240111224003.243443-1-ju.o@free.fr/
> 
> with command:
> 
>     support/testing/run-tests \
>         -d dl -o output_folder \
>         tests.package.test_postgresql
>     ...
>     OK
> ---
>  package/postgresql/postgresql.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
> index ec5b61b932..644f93d88a 100644
> --- a/package/postgresql/postgresql.mk
> +++ b/package/postgresql/postgresql.mk
> @@ -15,6 +15,7 @@ POSTGRESQL_INSTALL_STAGING = YES
>  POSTGRESQL_CONFIG_SCRIPTS = pg_config
>  POSTGRESQL_CONF_ENV = \
>  	ac_cv_type_struct_sockaddr_in6=yes \
> +	pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic=yes \
>  	LIBS=$(TARGET_NLS_LIBS)
>  POSTGRESQL_CONF_OPTS = --disable-rpath
>  POSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Peter Korsgaard Feb. 4, 2024, 9:06 a.m. UTC | #4
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Julien, All,
 > On 2024-01-17 22:07 +0100, Julien Olivain spake thusly:
 >> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
 >> postgresql service fail to start at runtime with an error:
 >> 
 >> FATAL: could not load library
 >> "/usr/lib/postgresql/dict_snowball.so":
 >> /usr/lib/postgresql/dict_snowball.so: undefined symbol:
 >> CurrentMemoryContext
 >> 
 >> This is due to the Posgresql autotool configure script trying to
 >> detect whether the toolchain linker needs --export-dynamic or not.
 >> This test is done with a runtime execution of a test program, and
 >> therefore cannot run in cross-compilation. In that case, the
 >> configure script assumes it is not needed. See commit [1], included
 >> in PostgreSQL v16.0.
 >> 
 >> This commit fixes the issue by forcing the value in _CONF_ENV. The
 >> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
 >> value can be unconditionally set.
 >> 
 >> [1]
 >> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d

 > I've added references to the ML thread upstream, with their position
 > that cross-compiling is not really a supoprted thing.

 >> Signed-off-by: Julien Olivain <ju.o@free.fr>

 > Applied to master, thanks.

Committed to 2023.11.x, thanks.
Baruch Siach Feb. 4, 2024, 3:40 p.m. UTC | #5
Hi Peter,

On Sun, Feb 04 2024, Peter Korsgaard wrote:

>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>
>  > Julien, All,
>  > On 2024-01-17 22:07 +0100, Julien Olivain spake thusly:
>  >> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
>  >> postgresql service fail to start at runtime with an error:
>  >> 
>  >> FATAL: could not load library
>  >> "/usr/lib/postgresql/dict_snowball.so":
>  >> /usr/lib/postgresql/dict_snowball.so: undefined symbol:
>  >> CurrentMemoryContext
>  >> 
>  >> This is due to the Posgresql autotool configure script trying to
>  >> detect whether the toolchain linker needs --export-dynamic or not.
>  >> This test is done with a runtime execution of a test program, and
>  >> therefore cannot run in cross-compilation. In that case, the
>  >> configure script assumes it is not needed. See commit [1], included
>  >> in PostgreSQL v16.0.
>  >> 
>  >> This commit fixes the issue by forcing the value in _CONF_ENV. The
>  >> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
>  >> value can be unconditionally set.
>  >> 
>  >> [1]
>  >> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d
>
>  > I've added references to the ML thread upstream, with their position
>  > that cross-compiling is not really a supoprted thing.
>
>  >> Signed-off-by: Julien Olivain <ju.o@free.fr>
>
>  > Applied to master, thanks.
>
> Committed to 2023.11.x, thanks.

Not in 2023.11.x as of commit 7d35d445a1ae ("package/micropython: fix
building after dropping GIT_DIR=. workaround").

baruch
Maxim Kochetkov Feb. 4, 2024, 8:51 p.m. UTC | #6
On 04.02.2024 12:06, Peter Korsgaard wrote:
>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
>   > Julien, All,
>   > On 2024-01-17 22:07 +0100, Julien Olivain spake thusly:
>   >> Since commit 2a8065e "package/postgresql: bump version to 16.1", the
>   >> postgresql service fail to start at runtime with an error:
>   >>
>   >> FATAL: could not load library
>   >> "/usr/lib/postgresql/dict_snowball.so":
>   >> /usr/lib/postgresql/dict_snowball.so: undefined symbol:
>   >> CurrentMemoryContext
>   >>
>   >> This is due to the Posgresql autotool configure script trying to
>   >> detect whether the toolchain linker needs --export-dynamic or not.
>   >> This test is done with a runtime execution of a test program, and
>   >> therefore cannot run in cross-compilation. In that case, the
>   >> configure script assumes it is not needed. See commit [1], included
>   >> in PostgreSQL v16.0.
>   >>
>   >> This commit fixes the issue by forcing the value in _CONF_ENV. The
>   >> package has already a Kconfig dependency on !BR2_STATIC_LIBS, so the
>   >> value can be unconditionally set.
>   >>
>   >> [1]
>   >> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9db49fc5bfdc0126be03f4b8986013e59d93b91d
> 
>   > I've added references to the ML thread upstream, with their position
>   > that cross-compiling is not really a supoprted thing.
> 
>   >> Signed-off-by: Julien Olivain <ju.o@free.fr>
> 
>   > Applied to master, thanks.
> 
> Committed to 2023.11.x, thanks.
> 

Not needed for 2023.11. Because it is still on 15.5 Posgresql version
Peter Korsgaard Feb. 4, 2024, 8:59 p.m. UTC | #7
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > Hi Peter,
 > On Sun, Feb 04 2024, Peter Korsgaard wrote:

 >> > Applied to master, thanks.
 >> 
 >> Committed to 2023.11.x, thanks.

 > Not in 2023.11.x as of commit 7d35d445a1ae ("package/micropython: fix
 > building after dropping GIT_DIR=. workaround").

Ehh, I made a mistake - 2023.11.x doesn't have postgresql 16.x, so this
is not backported.
diff mbox series

Patch

diff --git a/package/postgresql/postgresql.mk b/package/postgresql/postgresql.mk
index ec5b61b932..644f93d88a 100644
--- a/package/postgresql/postgresql.mk
+++ b/package/postgresql/postgresql.mk
@@ -15,6 +15,7 @@  POSTGRESQL_INSTALL_STAGING = YES
 POSTGRESQL_CONFIG_SCRIPTS = pg_config
 POSTGRESQL_CONF_ENV = \
 	ac_cv_type_struct_sockaddr_in6=yes \
+	pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic=yes \
 	LIBS=$(TARGET_NLS_LIBS)
 POSTGRESQL_CONF_OPTS = --disable-rpath
 POSTGRESQL_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)