Fossil Forum

Missing Homebrew OpenSSL path check on M1 Macs
Login

Missing Homebrew OpenSSL path check on M1 Macs

(1) By BPK (bpk000) on 2021-02-06 21:42:47 [source]

The build script fails to check for SSL in /opt/homebrew/opt/openssl which seems to be the default location when installing OpenSSL via Homebrew on Apple Silicon (M1) Macs.

I ran into this issue when trying to build Fossil (version 2.15, 324154e821) on a new M1 Mac Mini (Big Sur, macOS 11.2).

Homebrew now installs to /opt/homebrew for macOS on Apple Silicon and continues to use /usr/local for macOS on Intel. See Homebrew install docs.

Initially running ./configure, yielded the following SSL checks:

Checking for system ssl...no
Checking for ssl in /usr/sfw...no
Checking for ssl in /usr/local/ssl...no
Checking for ssl in /usr/lib/ssl...no
Checking for ssl in /usr/ssl...no
Checking for ssl in /usr/pkg...no
Checking for ssl in /usr/local...no
Checking for ssl in /usr...no
Checking for ssl in /usr/local/opt/openssl...no

This solved the problem for me:

$ ./configure --with-openssl=/opt/homebrew/opt/openssl

I'm filing this as a bug because the Fossil SSL wiki mentions:

...we recomend that you use Homebrew on macOS to install OpenSSL as above. Fossil's build system will seek it out and use it automatically.

Thanks to everyone working on Fossil.

(2) By Warren Young (wyoung) on 2021-02-06 23:28:05 in reply to 1 [link] [source]

I expect that's a symlink to somewhere under /usr/local/Cellar, and that would be a better place to look for this.

The core problem here is that Apple hasn't shipped an up-to-date OpenSSL in years and years, probably part of this whole anti-GPL thing they've got going on, so we've got to go digging for third-party installs.

I've got an M1 coming, but it's somewhere between here and China at the moment. Maybe someone will beat me to a well-considered fix before it arrives.

(3) By Richard Hipp (drh) on 2021-02-06 23:39:23 in reply to 1 [link] [source]

Really? Because on my Big Sur system in which I just ran "brew upgrade openssl" to get OpenSSL 1.1.1i, it still puts the libraries in /usr/local/opt/openssl.

Nevertheless, I have added /opt/homebrew/opt/openssl to the list of directories searched. Please try again with the latest trunk check-in and report back whether or not the problem has been cleared.

Can somebody else with a Mac run brew to install OpenSSL and report back what directory it uses, to confirm bpk000's report?

(4) By BPK (bpk000) on 2021-02-07 18:12:47 in reply to 2 [link] [source]

Running brew install openssl@1.1 ends up creating both

/opt/homebrew/opt/openssl

and

/opt/homebrew/opt/openssl/openssl@1.1

each is a symlink to

/opt/homebrew/Cellar/openssl@1.1/1.1.1i

In my original post, I suggested checking /opt/homebrew/opt/openssl since that seemed like the equivalent to the existing /usr/local/opt/openssl check (Homebrew Apple Silicon path vs. Homebrew Intel path).

BTW, on my old Intel Mac, /usr/local/opt/openssl is a symlink pointing to /usr/local/Cellar/openssl@1.1/1.1.1h.

Hope that helps.

(5) By BPK (bpk000) on 2021-02-07 18:15:51 in reply to 3 [link] [source]

Thank you. I can confirm that your check-in (Fossil 2.15, 17af40efff) works as expected. When running ./configure, Homebrew's OpenSSL install is found at /opt/homebrew/opt/openssl. Here's the relavent output:

Checking for system ssl...no
Checking for ssl in /usr/sfw...no
Checking for ssl in /usr/local/ssl...no
Checking for ssl in /usr/lib/ssl...no
Checking for ssl in /usr/ssl...no
Checking for ssl in /usr/pkg...no
Checking for ssl in /usr/local...no
Checking for ssl in /usr...no
Checking for ssl in /usr/local/opt/openssl...no
Checking for ssl in /opt/homebrew/opt/openssl...ok
HTTPS support enabled

