duckdb/duckdb-postgres

postgres_scanner.duckdb_extension: undefined symbol: _ZN6duckdb28SimpleNamedParameterFunction8ToStringEv

Closed this issue · 9 comments

I use BUILD_PYTHON=1 make debug to build the python duckdb, and can import it in python:

import duckdb as dd
dd.__version__
'0.5.2-dev1249'

but, when I load the postgres_scanner,

con = dd.connect(":memory:", config={"allow_unsigned_extensions": True})
url_pgscan="/root/postgres_scanner/build/debug/extension/postgres_scanner/postgres_scanner.duckdb_extension"
con.install_extension(url_pgscan, force_install=True)
con.load_extension("postgres_scanner")

raise error:

duckdb.IOException: IO Error: Extension "/root/.duckdb/extensions/550e8ef/linux_amd64_gcc4/postgres_scanner.duckdb_extension" could not be loaded: /root/.duckdb/extensions/550e8ef/linux_amd64_gcc4/postgres_scanner.duckdb_extension: undefined symbol: _ZN6duckdb28SimpleNamedParameterFunction8ToStringEv

why?
thanks!

Mause commented

Are you building with EXTENSION_STATIC_BUILD=1? This is required on linux for now

Are you building with EXTENSION_STATIC_BUILD=1? This is required on linux for now

not with it,but I confused,I compiled success in Ubuntu this morning,and error in centos7 this afternoon。

Mause commented

Compilation can succeed without the flag, but you'll need it if you want to avoid the undefined symbol error

Compilation can succeed without the flag, but you'll need it if you want to avoid the undefined symbol error
ubuntu success load extension, not with with EXTENSION_STATIC_BUILD=1, but centos with with EXTENSION_STATIC_BUILD=1 also the same error
image

but now in centos7:
image
image

Mause commented

Compilation can succeed without the flag, but you'll need it if you want to avoid the undefined symbol error
ubuntu success load extension, not with with EXTENSION_STATIC_BUILD=1, but centos with with EXTENSION_STATIC_BUILD=1 also the same error
image

but now in centos7:
image
image

Can you provide a reproduction? Ideally as a Dockerfile or similar

Can you provide a reproduction? Ideally as a Dockerfile or similar

In my centos7 server and docker both error.
my OS:docker pull centos:7.4.1708
my code:git clone -b viking https://github.com/wonb168/postgres_scanner

I try docker pull centos:7.4.1708 again, cannot find extension, but THIS IS WORK in ubuntu.

>>> import duckdb as dd
>>> dd.__version__
'0.5.2-dev1318'
>>> con = dd.connect(database=':memory:')
>>> con.execute("INSTALL postgres_scanner;")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
duckdb.IOException: IO Error: Failed to download extension "postgres_scanner" at URL "http://extensions.duckdb.org/b4f5e6e/linux_amd64_gcc4/postgres_scanner.duckdb_extension.gz"
Extension "postgres_scanner" is an existing extension.
Are you using a development build? In this case, extensions might not (yet) be uploaded.

and If I use unsigned_extensions, also undefined sybol:

>>> import duckdb as dd
>>> con = dd.connect(":memory:", config={"allow_unsigned_extensions": True})
>>> url_pgscan="/root/postgres_scanner/build/debug/extension/postgres_scanner/postgres_scanner.duckdb_extension"
>>> con.install_extension(url_pgscan, force_install=True)
>>> con.load_extension("postgres_scanner")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
duckdb.IOException: IO Error: Extension "/root/.duckdb/extensions/b4f5e6e/linux_amd64_gcc4/postgres_scanner.duckdb_extension" could not be loaded: /root/.duckdb/extensions/b4f5e6e/linux_amd64_gcc4/postgres_scanner.duckdb_extension: undefined symbol: _ZN6duckdb28SimpleNamedParameterFunction8ToStringEv
>>> 

the cli in centos is OK, scan array and json columns:
image

but in python, the extension is not WORK:
image

Mause commented

That isn't really enough information to reproduce it. Just to clarify, are you trying to load an extension you compiled yourself with a copy of the duckdb python bindings from PyPI?

That isn't really enough information to reproduce it. Just to clarify, are you trying to load an extension you compiled yourself with a copy of the duckdb python bindings from PyPI?

my OS:docker pull centos:7.4.1708
my python: 3.8.13
and compiled:

git clone -b viking https://github.com/wonb168/postgres_scanner
cd postgres_scanner

BUILD_PYTHON=1 make debug
#BUILD_PYTHON=1 EXTENSION_STATIC_BUILD=1 make debug
cd duckdb/tools/pythonpkg
python3 setup.py install

and then python:

import sys, os #must have!!!
sys.setdlopenflags(os.RTLD_GLOBAL | os.RTLD_NOW)
import duckdb as dd
print(dd.__version__)
con = dd.connect(":memory:", config={"allow_unsigned_extensions": True})
con.execute("INSTALL postgres_scanner;")
con.execute("LOAD postgres_scanner;")

sql=f"""
SELECT count(*) FROM postgres_scan('{gp_str}', 'public', 'test_arrow');
"""
con.execute(sql).fetchall()

then momory coruption. #47

The loading is clearly working here. #47 is closed because you modified the source code.