Skip to content

Commit

Permalink
Merge pull request #376 from jmao-denver/375-arrow-support-missing
Browse files Browse the repository at this point in the history
Fix g++ ABI compatibility issue with pyarrow 3.9/3.10 on Linux
  • Loading branch information
xhochy authored Feb 21, 2023
2 parents 947fac1 + ca025f4 commit 0d54577
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Version history / changelog

From version 2.0.0, turbodbc adapts semantic versioning.

Version 4.5.9
-------------

* Check for ``_GLIBCXX_USE_CXX11_ABI`` setting of ``pyarrow``.

Version 4.5.8
-------------

Expand Down
26 changes: 25 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import distutils.ccompiler
import distutils.sysconfig
import itertools
import os
Expand Down Expand Up @@ -124,6 +125,27 @@ def __str__(self):
odbclib = "odbc"


def _get_cxx_compiler():
cc = distutils.ccompiler.new_compiler()
distutils.sysconfig.customize_compiler(cc)
return cc.compiler_cxx[0] # type: ignore


def is_cxx11_abi():
import pathlib

import pyarrow.lib

binary_so = pathlib.Path(pyarrow.lib.__file__).read_bytes()

# Check for an old CXXABI symbol in the main library. This one is quite stable across all Arrow releases.
# arrow::Status::ToString() -> std::string
if b"_ZNK5arrow6Status8ToStringEv" in binary_so:
return False
# Here we can add other symbols to check for if future releases would come with a different API.
return True


def get_extension_modules():
extension_modules = []

Expand Down Expand Up @@ -205,6 +227,8 @@ def get_extension_modules():
pyarrow_module_link_args.append("-Wl,-rpath,@loader_path/pyarrow")
else:
pyarrow_module_link_args.append("-Wl,-rpath,$ORIGIN/pyarrow")
if not is_cxx11_abi():
extra_compile_args.append("-D_GLIBCXX_USE_CXX11_ABI=0")

arrow_libs = pyarrow.get_libraries()

Expand All @@ -230,7 +254,7 @@ def get_extension_modules():

setup(
name="turbodbc",
version="4.5.8",
version="4.5.9",
description="turbodbc is a Python DB API 2.0 compatible ODBC driver",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0d54577

Please sign in to comment.