diff mbox series

[meta-oe] postgresql: fix a runtime error

Message ID 20240314072215.6854-1-changqing.li@windriver.com
State Accepted
Headers show
Series [meta-oe] postgresql: fix a runtime error | expand

Commit Message

Changqing Li March 14, 2024, 7:22 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

initdb on target will fail with below error:
2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext

Refer [1][2], for cross compile, --export-dynamic is assumed as not
supported, and cause above error. For oe, both gcc and clang support
--export-dynamic, fixed by set LDFLAGS_EX_BE directly

[1] https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
[2] https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
 1 file changed, 1 insertion(+)

Comments

Khem Raj March 14, 2024, 5:12 p.m. UTC | #1
On Thu, Mar 14, 2024 at 12:22 AM Changqing Li
<changqing.li@eng.windriver.com> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> initdb on target will fail with below error:
> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
>
> Refer [1][2], for cross compile, --export-dynamic is assumed as not
> supported, and cause above error. For oe, both gcc and clang support
> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
>
> [1] https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
> [2] https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> index 868a2e443..e29a5bef7 100644
> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> @@ -35,6 +35,7 @@ LEAD_SONAME = "libpq.so"
>
>  # LDFLAGS for shared libraries
>  export LDFLAGS_SL = "${LDFLAGS}"
> +export LDFLAGS_EX_BE = "-Wl,--export-dynamic"

this will add all the symbols into dynamic symbol table which may not
be best scenario, can we just export the ones needed ?
perhaps look into using --dynamic-list.

>
>  inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
>
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#109311): https://lists.openembedded.org/g/openembedded-devel/message/109311
> Mute This Topic: https://lists.openembedded.org/mt/104922226/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Changqing Li March 15, 2024, 5:01 a.m. UTC | #2
On 3/15/24 01:12, Khem Raj wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, Mar 14, 2024 at 12:22 AM Changqing Li
> <changqing.li@eng.windriver.com>  wrote:
>> From: Changqing Li<changqing.li@windriver.com>
>>
>> initdb on target will fail with below error:
>> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
>>
>> Refer [1][2], for cross compile, --export-dynamic is assumed as not
>> supported, and cause above error. For oe, both gcc and clang support
>> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
>>
>> [1]https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
>> [2]https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
>>
>> Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> ---
>>   meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> index 868a2e443..e29a5bef7 100644
>> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> @@ -35,6 +35,7 @@ LEAD_SONAME = "libpq.so"
>>
>>   # LDFLAGS for shared libraries
>>   export LDFLAGS_SL = "${LDFLAGS}"
>> +export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
> this will add all the symbols into dynamic symbol table which may not
> be best scenario, can we just export the ones needed ?
> perhaps look into using --dynamic-list.

Hi, Khem

I tried to use --dynamic-list as you recommended and test command 
"postgresql_setup initdb",

after I added all the symbols in dict_snowball.so, it will report 
undefined symbolsfor another lib. I know I can try to

add all the symbols for all the libs. but there are nearly 80+ libs 
generated by postgresql. There will be many symbols.

And I also worried that, we may missing some symbols since I may cannot 
cover all the runtime cases.

 From [2], we can know that postgresql use "-Wl,--export-dynamic" before.

So maybe it is better to still use "-Wl,--export-dynamic" like before? 
what is your opinion?

Thanks

Changqing