Like you, on my old Intel Mac, Homebrew has OpenSSL at /usr/local/opt/openssl which is a symlink to /usr/local/Cellar/openssl@1.1/1.1.1h. (I'm unsure how up-to-date that one is).

On my new M1 Mac, running brew install openssl@1.1 ends up creating both

/opt/homebrew/opt/openssl

and

/opt/homebrew/opt/openssl/openssl@1.1

each is a symlink to

/opt/homebrew/Cellar/openssl@1.1/1.1.1i

For background, the M1 Mac was fresh from the factory. Fossil was my first attempted software build on the machine. That first time through was when I encountered the issue of no OpenSSL being found. After that, I installed Homebrew and subsequently used it to install OpenSSL (brew install openssl@1.1). Currently, that's the one and only package I've installed.

I found this Github issue for Homebrew's support of ARM/M1 where they mention a new prefix for macOS ARM:

Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (/opt/homebrew) and Homebrew on Linux

If I can help in any way, please let me know. Again, many thanks.

(6) By Richard Hipp (drh) on 2021-02-07 18:37:07 in reply to 5 [link] [source]

If I can help in any way, please let me know.

Do the precompiled binaries for Mac run on your new M1?

Can you build a Fossil on your M1 and then make it available for us Intel users to try out?

(7) By BPK (bpk000) on 2021-02-07 19:12:05 in reply to 6 [link] [source]

I just built the most recent check-in (eb1a722f). You can access it from my Dropbox account. I included the output from configure and make in case that's helpful.

This may provide a direct download from Dropbox:

https://www.dropbox.com/s/oitn3g7gsafe7bi/Fossil-eb1a722f-build.zip?dl=1

I'll test the precompiled binaries and report back.

(8) By BPK (bpk000) on 2021-02-07 20:19:19 in reply to 6 [link] [source]

I downloaded and tested the preview of 2.15 and 2.14. Both seem to work fine with basic commands. Command summary included below. Please let me know if there is anything else I can do to help.

Note that I have installed Rosetta, but my Terminal is NOT opened using Rosetta as detailed in this article.

Calling the file command on my local build shows:

$ file Fossil-eb1a722f/fossil
Fossil-eb1a722f/fossil: Mach-O 64-bit executable arm64

The prebuilt binaries show:

$ file ./fossil-macosx-2.15-preview-20210205/fossil
./fossil-macosx-2.15-preview-20210205/fossil: Mach-O 64-bit executable x86_64

$ file ./fossil-macosx-2.14/fossil 
./fossil-macosx-2.14/fossil: Mach-O 64-bit executable x86_64

Summary of commands used to test both prebuilt binaries:

$ arch
arm64

$ fossil info
config-db:    /Users/bpk/.fossil
fossil:       /Users/bpk/bin/fossil
version:      2.15 [1ba06268ad] 2021-02-05 18:27:03 UTC

$ fossil init test.fossil
project-id: e219daab62c32ba7155af311b90e9e7d28ed70cf
server-id:  c8c4efcae3c9cc44501a044b45480067c563c858
admin-user: bpk (initial password is "SehRPDiMfw")

$ fossil open test.fossil --force
project-name: <unnamed>
repository:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/test.fossil
local-root:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/
config-db:    /Users/bpk/.fossil
project-code: e219daab62c32ba7155af311b90e9e7d28ed70cf
checkout:     16eb00c425b48aad09244d231f9a571f2a4c6ca0 2021-02-07 19:31:59 UTC
tags:         trunk
comment:      initial empty check-in (user: bpk)
check-ins:    1

$ echo 'New file' > new.txt
$ fossil extras
new.txt

$ fossil add new.txt
ADDED  new.txt

$ fossil status
repository:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/test.fossil
local-root:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/
config-db:    /Users/bpk/.fossil
checkout:     16eb00c425b48aad09244d231f9a571f2a4c6ca0 2021-02-07 19:31:59 UTC
tags:         trunk
comment:      initial empty check-in (user: bpk)
ADDED      new.txt

$ fossil commit -m "Adds new.txt file."
New_Version: d514605d5119375d5f8dcebb105b30201f4d730d5305b6d1e85cabacbb3519e1

$ fossil timeline
=== 2021-02-07 ===
19:37:20 [d514605d51] *CURRENT* Adds new.txt file. (user: bpk tags: trunk)
19:31:59 [16eb00c425] initial empty check-in (user: bpk tags: trunk)
+++ no more data (2) +++

$ fossil ui
Listening for HTTP requests on TCP port 8080
(Went to configuration and gave project a name.)
^C

$ fossil info
project-name: Test Project
repository:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/test.fossil
local-root:   /Users/bpk/Downloads/fossil-macosx-2.15-preview-test/
config-db:    /Users/bpk/.fossil
project-code: e219daab62c32ba7155af311b90e9e7d28ed70cf
checkout:     d514605d5119375d5f8dcebb105b30201f4d730d 2021-02-07 19:37:20 UTC
parent:       16eb00c425b48aad09244d231f9a571f2a4c6ca0 2021-02-07 19:31:59 UTC
tags:         trunk
comment:      Adds new.txt file. (user: bpk)
check-ins:    2

(9) By BPK (bpk000) on 2021-02-07 20:40:29 in reply to 6 [link] [source]

Homebrew also has prebuilt binaries of Fossil 2.14:

Big Sur, ARM64: https://homebrew.bintray.com/bottles/fossil-2.14.arm64_big_sur.bottle.tar.gz
sha256: d0ac7394862b01c94118282bc7fe014ecc004818d0bdb5d7ad62ead3a4f8c789

Big Sur, x86_64: https://homebrew.bintray.com/bottles/fossil-2.14.big_sur.bottle.tar.gz
sha256: 47b62a05daf6fc12735cc10ac3d661a058df73c918c0d425c8a06b5d33ceae40

(10) By Warren Young (wyoung) on 2021-02-12 00:35:46 in reply to 4 [link] [source]

Having received my M1, I'm posting to confirm this diagnosis and to point out that it's an ongoing thing, not a one-time shift. I don't know who decided this was a good idea, but as long as Homebrew remains so popular, it's something we'll have to accommodate on the Fossil side of things.