XBSleepy
XBSleepy

Reputation: 31

Why building duckdb from source doesn't contain specific symbols which is in the official release duckdb.so

I am trying to use duckdb fdw in my project, which need a duckdb. I builded duckdb from source and successfully build and installed duckdb fdw.

My environment is a ubuntu 22.04 image in docker with amd CPU. I build duckdb followed official documents with ninja

When I try to load it in the PostgreSQL, the error occurs:

postgres=# create extension duckdb_fdw;
ERROR:  could not load library "/home/gpadmin/pgbuild/lib/postgresql/duckdb_fdw.so": /home/gpadmin/pgbuild/lib/postgresql/duckdb_fdw.so: undefined symbol: _ZN6duckdb9ErrorDataC1ERKSs

by using nm,there are a lot of _ZN6duckdb9ErrorDataC1ER*:

0000000001677b30 T _ZN6duckdb9ErrorDataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
00000000009b6090 W _ZN6duckdb9ErrorDataC1ERKS0_
0000000001677fe0 T _ZN6duckdb9ErrorDataC1ERKSt9exception

but it didn`t have what I need. I think it`s because I didn`t get a correct duckdb version first. So I tried v1.1.3, v1.0.0 and v1.2.0, all the versions don't have this symbol.

I also tried clang 10.0.0 and g++11.4.0 but in vain. Then I tried to download DuckDB.so from official website, and it contained this symbol.

My development machine is unable to connect to the internet and I must compile everything from source. I don't know how to solve this.

Upvotes: 1

Views: 54

Answers (1)

XBSleepy
XBSleepy

Reputation: 31

Thanks to @Botje ! This problem is probably caused by -D_GLIBCXX_USE_CXX11_ABI=0.

In the Makefile of DuckDB_fdw, it added -D_GLIBCXX_USE_CXX11_ABI=0, when I building duckdb from source, this flag was not setted.

ifeq ($(detected_OS),Linux)
    # DLSUFFIX = .so
    PG_CXXFLAGS = -std=c++11
    detected_arch := $(shell uname -m)
    ifeq ($(detected_arch),x86_64)
        PG_CXXFLAGS = -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0
    endif
endif

Now I can CREATE the extension by either add definitions -D_GLIBCXX_USE_CXX11_ABI=0 in the duckdb's CMakeLists.txt or change D_GLIBCXX_USE_CXX11_ABI=0 to 1 in duckdb_fdw's Makefile .

I don't know why duckdb_fdw needs an order ABI yet. Due to the two part will interact with Postgres, I'm not sure which one is better, I will test it later.

Upvotes: 2

Related Questions