From 9e19ca318cad45e0ce585c68ce860b01f111dbf2 Mon Sep 17 00:00:00 2001 From: Stas Kelvich Date: Fri, 10 Jan 2025 00:57:03 +0200 Subject: [PATCH] [DRAFT] Build on macOS Quite dirty and would brake linux build, but shows what is missing for macOS build. --- Makefile | 8 ++++---- Makefile.build | 15 +++++++++++---- src/pgduckdb/utility/copy.cpp | 6 +++--- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 675925b..ae2cedf 100644 --- a/Makefile +++ b/Makefile @@ -46,16 +46,16 @@ duckdb: | .BUILD CMAKE_BUILD_PARALLEL_LEVEL=$(or $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))),1) \ $(MAKE) -C third_party/duckdb $(BUILD_TYPE) ifeq ($(BUILD_TYPE), debug) - gdb-add-index third_party/duckdb/build/debug/src/libduckdb.so + gdb-add-index third_party/duckdb/build/debug/src/libduckdb.dylib endif -duckdb-fast: third_party/duckdb/build/$(BUILD_TYPE)/src/libduckdb.so | .BUILD - install -C $< build/$(BUILD_TYPE)/libduckdb.so +duckdb-fast: third_party/duckdb/build/$(BUILD_TYPE)/src/libduckdb.dylib | .BUILD + install -C $< build/$(BUILD_TYPE)/libduckdb.dylib clean-duckdb: $(MAKE) -C third_party/duckdb clean -third_party/duckdb/build/$(BUILD_TYPE)/src/libduckdb.so: | .BUILD +third_party/duckdb/build/$(BUILD_TYPE)/src/libduckdb.dylib: | .BUILD @$(MAKE) duckdb # Delta diff --git a/Makefile.build b/Makefile.build index c80c12e..e8dbc04 100644 --- a/Makefile.build +++ b/Makefile.build @@ -6,7 +6,7 @@ DATA := ../../sql/pg_mooncake--0.0.1.sql SRCS_C := $(shell cd ../../src; find * -name '*.c') SRCS_CXX := $(shell cd ../../src; find * -name '*.cpp') SRCS := $(SRCS_C) $(SRCS_CXX) -OBJS := $(SRCS:%=%.o) libduckdb.so libdelta.a +OBJS := $(SRCS:%=%.o) libduckdb.dylib libdelta.a DEPS := $(SRCS:%=%.d) REGRESS_SQL := $(shell cd ../../test/sql; find * -name '*.sql') @@ -26,7 +26,14 @@ PG_CPPFLAGS := -I../../src \ -MMD -MP PG_CFLAGS := $(if $(DEBUG),-ggdb3 -O0,-O2) PG_CXXFLAGS := $(if $(DEBUG),-ggdb3 -O0,-O2) -Werror -Wno-register -Wno-sign-compare -std=c++17 -SHLIB_LINK := -L. -Wl,-rpath,$(PG_LIB) -lduckdb + + +LDFLAGS += -framework CoreFoundation -framework Security -llz4 -stdlib=libc++ -lc++ + +SHLIB_LINK := -L. -Wl,-rpath,$(PG_LIB) -lduckdb $(LDFLAGS) +CXXFLAGS := -Wno-overloaded-virtual + + override with_llvm := no include $(PGXS) @@ -35,11 +42,11 @@ include $(PGXS) $(SRCS_C:%=%.o): %.o: ../../src/% @mkdir -p $(dir $@) - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-overloaded-virtual -stdlib=libc++ -c $< -o $@ $(SRCS_CXX:%=%.o): %.o: ../../src/% @mkdir -p $(dir $@) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Wno-overloaded-virtual -stdlib=libc++ -c $< -o $@ installcheck: installcheck-dirs diff --git a/src/pgduckdb/utility/copy.cpp b/src/pgduckdb/utility/copy.cpp index 0944d32..ad3b5bf 100644 --- a/src/pgduckdb/utility/copy.cpp +++ b/src/pgduckdb/utility/copy.cpp @@ -24,9 +24,9 @@ extern "C" { #include "pgduckdb/vendor/pg_list.hpp" } -static constexpr char s3_filename_prefix[] = "s3://"; -static constexpr char gcs_filename_prefix[] = "gs://"; -static constexpr char r2_filename_prefix[] = "r2://"; +// static constexpr char s3_filename_prefix[] = "s3://"; +// static constexpr char gcs_filename_prefix[] = "gs://"; +// static constexpr char r2_filename_prefix[] = "r2://"; /* * Returns the relation of the copy_stmt as a fully qualified DuckDB table reference. This is done