Skip to content

Commit

Permalink
Fix: Linking to SimSIMD symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Oct 10, 2024
1 parent d87a65d commit 0fc72a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
# * for PyPy versions from 3.7 to 3.10.
# = meaning 7 platforms * 10 Python versions = 70 builds.
[build-system]
requires = ["setuptools>=42", "wheel", "cmake>=3.22", "pybind11", "numpy"]
requires = [
"setuptools>=42",
"wheel",
"cmake>=3.22",
"pybind11",
"numpy",
"simsimd>=5.6.4",
]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_bool_env_w_name(name: str, preference: bool) -> tuple:
prefer_fp16lib: bool = True
prefer_openmp: bool = is_linux and is_gcc

use_simsimd: bool = True # get_bool_env("USEARCH_USE_SIMSIMD", prefer_simsimd)
use_simsimd: bool = get_bool_env("USEARCH_USE_SIMSIMD", prefer_simsimd)
use_fp16lib: bool = get_bool_env("USEARCH_USE_FP16LIB", prefer_fp16lib)
use_openmp: bool = get_bool_env("USEARCH_USE_OPENMP", prefer_openmp)

Expand Down Expand Up @@ -89,6 +89,10 @@ def get_bool_env_w_name(name: str, preference: bool) -> tuple:
# Simplify debugging, but the normal `-g` may make builds much longer!
compile_args.append("-g1")

# Linking to SimSIMD
compile_args.append("-Wl,--unresolved-symbols=ignore-in-shared-libs")
link_args.append("-static-libstdc++")

if use_openmp:
compile_args.append("-fopenmp")
link_args.append("-lgomp")
Expand Down Expand Up @@ -122,6 +126,8 @@ def get_bool_env_w_name(name: str, preference: bool) -> tuple:
compile_args.append("/O2")
compile_args.append("/fp:fast") # Enable fast math for MSVC
compile_args.append("/W1") # Reduce warnings verbosity
link_args.append("/FORCE") # Force linkin with missing SimSIMD symbols


ext_modules = [
Pybind11Extension(
Expand Down
2 changes: 1 addition & 1 deletion simsimd

0 comments on commit 0fc72a2

Please sign in to comment.