lelit/pglast

pglast>-6 install from wheel is missing symbol

Closed this issue · 11 comments

After installing pglast 6.1 from a wheel via pip, I was unable to import the package.

>>> import pglast
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/charles/Documents/git/wxtg/cynque-api-server/.venv/3.12.0/lib/python3.12/site-packages/pglast/__init__.py", line 14, in <module>
    from .parser import fingerprint, get_postgresql_version, parse_sql, scan, split
ImportError: dlopen(/Users/charles/Documents/git/wxtg/cynque-api-server/.venv/3.12.0/lib/python3.12/site-packages/pglast/parser.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_pg_query__keyword_kind__descriptor'

This happened on my MacBook Pro, Apple M1 Max, Mac OS 14.2, and python 3.12.

I was able to build, install, and import pglast 6.1 from source.

I will try to investigate, but since Apple machines are a scarce resource around me it's a bit tricky.

Am I right assuming this does not affect "old" Intel-based Macs?

Indeed, the wheel built for Apple Silicon macs is b0rked: it seems that the extension module (pglast/parser.cpython-311-darwin.so) was not properly linked against the static libpg_query.a... and in fact it is a mere 606Kb, confronted with the 3.7Mb of the same shared object produced for x86_64... A local compile of the module on a macpro m3 produces a more reasonable and working 4.4Mb .so file.
I really don't know what's going on here 😭

@declaresub: I tried addressing this issue in the homonym branch; any chance you could try installing the wheel produced here and see if it works as expected?

I installed the wheel and got the same error, unfortunately.

I installed the wheel and got the same error, unfortunately.

Ok, thank for trying. I will ask around.

I made another experiment, that apparently produced normal sized wheels... as the changelog says it's a bit extreme, but if it works...

Update: AFAICT, that last build produced a working wheel also for ARM64.

@declaresub, a double check would be appreciated 😉

I just double-checked with success -- installed from wheel in a fresh virtual environment, and successfully imported pglast.

GH yesterday announced a new macOS M1 runner, that apparently produced correct wheels.

I just released v6.2, and I'm confident it fixes this problem.