marcboeker / go-duckdb

go-duckdb provides a database/sql driver for the DuckDB database engine.
MIT License
583 stars 96 forks source link

Does `go-duckdb` has a glibc version dependency? #207

Open pskrbasu opened 2 months ago

pskrbasu commented 2 months ago

I have a simple cgo code(https://github.com/pskrbasu/cgo-cross-compilation) that fails to build and run on Amazon Linux 2(glibc 2.26).

When trying to run the binary built using goreleaser I get this error(which seems like a runtime error):

./cgo: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by ./cgo)
./cgo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./cgo)

When trying to build the binary in the Amazon Linux 2 server I get this ld error:

See full logs make go build -o ./cgo . go: downloading github.com/marcboeker/go-duckdb v1.6.3 go: downloading github.com/apache/arrow/go/v14 v14.0.2 go: downloading github.com/mitchellh/mapstructure v1.5.0 go: downloading golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 go: downloading golang.org/x/sys v0.13.0 go: downloading github.com/goccy/go-json v0.10.2 go: downloading github.com/zeebo/xxh3 v1.0.2 go: downloading github.com/google/flatbuffers v23.5.26+incompatible go: downloading github.com/klauspost/compress v1.16.7 go: downloading github.com/pierrec/lz4/v4 v4.1.18 go: downloading github.com/klauspost/cpuid/v2 v2.2.5 cgo-cross-compilation /home/ec2-user/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.21.8.linux-amd64/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(ub_duckdb_catalog.cpp.o): In function `duckdb::Catalog::CreateMissingEntryException(duckdb::ClientContext&, std::__cxx11::basic_string, std::allocator > const&, duckdb::CatalogType, std::unordered_set, duckdb::ReferenceHashFunction, duckdb::ReferenceEquality, std::allocator > > const&, duckdb::QueryErrorContext)': ub_duckdb_catalog.cpp:(.text+0x11997): undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)' ub_duckdb_catalog.cpp:(.text+0x1227b): undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(ub_duckdb_catalog_entries.cpp.o): In function `duckdb::TableCatalogEntry::ColumnsToSQL[abi:cxx11](duckdb::ColumnList const&, duckdb::vector, true>, true> const&)': ub_duckdb_catalog_entries.cpp:(.text+0xbd5e): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(ub_duckdb_func_table.cpp.o): In function `duckdb::CSVSniffFunction(duckdb::ClientContext&, duckdb::TableFunctionInput&, duckdb::DataChunk&)': ub_duckdb_func_table.cpp:(.text+0xf17f): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' ub_duckdb_func_table.cpp:(.text+0xf53e): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(ub_duckdb_main.cpp.o): In function `duckdb::QueryProfiler::ToJSON[abi:cxx11]() const': ub_duckdb_main.cpp:(.text+0x26d78): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(ub_duckdb_operator_persistent.cpp.o): In function `duckdb::PhysicalExport::GetData(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::OperatorSourceInput&) const': ub_duckdb_operator_persistent.cpp:(.text+0xab4a): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' ub_duckdb_operator_persistent.cpp:(.text+0xac72): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(parquet_metadata.cpp.o): In function `duckdb::ParquetLogicalTypeToString(duckdb_parquet::format::LogicalType const&, bool)': parquet_metadata.cpp:(.text+0x14b8): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' parquet_metadata.cpp:(.text+0x1505): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(parquet_metadata.cpp.o):parquet_metadata.cpp:(.text+0x15b5): more undefined references to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' follow /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(parquet_types.cpp.o): In function `duckdb_parquet::format::LogicalType::printTo(std::ostream&) const': parquet_types.cpp:(.text+0x10e16): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' parquet_types.cpp:(.text+0x10f38): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' parquet_types.cpp:(.text+0x1105a): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' parquet_types.cpp:(.text+0x1117c): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' parquet_types.cpp:(.text+0x1129e): undefined reference to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(parquet_types.cpp.o):parquet_types.cpp:(.text+0x113c0): more undefined references to `std::__cxx11::basic_ostringstream, std::allocator >::basic_ostringstream()' follow /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(column_reader.cpp.o): In function `duckdb::ColumnReader::DecompressInternal(duckdb_parquet::format::CompressionCodec::type, unsigned char const*, unsigned long, unsigned char*, unsigned long)': column_reader.cpp:(.text+0xe1c): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(column_reader.cpp.o): In function `void duckdb::BssDecoder::GetBatch(unsigned char*, unsigned int)': column_reader.cpp:(.text._ZN6duckdb10BssDecoder8GetBatchIfEEvPhj[_ZN6duckdb10BssDecoder8GetBatchIfEEvPhj]+0x4d): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' /home/ec2-user/go/pkg/mod/github.com/marcboeker/go-duckdb@v1.6.3/deps/linux_amd64/libduckdb.a(column_reader.cpp.o): In function `void duckdb::BssDecoder::GetBatch(unsigned char*, unsigned int)': column_reader.cpp:(.text._ZN6duckdb10BssDecoder8GetBatchIdEEvPhj[_ZN6duckdb10BssDecoder8GetBatchIdEEvPhj]+0x4d): undefined reference to `std::__cxx11::basic_stringstream, std::allocator >::basic_stringstream()' collect2: error: ld returned 1 exit status make: *** [build] Error 1

However when I remove the github.com/marcboeker/go-duckdb v1.6.3 dependency and build it. It works fine.

Does this mean that go-duckdb has packages that cannot run/build on versions < 2.29 ?

libe commented 1 month ago

Same problem