-
Notifications
You must be signed in to change notification settings - Fork 174
Add ability to link libduckdb statically #618
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,13 +27,27 @@ DUCKDB_BUILD_TYPE= | |
| ifeq ($(DUCKDB_BUILD), Debug) | ||
| DUCKDB_BUILD_CXX_FLAGS = -g -O0 -D_GLIBCXX_ASSERTIONS | ||
| DUCKDB_BUILD_TYPE = debug | ||
| DUCKDB_MAKE_TARGET = debug | ||
| else ifeq ($(DUCKDB_BUILD), Static) | ||
| DUCKDB_BUILD_CXX_FLAGS = | ||
| DUCKDB_BUILD_TYPE = release | ||
| DUCKDB_MAKE_TARGET = bundle-library | ||
|
||
| else | ||
| DUCKDB_BUILD_CXX_FLAGS = | ||
| DUCKDB_BUILD_TYPE = release | ||
| DUCKDB_MAKE_TARGET = release | ||
| endif | ||
|
|
||
| DUCKDB_LIB = libduckdb$(DLSUFFIX) | ||
| FULL_DUCKDB_LIB = third_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src/$(DUCKDB_LIB) | ||
| PG_DUCKDB_LINK_FLAGS = -Wl,-rpath,$(PG_LIB)/ -lpq -Lthird_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src -L$(PG_LIB) -lstdc++ -llz4 | ||
| DUCKDB_BUILD_DIR = third_party/duckdb/build/$(DUCKDB_BUILD_TYPE) | ||
|
|
||
| ifeq ($(DUCKDB_BUILD), Static) | ||
| PG_DUCKDB_LINK_FLAGS += third_party/duckdb/build/release/libduckdb_bundle.a | ||
| FULL_DUCKDB_LIB = $(DUCKDB_BUILD_DIR)/$(DUCKDB_LIB) | ||
| else | ||
| PG_DUCKDB_LINK_FLAGS += -lduckdb | ||
| FULL_DUCKDB_LIB = $(DUCKDB_BUILD_DIR)/src/$(DUCKDB_LIB)/libduckdb$(DLSUFFIX) | ||
| endif | ||
|
|
||
| ERROR_ON_WARNING ?= | ||
| ifeq ($(ERROR_ON_WARNING), 1) | ||
|
|
@@ -54,7 +68,7 @@ override PG_CXXFLAGS += -std=c++17 ${DUCKDB_BUILD_CXX_FLAGS} ${COMPILER_FLAGS} - | |
| # changes to the vendored code in one place. | ||
| override PG_CFLAGS += -Wno-declaration-after-statement | ||
|
|
||
| SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -lpq -Lthird_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src -L$(PG_LIB) -lduckdb -lstdc++ -llz4 | ||
| SHLIB_LINK += $(PG_DUCKDB_LINK_FLAGS) | ||
|
|
||
| include Makefile.global | ||
|
|
||
|
|
@@ -102,10 +116,14 @@ $(FULL_DUCKDB_LIB): .git/modules/third_party/duckdb/HEAD | |
| DISABLE_ASSERTIONS=$(DUCKDB_DISABLE_ASSERTIONS) \ | ||
| EXTENSION_CONFIGS="../pg_duckdb_extensions.cmake" \ | ||
| $(MAKE) -C third_party/duckdb \ | ||
| $(DUCKDB_BUILD_TYPE) | ||
| $(DUCKDB_MAKE_TARGET) | ||
|
|
||
| ifeq ($(DUCKDB_BUILD), Static) | ||
| install-duckdb: $(FULL_DUCKDB_LIB) $(shlib) | ||
| else | ||
| install-duckdb: $(FULL_DUCKDB_LIB) $(shlib) | ||
| $(install_bin) -m 755 $(FULL_DUCKDB_LIB) $(DESTDIR)$(PG_LIB) | ||
| endif | ||
|
|
||
| clean-duckdb: | ||
| rm -rf third_party/duckdb/build | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems error-prone to only build one version that way no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too worried about the static library build of DuckDB working for one PG version, but not for another. I mainly added this CI coverage to make sure we don't accidentally break the static build logic in our makefile completely. So I think running it for just one version is fine. I'll add a code comment explaining that though.