MariaDB4j: Startup fails looking for openssl in specific directory (on Mac OS X)
One of my co-workers got this error when starting our Spring Boot project that uses MariaDB4j. This was on Mac OSX
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Referenced from: /private/var/folders/w6/_r897gfx27b3bqj9_zvckvth0000gn/T/MariaDB4j/base/bin/my_print_defaults Reason: image not found
He doesn’t use homebrew but uses macports which I think has things installed in different directories. Though it could happen for anyone with libs installed in different directories
The fix was to run
sudo mkdir -p /usr/local/opt/openssl
sudo ln -s /opt/local/lib /usr/local/opt/openssl/.
Not sure if this is a bug worth fixing, or just need to add some documentation tips?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 39 (4 by maintainers)
@thesquaregroot and I have been struggling with this for a couple of days now, and he found a fix that worked earlier today (which is similar to the OP’s solution).
Seems like a silly thing to have to do. It might also be possible to be fixed by adding
/usr/libto our PATH… but haven’t tried that.I upgraded to Catalina and now have this problem, too. I have installed openssl using homebrew, but the problem still exists. I think it’s because I have openssl v1.1 installed and this is looking for v1.0.0:
Relevant error bits:
ch.vorburger.exec.ManagedProcessException: An error occurred while installing the database dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Reason: image not found
Files in /usr/local/opt/openssl/lib:
libcrypto.1.1.dylib libcrypto.a libcrypto.dylib -> libcrypto.1.1.dylib libssl.1.1.dylib libssl.a libssl.dylib -> libssl.1.1.dylib
We just had a new developer try this on a brand new Sierra install. It was ‘fixed’ by installing OpenSSL with homebrew.
Not sure if this is a MariaDB4j issue, or a MariaDB issue. But I just wanted to report the fix.
Why you did not do this? It is simpler:
sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylibsudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylibSame issue here. Recently installed some cli tools on my Mac (High Sierra) which upgraded openssl to 1.1 and this failed. I upgraded the library to version
2.4.0and still having the issue. I found that the library is still referring to mariadb version10.2.11which was not built with openssl 1.1.Just wondering if a PR would be welcomed to upgrade to the mariadb latest stable version
10.4.xor at least10.2.16, which is the minimum version for depending on openssl 1.1.References: Secure Connections Overview
The issue is due that the build of MariaDB for OSX in the jar’s is a brew bottle pre
The issue could be solved if you install OpenSSL using brew
brew install OpenSSLorThe best option is to do a custom build of MariaDB for OSX using the macOS given OpenSSL lib and not the brew one and package that in this project.
I tried and the issue is fixed. Thanks
@vorburger this is a workaround
brew install rbenv/tap/openssl@1.0ln -sfn /usr/local/Cellar/openssl@1.0/1.0.2t /usr/local/opt/opensslHad the same issue and an already installed openssl 1.1.1 Switching to 1.0.0 did not work for me. I had to uninstall 1.1.1 by
brew uninstall --ignore-dependencies openssland then install 1.0.0:brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rbUpdate: if your openssl was installed/upgraded by homebrew, a temporary fix could be
brew switch openssl 1.0.2k.This was an issue for me as well (MacOS 10.14.4). Installing OpenSSL via Homebrew was successful. Hopefully (as it appears) this is only a MacOS issue, since we’re starting to experiment with using this for testing and may offload to some sort of CI server. Happy to have found a fix here for MacOS 👍.
@jeffsheets thank you for taking the time to record this here - hopefully it will help others.
For those with a new Macbook Pro with M1 CPU, check out my comment here: https://github.com/kelaberetiv/TagUI/issues/635#issuecomment-1003656723
@vorburger Thank you for putting this together!
@lrcry indicated earlier that version
10.2.16is the minimum MariaDB version that supports OpenSSL 1.1. This is ahead of10.2.11which is the latest version MariaDB4j depends on. I think releasing a newer version would fix this issue for everyone.Alternatively, more detailed documentation on how to direct MariaDB4j to use a specific (later) version of MariaDB would be welcome.
After updating to Big Sur, the above fix didn’t work as it appears Apple has removed the filesystem versions of libraries like this.
I was able to get it working this time using Homebrew, though not the standard way, since OpenSSL v1.0 is deprecated. Following the guidance here, I was able to install openssl 1.0 alongside 1.1.1 using the following command:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb -f(Technically I downloaded the file to give it a once-over and then ran
brew install <file>, but I’m assuming running it as suggested would work just as well.)I encountered this issue using OSX 10.15.3. I couldn’t just downgrade openssl to 1.0.0 because my
awscliinstall (and likely others) required openssl 1.1.x.So to have both
awscli(openssl 1.1+) andmariadb4j(openssl 1.0) working, I had to install both versions of openssl withbrewand switch to using the older one:I ran
brew uninstallseveral times to ensure I don’t have any other versions ofopensslinstalled.You should end up with:
As well as under
/usr/local/Cellar.I too am running into this issue. I’m on macOS Sierra 10.12.5. Unfortunately I don’t know that I’d better share my whole project, but I can share snippets. The full console spew for me is here:
I’m not going to try to solve this on this box just now, and would entertain further troubleshooting steps. I’m just going to use my Windows box for the moment.