#67379 closed defect (fixed)
mssql-tools @17.10.2.1_1: Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found.
Reported by: | posguy99 (Marc Wilson) | Owned by: | roederja |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.8.1 |
Keywords: | Cc: | ryandesign (Ryan Carsten Schmidt) | |
Port: | mssql-tools |
Description
mssql-tools and msodbcsql17 both install without error. However, sqlcmd does nto launch, it tries to use a dylib from Homebrew.
$ sudo port install mssql-tools ---> Computing dependencies for mssql-tools ---> Cleaning mssql-tools ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found. [ 8:01 AM][ttys000 +1][~] [929] mbp13 $ port info mssql-tools mssql-tools @17.10.1.1_1 (databases) Description: Sqlcmd and Bcp for Microsoft(R) SQL Server(R) Homepage: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility Runtime Dependencies: msodbcsql17 Platforms: darwin License: Restrictive Maintainers: Email: jann@macports.org, GitHub: roederja Policy: openmaintainer $ sudo port install msodbcsql17 ---> Computing dependencies for msodbcsql17 ---> Cleaning msodbcsql17 ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found. $ sqlcmd Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found. $ locate libmsodbcsql.17.dylib /opt/local/lib/libmsodbcsql.17.dylib
Change History (10)
comment:3 Changed 17 months ago by jmroot (Joshua Root)
Owner: | set to roederja |
---|---|
Status: | new → assigned |
comment:4 Changed 17 months ago by posguy99 (Marc Wilson)
I had previously opened #67204 because the port would not install. Now it installs but it doesn't work. I don't know what changed between then and now.
comment:5 Changed 17 months ago by kencu (Ken)
This port currently installs a prebuilt binary, apparently hardcoded to look for homebrew's driver.
You can hack it to work by doing this:
cd /opt sudo mkdir homebrew cd homebrew sudo mkdir lib cd lib sudo ln -s /opt/local/lib/libmsodbcsql.17.dylib libmsodbcsql.17.dylib
and then it works.
For a proper fix, we will have to update this port to use the new source version available at this URL (still in prerelease): https://github.com/microsoft/go-sqlcmd
comment:6 Changed 17 months ago by kencu (Ken)
sometimes you might have made it work by doing this:
DYLD_LIBRARY_PATH=/opt/local/lib sqlcmd
but that will not work as this binary is linked against the system's libiconv, and so it runs afoul of MacPorts libiconv.
comment:7 Changed 17 months ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:8 Changed 17 months ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign added |
---|---|
Summary: | sqlcmd from mssql-tools trying to use file from Homebrew → mssql-tools @17.10.2.1_1: Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found. |
This warning when installing the port from source on Apple Silicon (well, on Intel but with os.arch=arm
on the command line) gave me the clue about why it didn't work:
Warning: reinplace s|/usr/local|/opt/local|g didn't change anything in /opt/local/var/macports/build/_Volumes_Shared_macports-ports_databases_msodbcsql17/msodbcsql17/work/msodbcsql-17.10.2.1/odbcinst.ini
comment:9 Changed 17 months ago by kencu (Ken)
well, I might learn something here! Here was how the ports were installed for me:
% otool -L /opt/local/bin/sqlcmd /opt/local/bin/sqlcmd: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /opt/local/lib/libodbc.2.dylib (compatibility version 3.0.0, current version 3.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0) % otool -L /opt/local/lib/libmsodbcsql.17.dylib /opt/local/lib/libmsodbcsql.17.dylib: /opt/local/lib/libmsodbcsql.17.dylib (compatibility version 0.0.1, current version 10.2.1) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1) /opt/local/lib/libodbcinst.2.dylib (compatibility version 3.0.0, current version 3.0.0) /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0) % sqlcmd Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/opt/homebrew/lib/libmsodbcsql.17.dylib' : file not found.
because sqlcmd had no embedded library reference to libmsodbcsql.17.dylib, I thought it was dlopened internally, hardcoded.
Let me try it with your changes!
comment:10 Changed 17 months ago by kencu (Ken)
Oh, I see now what you found -- I missed this completely:
% cat /opt/local/share/msodbcsql17/resources/odbcinst.ini [ODBC Driver 17 for SQL Server] Description=Microsoft ODBC Driver 17 for SQL Server Driver=/opt/homebrew/lib/libmsodbcsql.17.dylib
good pickup!