>>   inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
>>
>> --
>> 2.25.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#109311):https://lists.openembedded.org/g/openembedded-devel/message/109311
>> Mute This Topic:https://lists.openembedded.org/mt/104922226/1997914
>> Group Owner:openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub  [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Khem Raj March 15, 2024, 5:10 a.m. UTC | #3
On Thu, Mar 14, 2024 at 10:01 PM Changqing Li
<changqing.li@windriver.com> wrote:
>
>
> On 3/15/24 01:12, Khem Raj wrote:
>
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, Mar 14, 2024 at 12:22 AM Changqing Li
> <changqing.li@eng.windriver.com> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> initdb on target will fail with below error:
> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
>
> Refer [1][2], for cross compile, --export-dynamic is assumed as not
> supported, and cause above error. For oe, both gcc and clang support
> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
>
> [1] https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
> [2] https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> index 868a2e443..e29a5bef7 100644
> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> @@ -35,6 +35,7 @@ LEAD_SONAME = "libpq.so"
>
>  # LDFLAGS for shared libraries
>  export LDFLAGS_SL = "${LDFLAGS}"
> +export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
>
> this will add all the symbols into dynamic symbol table which may not
> be best scenario, can we just export the ones needed ?
> perhaps look into using --dynamic-list.
>
> Hi, Khem
>
> I tried to use --dynamic-list as you recommended and test command "postgresql_setup initdb",
>
> after I added all the symbols in dict_snowball.so, it will report undefined symbols for another lib. I know I can try to
>
> add all the symbols for all the libs. but there are nearly 80+ libs generated by postgresql. There will be many symbols.
>
> And I also worried that, we may missing some symbols since I may cannot cover all the runtime cases.
>
> From [2], we can know that postgresql use "-Wl,--export-dynamic" before.
>
> So maybe it is better to still use "-Wl,--export-dynamic" like before? what is your opinion?
>

Yes this maybe ok. I would like you to open a discussion upstream as well.

> Thanks
>
> Changqing
>
>  inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
>
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#109311): https://lists.openembedded.org/g/openembedded-devel/message/109311
> Mute This Topic: https://lists.openembedded.org/mt/104922226/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Changqing Li March 15, 2024, 5:25 a.m. UTC | #4
On 3/15/24 13:10, Khem Raj wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, Mar 14, 2024 at 10:01 PM Changqing Li
> <changqing.li@windriver.com>  wrote:
>>
>> On 3/15/24 01:12, Khem Raj wrote:
>>
>> CAUTION: This email comes from a non Wind River email account!
>> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>
>> On Thu, Mar 14, 2024 at 12:22 AM Changqing Li
>> <changqing.li@eng.windriver.com>  wrote:
>>
>> From: Changqing Li<changqing.li@windriver.com>
>>
>> initdb on target will fail with below error:
>> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
>>
>> Refer [1][2], for cross compile, --export-dynamic is assumed as not
>> supported, and cause above error. For oe, both gcc and clang support
>> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
>>
>> [1]https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
>> [2]https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
>>
>> Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> ---
>>   meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> index 868a2e443..e29a5bef7 100644
>> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
>> @@ -35,6 +35,7 @@ LEAD_SONAME = "libpq.so"
>>
>>   # LDFLAGS for shared libraries
>>   export LDFLAGS_SL = "${LDFLAGS}"
>> +export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
>>
>> this will add all the symbols into dynamic symbol table which may not
>> be best scenario, can we just export the ones needed ?
>> perhaps look into using --dynamic-list.
>>
>> Hi, Khem
>>
>> I tried to use --dynamic-list as you recommended and test command "postgresql_setup initdb",
>>
>> after I added all the symbols in dict_snowball.so, it will report undefined symbols for another lib. I know I can try to
>>
>> add all the symbols for all the libs. but there are nearly 80+ libs generated by postgresql. There will be many symbols.
>>
>> And I also worried that, we may missing some symbols since I may cannot cover all the runtime cases.
>>
>>  From [2], we can know that postgresql use "-Wl,--export-dynamic" before.
>>
>> So maybe it is better to still use "-Wl,--export-dynamic" like before? what is your opinion?
>>
> Yes this maybe ok. I would like you to open a discussion upstream as well.

Do you mean open an discussion about what symbols should in the symbol 
files?  About the the original issue

"undefined symbol: CurrentMemoryContext", Upstream said that  
"Cross-compiling isn't really a supported thing".


//Changqing

>
>> Thanks
>>
>> Changqing
>>
>>   inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
>>
>> --
>> 2.25.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#109311):https://lists.openembedded.org/g/openembedded-devel/message/109311
>> Mute This Topic:https://lists.openembedded.org/mt/104922226/1997914
>> Group Owner:openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub  [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Khem Raj March 15, 2024, 5:31 a.m. UTC | #5
On Thu, Mar 14, 2024 at 10:25 PM Changqing Li
<changqing.li@windriver.com> wrote:
>
>
> On 3/15/24 13:10, Khem Raj wrote:
>
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, Mar 14, 2024 at 10:01 PM Changqing Li
> <changqing.li@windriver.com> wrote:
>
> On 3/15/24 01:12, Khem Raj wrote:
>
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, Mar 14, 2024 at 12:22 AM Changqing Li
> <changqing.li@eng.windriver.com> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> initdb on target will fail with below error:
> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
>
> Refer [1][2], for cross compile, --export-dynamic is assumed as not
> supported, and cause above error. For oe, both gcc and clang support
> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
>
> [1] https://www.postgresql.org/message-id/79e63515-0f5e-30f4-136d-96e23b1a817d%40posteo.de
> [2] https://github.com/postgres/postgres/commit/9db49fc5bfdc0126be03f4b8986013e59d93b91d#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  meta-oe/recipes-dbs/postgresql/postgresql.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> index 868a2e443..e29a5bef7 100644
> --- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
> +++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
> @@ -35,6 +35,7 @@ LEAD_SONAME = "libpq.so"
>
>  # LDFLAGS for shared libraries
>  export LDFLAGS_SL = "${LDFLAGS}"
> +export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
>
> this will add all the symbols into dynamic symbol table which may not
> be best scenario, can we just export the ones needed ?
> perhaps look into using --dynamic-list.
>
> Hi, Khem
>
> I tried to use --dynamic-list as you recommended and test command "postgresql_setup initdb",
>
> after I added all the symbols in dict_snowball.so, it will report undefined symbols for another lib. I know I can try to
>
> add all the symbols for all the libs. but there are nearly 80+ libs generated by postgresql. There will be many symbols.
>
> And I also worried that, we may missing some symbols since I may cannot cover all the runtime cases.
>
> From [2], we can know that postgresql use "-Wl,--export-dynamic" before.
>
> So maybe it is better to still use "-Wl,--export-dynamic" like before? what is your opinion?
>
> Yes this maybe ok. I would like you to open a discussion upstream as well.
>
> Do you mean open an discussion about what symbols should in the symbol files?  About the the original issue
>
> "undefined symbol: CurrentMemoryContext",  Upstream said that  "Cross-compiling isn't really a supported thing".

hmmm I guess this ends that then

>
>
> //Changqing
>
> Thanks
>
> Changqing
>
>  inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
>
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#109311): https://lists.openembedded.org/g/openembedded-devel/message/109311
> Mute This Topic: https://lists.openembedded.org/mt/104922226/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj March 17, 2024, 8:18 p.m. UTC | #6
On Thu, 14 Mar 2024 15:22:15 +0800, changqing.li@windriver.com wrote:
> initdb on target will fail with below error:
> 2024-03-13 08:40:23.253 UTC [4410] FATAL:  could not load library "/usr/lib64/postgresql/dict_snowball.so": /usr/lib64/postgresql/dict_snowball.so: undefined symbol: CurrentMemoryContext
> 
> Refer [1][2], for cross compile, --export-dynamic is assumed as not
> supported, and cause above error. For oe, both gcc and clang support
> --export-dynamic, fixed by set LDFLAGS_EX_BE directly
> 
> [...]

Applied, thanks!

[1/1] postgresql: fix a runtime error
      commit: 8aec805ac4b5f59a7716dad18461eeeb84872181

Best regards,
diff mbox series

Patch

diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
index 868a2e443..e29a5bef7 100644
--- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
+++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
@@ -35,6 +35,7 @@  LEAD_SONAME = "libpq.so"
 
 # LDFLAGS for shared libraries
 export LDFLAGS_SL = "${LDFLAGS}"
+export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
 
 inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header