daurnimator / lua-http

HTTP Library for Lua. Supports HTTP(S) 1.0, 1.1 and 2.0; client and server.
https://daurnimator.github.io/lua-http/
MIT License
795 stars 81 forks source link

Doc to install lua-http on macos and lua 5.3 #142

Open octplane opened 5 years ago

octplane commented 5 years ago

This is probably a known issue, but there is not clear doc on how to do that correctly:

With lua 5.3 from brew, the install command that succeeds on my machine is:

 luarocks install http CRYPTO_DIR=/usr/local/opt/openssl/ CRYPTO_INCDIR=/usr/local/opt/openssl/include OPENSSL_DIR=/usr/local/opt/openssl/ OPENSSL_INCDIR=/usr/local/opt/openssl/include

Thanks for making lua-http!

daurnimator commented 5 years ago

The problem is that it changes somewhat regularly and not in a way that is easily coordinated with the lua-http release cycle:

So I'm not sure what I can do to avoid having potentially outdated instructions around.

RyanSquared commented 5 years ago

I have absolutely no clue what's up with the openssl situation on macOS to the point where I'm getting a new computer, part of the justification being that I just don't want to deal with it. Unfortunately, it's very much a "per-system" situation.

octplane commented 5 years ago

Yeah, I actually opened the bug so that people like me (and probably me later) remember this might not be as straightforward as luarocks install http on macOS :)

daurnimator commented 5 years ago

One solution (given that you seem to have decided on brew) would be to package lua-http in brew?

latenitefilms commented 4 years ago

Thanks heaps @octplane ! This issue was very helpful!

javierfernandes commented 3 years ago

Still does the trick ! Thanks 🙏 !

daurnimator commented 3 years ago

Is there anyone that would like to create/submit a brew package for lua-http?

Lanttcat commented 2 years ago

Update: if you install openssl now, The brew will install openssl@3 on your machine. And then the LuaRocks will install failed by use openssl@3 and error is: Could not find header file for CRYPTO.

This is workaround on my machine:

luarocks install http CRYPTO_DIR=/usr/local/opt/openssl@1.1/ CRYPTO_INCDIR=/usr/local/opt/openssl@1.1/include OPENSSL_DIR=/usr/local/opt/openssl@1.1/ OPENSSL_INCDIR=/usr/local/opt/openssl@1.1/include
vvvvv commented 1 year ago

For anyone coming here in 2022, this is still an issue.

This is a workaround on my machine macbook m1

luarocks install http CRYPTO_DIR=/opt/homebrew/opt/openssl@1.1 CRYPTO_INCDIR=/opt/homebrew/opt/openssl@1.1/include OPENSSL_DIR=/opt/homebrew/opt/openssl@1.1 OPENSSL_INCDIR=/opt/homebrew/opt/openssl@1.1/include
daurnimator commented 1 year ago
openssl@1.1

openssl 1.1 is quite old at this point. consider using a newer release?

alextes commented 1 year ago

To make this work with a more recent openssl:

brew install openssl
luarocks install http CRYPTO_DIR=/opt/homebrew/opt/openssl@3 OPENSSL_DIR=/opt/homebrew/opt/openssl@3

or the default 1.1

luarocks install http CRYPTO_DIR=/opt/homebrew/opt/openssl@1.1 OPENSSL_DIR=/opt/homebrew/opt/openssl@1.1

Although from what I gather 1.1 is still widely used openssl themselves would encourage you to upgrade.

from: https://www.openssl.org/source/

Note: The latest stable version is the 3.0 series supported until 7th September 2026. This is also a Long Term Support (LTS) version. The previous LTS version (the 1.1.1 series) is also available and is supported until 11th September 2023. All older versions (including 1.1.0, 1.0.2, 1.0.0 and 0.9.8) are now out of support and should not be used. Users of these older versions are encouraged to upgrade to 3.0 as soon as possible. Extended support for 1.0.2 to gain access to security fixes for that version is available.

With regard to trying to actually improve the situation, during installation one of the steps lists where it was looking for openssl stuff, and does not list the place where homebrew installs the shared openssl things.

Error: Failed installing dependency: https://luarocks.org/cqueues-20200726.54-0.src.rock - Could not find header file for CRYPTO
  No file openssl/crypto.h in /usr/local/include
  No file openssl/crypto.h in /usr/include
  No file openssl/crypto.h in /include
  No file openssl/crypto.h in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
  No file openssl/crypto.h in /usr/local/opt/include

Is that a luarocks or a cqueues issue? One of them is clearly unaware of the location where all macOS users will have their include dir, which is a lot of people! I can open something in one of those repos if someone has the answer.

For this repo I think the natural thing to do is to either note something in the install section or maybe a troubleshooting that mentions install on macOS requires additional steps. Even if only linking this issue. Installing an http lib is after all fairly common 😅 , and this appears to be the most popular option. At the same time, I'd also say it's fair to do nothing until something is fixed upstream. The lib which depends on openssl should know how to find it, not this lib. Nevertheless, this repo will probably face the most stuck end-users.

daurnimator commented 1 year ago

One of them is clearly unaware of the location where all macOS users will have their include dir, which is a lot of people!

It's a luarocks configuration issue: you'd need to tell luarocks about where brew is putting things. As upstream luarocks doesn't really know anything about brew, it's more of a question for whereever you got your luarocks config from.... which is probably brew? i.e. it's a missing feature of the brew packaging of luarocks; in that it doesn't tell it about how brew works.