Skip to content

Fix issue of having both x86-64 and arm64 Homebrew installation and running lisp with arm64 architecture #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

svetlyak40wt
Copy link
Contributor

When you are having both x86-64 and ARM Homebrew, and running LISP with arm architecture, attempt to load cl+ssl fails with error:

Unable to load foreign library (LIBCRYPTO).
  Error opening shared object "/usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib":
  dlopen(/usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib, 10): no suitable image found.  Did find:
        /usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib: mach-o, but wrong architecture
        /usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib: stat() failed with errno=4.
   [Condition of type CFFI:LOAD-FOREIGN-LIBRARY-ERROR]

This is because this code tries to load x86 version of the library first and fails.

My patch fixes this by removing one or another path depending on current Lisp architecture.

…unning lisp with arm64 architecture

When you are having both x86 and arm Homebrews, and running LISP with arm architecture,
attempt to load cl+ssl fails with error:

```
Unable to load foreign library (LIBCRYPTO).
  Error opening shared object "/usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib":
  dlopen(/usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib, 10): no suitable image found.  Did find:
        /usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib: mach-o, but wrong architecture
        /usr/local/Cellar/openssl@1.1/1.1.1s/lib/libcrypto.1.1.dylib: stat() failed with errno=4.
   [Condition of type CFFI:LOAD-FOREIGN-LIBRARY-ERROR]
```

This is because [this code](https://github.com/cl-plus-ssl/cl-plus-ssl/blob/13d824e27cf7f6085086458daea1514b605b3980/src/reload.lisp#L105-L106)
tries to load x86 version of the library first and fails.

My patch fixes this by removing one or another path depending on current Lisp architecture.
@avodonosov
Copy link
Member

@svetlyak40wt, does mac have 32-bit version? I mean, shouldn't we do (or :x86 :x86-64) instead of simply :x86-64? Or maybe even (not :arm64)?

@svetlyak40wt
Copy link
Contributor Author

I don't know. Maybe some old OSX versions can run on some old hardware?

I think we could make (or :x86 :x86-64) just to be sure.

@avodonosov
Copy link
Member

The Homebrew installation doc has a footnote 1, saying "For 32-bit or PPC support see Tigerbrew"

https://docs.brew.sh/Installation#1

And the Tigerbrew install script says "This script installs to /usr/local only":
https://github.com/mistydemeo/tigerbrew/blob/b7ab6258bd595fa0568703326326abebb272e288/install#L2C1-L2C1

But I do not understand whether it installs to /usr/local/opt/openssl/lib/

@svetlyak40wt
Copy link
Contributor Author

I don't have such old hardware to check.

@svetlyak40wt
Copy link
Contributor Author

Probably we could merge as (or :x86 :x86-64), fix at least for modern systems and hope it will not break more rare old one?

@avodonosov
Copy link
Member

avodonosov commented Jul 28, 2023

I lean towards (:not :arm64) since PPC is also mentioned for Tigerbrew.

I hope to add this with a coment and merge in the evening today.

@svetlyak40wt
Copy link
Contributor Author

Cool! Thank you!

avodonosov added a commit that referenced this pull request Jul 28, 2023
…d PPC will work if Tigerview installs the libraries to the /usr/local/opt/openssl prefix.
@avodonosov avodonosov merged commit 6fa6293 into cl-plus-ssl:master Jul 28, 2023
@avodonosov
Copy link
Member

Merged, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants