Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't link correctly to healpix library #135

Open
JeremyMcCormick opened this issue Dec 20, 2024 · 5 comments
Open

Can't link correctly to healpix library #135

JeremyMcCormick opened this issue Dec 20, 2024 · 5 comments

Comments

@JeremyMcCormick
Copy link

JeremyMcCormick commented Dec 20, 2024

I'm having a very difficult time getting the pgsphere extension to link properly against an installed healpix library.

ppdb=# CREATE EXTENSION pg_sphere;
ERROR:  could not load library "/usr/lib/postgresql/16/lib/pg_sphere.so": /usr/lib/postgresql/16/lib/pg_sphere.so: undefined symbol: _ZTI11PlanckError

The healpix library seems to contain this symbol:

nm -D libhealpix_cxx.so.4 | grep PlanckError
0000000000042be0 T _ZN11PlanckErrorC1EPKc
0000000000042b30 T _ZN11PlanckErrorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
0000000000042be0 T _ZN11PlanckErrorC2EPKc
0000000000042b30 T _ZN11PlanckErrorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
0000000000042b10 T _ZN11PlanckErrorD0Ev
0000000000042ad0 T _ZN11PlanckErrorD1Ev
0000000000042ad0 T _ZN11PlanckErrorD2Ev
00000000000430e0 W _ZNK11PlanckError4whatEv
00000000000c2bf8 V _ZTI11PlanckError
00000000000a9768 V _ZTS11PlanckError
00000000000c2c08 V _ZTV11PlanckError

And ldd indicates that pgsphere is linked against the healpix library.

Any ideas how to debug/fix this?

@JeremyMcCormick
Copy link
Author

Dockerfile.txt

Here is the Dockerfile.

I'm using a Citus image, but I doubt it matters.

I can try testing with the official Postgres image to rule it out if necessary...

@JeremyMcCormick
Copy link
Author

Looks like I needed something like this:

SET dynamic_library_path TO '/usr/lib/postgresql/16/lib:/opt/healpix/lib';

Closing as fixed.

@esabol
Copy link
Contributor

esabol commented Dec 20, 2024

Did setting the LD_LIBRARY_PATH environment variable before starting PostgreSQL not work?

I imagine you could also add a file to /etc/ld.so.conf.d/ to get it to load that way.

Well, we should probably add something along these lines to the README and/or documentation.

@JeremyMcCormick
Copy link
Author

JeremyMcCormick commented Dec 20, 2024

Did setting the LD_LIBRARY_PATH environment variable before starting PostgreSQL not work?

I imagine you could also add a file to /etc/ld.so.conf.d/ to get it to load that way.

Well, we should probably add something along these lines to the README and/or documentation.

(Let me reopen this ticket so we can dialog about it.)

Yes, I ended up doing all of what you suggested, too. :)

I can provide a Dockerfile if that would be helpful.

Getting healpix -> pg_sphere -> Postgres setup properly is actually pretty tricky.

@JeremyMcCormick
Copy link
Author

JeremyMcCormick commented Dec 20, 2024

Dockerfile.txt

This is what worked for me, at least for getting the extension loading properly.

(Note that this uses a Citus Docker container and not an official Postgres one, but I do not think that matters as Citus runs as a Postgres database with an extension.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants