Subject: about cross-compiling issue

From: "陈亚杰" <[email-masked]>
Date: Thu, 23 May 2024 17:08:05 +0800

Hello, I have a question about cross-compiling. I get an error when doing initdb for postgresql for arm64 architecture devices.
The error information is Error relocating /data/postgresql/postgresql-16.3-arm64-v8a-build/tmp_install/usr/postgresql/arm64-v8a/lib/dict_snowball.so: palloc0: symbol not found.
In fact, the library exists in this directory, and the palloc symbol exists but is not defined.
Any tips to go around this issue?
Thanks!

---

From: Tom Lane <[email-masked]>
Date: Thu, 23 May 2024 11:10:49 -0400

> The error information is Error relocating /data/postgresql/postgresql-16.3-arm64-v8a-build/tmp_install/usr/postgresql/arm64-v8a/lib/dict_snowball.so: palloc0: symbol not found.

We don't really support cross-compiling, because there are too many
things that the configure script can't check for if it can't run a
test program.  In this particular case I think what is biting you
is that configure won't add -Wl,--export-dynamic to the backend
link switches.

You might think that that shouldn't require a test program to
verify, but c-compiler.m4 says differently:

# Given a string, check if the compiler supports the string as a
# command-line option. If it does, add to the given variable.
# For reasons you'd really rather not know about, this checks whether
# you can link to a particular function, not just whether you can link.
# In fact, we must actually check that the resulting program runs :-(

This check dates to 2008, and maybe it's no longer necessary on
any modern system, but I'm unexcited about trying to find out.

			regards, tom lane

---

From: "Long Song" <[email-masked]>
Date: Fri, 24 May 2024 14:02:52 +0800 (CST)

Hi Chen Yajie,

 Your provided information is fuzzy, so I can only give some simple suggestions:
1. Use `file dict_snowball.so` to see the detail info of dict_snowball.so, maybe you can get some useful hint.
2. Use gdb to debug the initdb processing, then you can get more detail error info. That will help you figuring out the reason that initdb not working.

At 2024-05-23 16:08:05, "陈亚杰" <[email-masked]> wrote: