Skip to content

Commit

Permalink
build working in linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Rostislav Provodenko authored and Dan Forsberg committed Sep 1, 2021
1 parent 603c861 commit 2d33df2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ file(GLOB DUCKDBIN
"./duckdb/build/release/src/libduckdb.dylib"
"./duckdb/build/release/src/libduckdb.so"
"./duckdb/build/release/extension/parquet/libparquet_extension.a"
"./duckdb/build/release/extension/httpfs/libhttpfs_extension.a"
)
file(COPY ${DUCKDBIN} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release)
include_directories(${CMAKE_JS_INC} ./duckdb/src/include ./duckdb/extension/parquet/include)
include_directories(${CMAKE_JS_INC} ./duckdb/src/include ./duckdb/extension/parquet/include ./duckdb/extension/httpfs/include)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/Release)
file(GLOB SOURCE_FILES "./addon/*")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} duckdb parquet_extension)
set(OPENSSL_CRYPTO_LIBRARY "/usr/lib64/libcrypto.so")
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)

target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} duckdb parquet_extension httpfs_extension OpenSSL::Crypto "/usr/lib64/libssl.so")
if(APPLE)
message("Building for MacOS")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,@loader_path/.")
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM 059037012730.dkr.ecr.us-east-1.amazonaws.com/deepcrawl/odin-api:latest
WORKDIR /app
RUN yum -y install openssl-devel
2 changes: 2 additions & 0 deletions addon/duckdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "parquet-extension.hpp"
#include "result_iterator.h"
#include "type-converters.h"
#include "httpfs-extension.hpp"
#include <iostream>
using namespace std;

Expand Down Expand Up @@ -63,6 +64,7 @@ DuckDB::DuckDB(const Napi::CallbackInfo &info)
try {
database = duckdb::make_unique<duckdb::DuckDB>(path, &nativeConfig);
database->LoadExtension<duckdb::ParquetExtension>();
database->LoadExtension<duckdb::HTTPFsExtension>();
} catch (duckdb::IOException e) {
throw Napi::Error::New(env, e.what());
} catch (std::exception e) {
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
version: "3"
services:
linux-build:
build:
context: .
dockerfile: Dockerfile
container_name: linux-build
working_dir: /root/node-duckdb
tty: true
stdin_open: true
image: 059037012730.dkr.ecr.us-east-1.amazonaws.com/deepcrawl/odin-api:latest
environment:
YARN_CACHE_FOLDER: /yarn_cache
GITHUB_TOKEN: $GITHUB_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"audit:fix": "yarn-audit-fix",
"build": "yarn build:duckdb && yarn build:addon && yarn build:ts",
"build:addon": "rimraf build && cmake-js compile --CDnapi_build_version=6",
"build:duckdb": "cd duckdb && make && cd -",
"build:duckdb": "cd duckdb && make BUILD_HTTPFS=1 && cd -",
"build:test:watch": "nodemon --exec 'yarn build && yarn jest --testTimeout=60000'",
"build:ts": "rimraf dist && ttsc",
"clang:check": "yarn clang-format --dry-run --Werror addon/**",
Expand Down

0 comments on commit 2d33df2

Please sign in to comment.