FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: configure bundled macOS ODBC dylibs for all arches, not just build host by bewithgaurav · Pull Request #661 · microsoft/mssql-python · GitHub

FIX: configure bundled macOS ODBC dylibs for all arches, not just build host - #661

Merged
Gaurav Sharma (bewithgaurav) merged 4 commits into
mainfrom
bewithgaurav/fix-656-macos-dylib-arch
Jul 9, 2026
Merged

FIX: configure bundled macOS ODBC dylibs for all arches, not just build host#661
Gaurav Sharma (bewithgaurav) merged 4 commits into
mainfrom
bewithgaurav/fix-656-macos-dylib-arch

Conversation

Gaurav Sharma (bewithgaurav) commented Jul 3, 2026
edited by azure-boards Bot
Loading

Copy link
Copy Markdown
Collaborator

Work Item / Issue Reference

ADO: AB#46197

GitHub Issue: #656


Summary

on Apple Silicon the bundled ODBC driver in the macOS wheel points at an absolute Homebrew path (/opt/homebrew/lib/libodbcinst.2.dylib) instead of the copy shipped inside the package. on a clean machine that path is absent, so import mssql_python fails until brew install unixodbc creates it (#656).

root cause: configure_dylibs.sh rewrites the bundled dylib dependencies to @loader_path only for $(uname -m). the wheel is universal2 and ships both libs/macos/arm64 and libs/macos/x86_64, but the release runner is x86_64, so only the x86_64 driver got fixed. the arm64 driver shipped with its raw Homebrew path from the driver upgrade in #569. regressed in 1.8.0; 1.7.1 and earlier are clean.

fix:

  • loop configure_dylibs.sh over both arm64 and x86_64 under libs/macos, not just the build host arch. install_name_tool and codesign both work cross-arch, so one host fixes every bundled arch.
  • re-fix the committed arm64 + x86_64 dylibs to @loader_path.

verified both arches resolve libodbcinst/libltdl via @loader_path with no absolute paths remaining, and the fixed arm64 driver dlopens against its bundled siblings (and fails when isolated, so there is no system fallback).

…ld host

configure_dylibs.sh rewrote libodbcinst/libltdl references to @loader_path only
for $(uname -m). the universal2 wheel bundles both libs/macos/arm64 and
libs/macos/x86_64, so on the x86_64 release runner only x86_64 got fixed and the
arm64 libmsodbcsql.18.dylib shipped pointing at
/opt/homebrew/lib/libodbcinst.2.dylib. on a clean Apple Silicon mac that path is
absent, so the driver only loads after `brew install unixodbc` (issue #656).

this regressed in 1.8.0 (first release after the driver upgrade). 1.7.1 and
earlier are clean.

- loop configuration over both arm64 and x86_64 under libs/macos
- re-fix the committed arm64 + x86_64 dylibs to @loader_path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-actions Bot added the pr-size: small Minimal code update label Jul 3, 2026

github-actions Bot commented Jul 3, 2026
edited
Loading

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

80%


📈 Total Lines Covered: 6738 out of 8326
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.connection.connection.cpp: 76.2%
mssql_python.pybind.ddbc_bindings.cpp: 76.2%
mssql_python.__init__.py: 77.3%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.logging.py: 85.5%
mssql_python.connection.py: 85.6%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

the arm64 libodbcinst.2.dylib and libltdl.7.dylib were already @loader_path
(committed that way in #82), so the fix commit left them untouched. re-sign and
commit them too so all six bundled macOS dylibs are the canonical output of a
single configure_dylibs.sh run rather than a mix of #82-era and new signatures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gaurav Sharma (bewithgaurav) marked this pull request as ready for review July 6, 2026 08:47
Copilot AI review requested due to automatic review settings July 6, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Fixes a macOS wheel packaging regression where the universal2 wheel’s non-host architecture dylibs were not rewritten to use @loader_path, causing import mssql_python to fail on clean Apple Silicon machines without Homebrew unixodbc (issue #656).

Changes:

  • Update configure_dylibs.sh to process both arm64 and x86_64 bundled dylib directories instead of only the build host architecture.
  • Skip configuration for an architecture when its libs/macos/<arch>/lib directory is not present.
  • Improve completion logging to be architecture-specific.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

the "Initial configuration" otool block ran before the directory and file
existence checks, so a missing arch directory would hit otool (which errors, and
under set -e aborts the script) before reaching the graceful `continue`. move the
checks above the otool calls: a missing arch dir now skips cleanly, and
libmsodbcsql/libodbcinst are verified present before they are inspected (libltdl
is already -f guarded).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gaurav Sharma (bewithgaurav) merged commit aa97146 into main Jul 9, 2026
26 checks passed
gargsaumya mentioned this pull request Jul 10, 2026
Gaurav Sharma (bewithgaurav) pushed a commit that referenced this pull request Jul 10, 2026
Release mssql-python v1.11.0.


[AB#46332](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/46332)

### Summary

Version bump to 1.11.0. Updates `mssql_python/__init__.py`, `setup.py`,
and `PyPI_Description.md`. Bundled `mssql_py_core` bumped from 0.1.5 to
0.1.6.

#### Bug Fixes

- **SSH-tunnel / in-process forwarder deadlock** — Release the GIL
around blocking ODBC round-trips in the teardown path and
`SQLDescribeParam`, so `close()` and parametrized queries with `None`
values no longer deadlock in-process TCP forwarder setups (#604, issue
#565).
- **BINARY/VARBINARY NULL parameters in temp tables and table
variables** — Proactively resolve unknown NULL parameter types before
binding and emit actionable `setinputsizes()` guidance on `SQL_VARCHAR`
fallback (#654, issue #627).
- **Context manager transaction semantics** — `Connection.__exit__` now
commits on clean exit and rolls back on exception when
`autocommit=False`, instead of always rolling back (#639, issue #635).
- **macOS Apple Silicon import failure** — `configure_dylibs.sh`
rewrites bundled ODBC dylib dependencies to `@loader_path` for every
architecture in the universal2 wheel, fixing `import mssql_python` on
clean Apple Silicon machines (#661, issue #656).
- **Service Principal bulk copy freeze** — Fixed a GIL-deadlock in the
Rust core that froze bulk copy under `ActiveDirectoryServicePrincipal`
auth; picked up via the `mssql_py_core` 0.1.6 bump (#666, issue #662).

#### Version Bump

- `mssql_python/__init__.py`: `__version__ = "1.11.0"`
- `setup.py`: `version="1.11.0"`
- `PyPI_Description.md`: `## What's new in v1.11.0` section refreshed.
Gaurav Sharma (bewithgaurav) added a commit that referenced this pull request Jul 14, 2026
Pick up 1.11.0 release, context-manager transaction (#639), bulkcopy timeout (#650), py-core 0.1.6, and macOS dylib config (#661). No profiler conflicts; auto-merge clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL