Opened 4 years ago

Closed 3 years ago

Last modified 2 years ago

#60560 closed defect (fixed)

mssql-tools seems to be missing OpenSSL

Reported by: ShaharHD (Shahar Hadas) Owned by: roederja
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: haspatch Cc: ShaharHD (Shahar Hadas), jmroot (Joshua Root), ryandesign (Ryan Carsten Schmidt), nickolay (Nickolay Ponomarev)
Port: msodbcsql17 mssql-tools

Description

Hi,

to reproduce the issue simply run MSSQL 2019 as a docker instance

docker run --rm -it -p 1433:1433 --name mssql-server -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=SecurePassword!' mcr.microsoft.com/mssql/server:2019-latest

and after installing mssql-tools

sudo port install mssql-tools openssl

running the following

sqlcmd -S localhost -U sa -P SecurePassword! -Q "SELECT @@VERSION"

The following result is received

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed].
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.

Attachments (2)

Portfile.diff (1.9 KB) - added by jmroot (Joshua Root) 4 years ago.
libmsodbcsql.17.dylib.bdiff (185 bytes) - added by jmroot (Joshua Root) 4 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 4 years ago by ShaharHD (Shahar Hadas)

Cc: ShaharHD added

comment:2 Changed 4 years ago by mf2k (Frank Schima)

Milestone: MacPorts 2.6.3
Owner: set to roederja
Status: newassigned

The Milestone field is for use by Macports team members only, please do not set it.

In the future, please add the port maintainer(s) to Cc (port info --maintainers mssql-tools), if any.

comment:3 Changed 4 years ago by ShaharHD (Shahar Hadas)

will do. sorry :)

comment:4 Changed 4 years ago by mf2k (Frank Schima)

NP. I'm just letting you know for the next time.

comment:5 Changed 4 years ago by roederja

This is a bit of problem. This port installs the binary provided by Microsoft intended for use with Homebrew. For some reason they load the openssl library at runtime and don't link to it. The location where it tries to load it from is hardcoded in the binary. I was able to get it to work by creating the path /usr/local/opt/openssl/ and creating a symlink in there: sudo ln -s /opt/local/lib lib . Obviously this is not a good solution. Unless someone knows how to safely change a path embedded in a binary I don't think we can fix this.

comment:6 Changed 4 years ago by mouse07410 (Mouse)

Any reason why you don't try

sudo install_name_tool -change /usr/local/opt/openssl/libcrypto.1.1.dylib /opt/local/lib/libcrypto.1.1.dylib /opt/local/bin/sqlcmd

And the same for libssl?

Do otool -L /opt/local/bin/sqlcmd to figure what libraries it wants. install_name_tool --help and man install_name_tool will help.

Last edited 4 years ago by mouse07410 (Mouse) (previous) (diff)

comment:7 Changed 4 years ago by roederja

As I said it doesn't link to openssl like that. That was the first thing I looked at.

comment:8 Changed 4 years ago by ShaharHD (Shahar Hadas)

Been over two weeks ... is it fixable? the binary microsoft provided, is it open source? can it be built from source instead?

comment:10 Changed 4 years ago by ShaharHD (Shahar Hadas)

I'll follow for now with the manual (and awkward) fix of creating symbolic link.

Thanks again for the time and effort on this!

comment:11 Changed 4 years ago by roederja

Resolution: fixed
Status: assignedclosed

I updated the port to the latest version and added a note about having to add the symlink. Closing this for now.

comment:12 Changed 4 years ago by jmroot (Joshua Root)

Keywords: haspatch added
Port: msodbcsql17 added
Resolution: fixed
Status: closedreopened

It seems that msodbcsql17 is the port that needs to be modified. Please try this (binary) patch, which simply changes /usr/local/opt/openssl to /opt/local/lib in the binary and nulls out the extra trailing bytes.

Changed 4 years ago by jmroot (Joshua Root)

Attachment: Portfile.diff added

Changed 4 years ago by jmroot (Joshua Root)

Attachment: libmsodbcsql.17.dylib.bdiff added

comment:13 Changed 4 years ago by jmroot (Joshua Root)

Cc: jmroot added

comment:14 Changed 4 years ago by roederja

Have you tried this? I already tried doing this myself and it didn't work. It's possible I made a mistake though.

Last edited 4 years ago by roederja (previous) (diff)

comment:15 in reply to:  14 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added

Replying to roederja:

Have you tried this?

I would be happy to try it, if you would tell me what steps to perform.

And if it turns out not to work, then the port should install the symlink, not tell the user to create it. Ports should work out of the box without requiring manual user intervention.

comment:16 Changed 4 years ago by roederja

I agree, but I also don't think ports should install things outside of the macports prefix.

comment:17 Changed 3 years ago by roederja

Resolution: fixed
Status: reopenedclosed

MSFT have fixed it - it now works with macports - at least when you install it in /opt/local

Last edited 3 years ago by roederja (previous) (diff)

comment:18 Changed 2 years ago by nickolay (Nickolay Ponomarev)

To get msodbcsql17 working, I had to manually do a sudo port activate openssl@1.1.1l_0 even though I had 1.0 and 3.0 activated:

$ port installed | grep openssl
  openssl @1.1.1i_0
  openssl @1.1.1l_0
  openssl @3_2 (active)
  openssl3 @3.0.1_0+legacy (active)
  openssl10 @1.0.2u_0
  openssl10 @1.0.2u_4 (active)

There's a plan to support openssl3 in "early 2022" https://github.com/microsoft/homebrew-mssql-release/issues/59#issuecomment-989292963

comment:19 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: nickolay added

Nickolay, please file a new bug report for your issue; it is not related to this ticket.

comment:20 Changed 2 years ago by nickolay (Nickolay Ponomarev)

Ryan, thanks. I only wanted to provide a hint to those who land here from a search engine like I did; I don't believe it is a bug to be fixed in macports. Sorry for the noise.

comment:21 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

If you had to re-activate an old version of a port to get this to work, that's a bug.

Note: See TracTickets for help on using tickets.