Skip to content

Commit

Permalink
mac: fix explicit symbol exports
Browse files Browse the repository at this point in the history
Exception information necessary for properly catching exceptions, seems
to not be exported on Mac unless we export the exception, which seems to
be different from Linux & Windows.

In additional, Mac issues a warning when building the Python module
(which itself builds as a shared library). The issue is that the python
module links with our static library, and the static library does not
export symbols (since it doesn't do anything for static libraries).

However, this mismatch in visibility causes a warning. Technically, we
shouldn't build a shared library with a static library since the static
library isn't position-independent code, but we don't really have other
options unless we embed all of the object files?

We should probably link the python library against `libkuzu.so` and ship
it alongside the python bindings. However, this will be delayed until
after the release.

Ref #2136.
  • Loading branch information
Riolku committed Nov 13, 2023
1 parent 5408d83 commit 0782f86
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ jobs:
run: |
ulimit -n 10240
source /Users/runner/.cargo/env
cargo update -p cc --precise '1.0.83'
make rusttest
- name: Rust example
Expand Down
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT APPLE)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
endif()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

option(ENABLE_WERROR "Treat all warnings as errors" FALSE)
if(ENABLE_WERROR)
Expand Down Expand Up @@ -166,18 +164,10 @@ endfunction()
function(add_kuzu_api_test TEST_NAME)
set(SRCS ${ARGN})
add_executable(${TEST_NAME} ${SRCS})
if(APPLE)
target_link_libraries(${TEST_NAME} PRIVATE test_helper test_runner graph_test)
else()
target_link_libraries(${TEST_NAME} PRIVATE api_graph_test api_test_helper)
endif()
target_link_libraries(${TEST_NAME} PRIVATE api_graph_test api_test_helper)
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/test/include)
include(GoogleTest)
if(APPLE)
gtest_discover_tests(${TEST_NAME} DISCOVERY_TIMEOUT 600 DISCOVERY_MODE PRE_TEST)
else()
gtest_discover_tests(${TEST_NAME})
endif()
gtest_discover_tests(${TEST_NAME})
endfunction()

add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/binder.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class BinderException : public Exception {
class KUZU_API BinderException : public Exception {
public:
explicit BinderException(const std::string& msg) : Exception("Binder exception: " + msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/buffer_manager.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class BufferManagerException : public Exception {
class KUZU_API BufferManagerException : public Exception {
public:
explicit BufferManagerException(const std::string& msg)
: Exception("Buffer manager exception: " + msg){};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/catalog.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class CatalogException : public Exception {
class KUZU_API CatalogException : public Exception {
public:
explicit CatalogException(const std::string& msg) : Exception("Catalog exception: " + msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/connection.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class ConnectionException : public Exception {
class KUZU_API ConnectionException : public Exception {
public:
explicit ConnectionException(const std::string& msg) : Exception(msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/conversion.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class ConversionException : public Exception {
class KUZU_API ConversionException : public Exception {
public:
explicit ConversionException(const std::string& msg)
: Exception("Conversion exception: " + msg) {}
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/copy.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class CopyException : public Exception {
class KUZU_API CopyException : public Exception {
public:
explicit CopyException(const std::string& msg) : Exception("Copy exception: " + msg){};
};
Expand Down
4 changes: 3 additions & 1 deletion src/include/common/exception/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#include <exception>
#include <string>

#include "common/api.h"

namespace kuzu {
namespace common {

class Exception : public std::exception {
class KUZU_API Exception : public std::exception {
public:
explicit Exception(std::string msg) : exception(), exception_message_(std::move(msg)){};

Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/internal.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class InternalException : public Exception {
class KUZU_API InternalException : public Exception {
public:
explicit InternalException(const std::string& msg) : Exception(msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/interrupt.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class InterruptException : public Exception {
class KUZU_API InterruptException : public Exception {
public:
explicit InterruptException() : Exception("Interrupted."){};
};
Expand Down
1 change: 1 addition & 0 deletions src/include/common/exception/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace kuzu {
namespace common {

struct ExceptionMessage {
static std::string existedPKException(const std::string& pkString);
static std::string nonExistPKException(const std::string& pkString);
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/not_implemented.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class NotImplementedException : public Exception {
class KUZU_API NotImplementedException : public Exception {
public:
explicit NotImplementedException(const std::string& msg) : Exception(msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/overflow.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class OverflowException : public Exception {
class KUZU_API OverflowException : public Exception {
public:
explicit OverflowException(const std::string& msg) : Exception("Overflow exception: " + msg) {}
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/parser.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class ParserException : public Exception {
class KUZU_API ParserException : public Exception {
public:
explicit ParserException(const std::string& msg) : Exception("Parser exception: " + msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/runtime.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class RuntimeException : public Exception {
class KUZU_API RuntimeException : public Exception {
public:
explicit RuntimeException(const std::string& msg) : Exception("Runtime exception: " + msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/storage.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class StorageException : public Exception {
class KUZU_API StorageException : public Exception {
public:
explicit StorageException(const std::string& msg) : Exception("Storage exception: " + msg){};
};
Expand Down
3 changes: 2 additions & 1 deletion src/include/common/exception/transaction_manager.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "common/api.h"
#include "exception.h"

namespace kuzu {
namespace common {

class TransactionManagerException : public Exception {
class KUZU_API TransactionManagerException : public Exception {
public:
explicit TransactionManagerException(const std::string& msg) : Exception(msg){};
};
Expand Down

0 comments on commit 0782f86

Please sign in to comment.