Skip to content

Commit

Permalink
Change DuckDB to static linking (#3370)
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim committed Apr 24, 2024
1 parent 106e276 commit c1ccf75
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/build-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,12 @@ jobs:
run: docker stop kuzu-x86

build-mac-extensions-arm64:
runs-on: macos-14
runs-on: self-hosted-mac-arm
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
brew install duckdb openssl@3
- name: Build precompiled extensions
run: make extension-release LTO=1 NUM_THREADS=$(nproc)
run: env OPENSSL_ROOT_DIR=/opt/homebrew/Cellar/openssl@3/3.3.0 make extension-release LTO=1 NUM_THREADS=$(sysctl -n hw.logicalcpu)
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
CMAKE_OSX_ARCHITECTURES: "arm64"
Expand All @@ -133,7 +129,7 @@ jobs:
- uses: actions/checkout@v3

- name: Build precompiled extensions
run: make extension-release LTO=1 NUM_THREADS=$(nproc)
run: make extension-release LTO=1 NUM_THREADS=$(sysctl -n hw.logicalcpu)
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
CMAKE_OSX_ARCHITECTURES: "x86_64"
Expand Down
10 changes: 10 additions & 0 deletions extension/duckdb_scanner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Address sanitizer may change the ABI, so we use dynamic linking
# if it's enabled.
if(${ENABLE_ADDRESS_SANITIZER})
set(DuckDB_USE_STATIC_LIBS OFF)
else()
set(DuckDB_USE_STATIC_LIBS ON)
endif()
find_package(DuckDB REQUIRED)
if(NOT WIN32)
find_library(DuckDB_STATIC REQUIRED NAMES libduckdb_static.a)
endif()

include_directories(
${PROJECT_SOURCE_DIR}/src/include
Expand Down
8 changes: 7 additions & 1 deletion extension/httpfs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
SET(OPENSSL_USE_STATIC_LIBS TRUE)
# Address sanitizer may change the ABI, so we use dynamic linking
# if it's enabled.
if(${ENABLE_ADDRESS_SANITIZER})
SET(OPENSSL_USE_STATIC_LIBS FALSE)
else()
SET(OPENSSL_USE_STATIC_LIBS TRUE)
endif()

find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
Expand Down
10 changes: 10 additions & 0 deletions extension/postgres_scanner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Address sanitizer may change the ABI, so we use dynamic linking
# if it's enabled.
if(${ENABLE_ADDRESS_SANITIZER})
set(DuckDB_USE_STATIC_LIBS OFF)
else()
set(DuckDB_USE_STATIC_LIBS ON)
endif()
find_package(DuckDB REQUIRED)
if(NOT WIN32)
find_library(DuckDB_STATIC REQUIRED NAMES libduckdb_static.a)
endif()

add_library(postgres_scanner
SHARED
Expand Down

0 comments on commit c1ccf75

Please sign in to comment.