lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Error: Failed installing dependency: https://luarocks.org/luaossl-20180708-0.src.rock - Could not find header file for CRYPTO

Open ItsSeaJay opened this issue 5 years ago • 17 comments

So I recently discovered the lapis framework and wanted to try it out. I fired up my Windows machine and set to work. After wrestling with Lua/LuaRocks incompatabilities, I'm greeted with this error:

luaossl error

OK, so it seems like I'm missing OpenSSL, I'll just install that and--

Missing libraries

oh.

So it looks like lapis is dependant on luaossl, which is an implementation of OpenSSL which requires binaries of it's source code. This is much too difficult for me to do myself and none of the OpenSSL binaries I've found online have the files wanted by luaossl. Not to worry, I'll just fire up my trusty virtual machine, and make sure to follow the instructions more carefully next time:

the same error, but on a Ubuntu VM

This has baffled everyone I've talked to, not least myself. I don't have a copy of Windows 10 Pro (only home edition) so I'm not allowed to use Docker to handle the environment for me. A web development framework requiring OpenSSL is a little alien too (I'm used to CodeIgniter) though I suppose I could get used to it if it wasn't so difficult to install...

Does anyone know what's going on here?

ItsSeaJay avatar Jul 26 '18 16:07 ItsSeaJay

Hey, sorry for not getting back sooner. Most web development frameworks require openssl. PHP is generally compiled with it. If you're using nginx then it's compiled with it (unless you explicitly removed it).

The package luaossl expects the openssl package to be installed on your system already, it doesn't compile it's own copy of the openssl source code when installing it. Most Lua packages that use external libraries work this way. This is generally good. Most linuxes have an openssl that is kept up to date by your package manager.

You may have to search around in your /usr/local directory to find where openssl is installed, since the directory of the shared libraries may be different depending on the operating system. Hope that helps in your search.

leafo avatar Aug 08 '18 00:08 leafo

Spent some time with this issue on Raspberry Pi (RasPi 3 B+). For those seeking a solution: sudo luarocks install lapis CRYPTO_LIBDIR=/usr/lib/arm-linux-gnueabihf/ OPENSSL_LIBDIR=/usr/lib/arm-linux-gnueabihf/ should do the trick. I found the directory after locating the required library files using apt-file.


For reference, the error messages were

Error: Failed installing dependency: https://luarocks.org/luaossl-20180708-0.src.rock - Could not find library file for CRYPTO
  No file libcrypto.a in /usr/lib
  No file libcrypto.a in /usr/lib/x86_64-linux-gnu
  No file libcrypto.so in /usr/lib
  No file libcrypto.so in /usr/lib/x86_64-linux-gnu
  No file matching libcrypto.so.* in /usr/lib
  No file matching libcrypto.so.* in /usr/lib/x86_64-linux-gnu
You may have to install CRYPTO in your system and/or pass CRYPTO_DIR or CRYPTO_LIBDIR to the luarocks command.
Example: luarocks install luaossl CRYPTO_DIR=/usr/local

and

Error: Failed installing dependency: https://luarocks.org/luaossl-20180708-0.src.rock - Could not find library file for OPENSSL
  No file libssl.a in /usr/lib
  No file libssl.a in /usr/lib/x86_64-linux-gnu
  No file libssl.so in /usr/lib
  No file libssl.so in /usr/lib/x86_64-linux-gnu
  No file matching libssl.so.* in /usr/lib
  No file matching libssl.so.* in /usr/lib/x86_64-linux-gnu
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_LIBDIR to the luarocks command.
Example: luarocks install luaossl OPENSSL_DIR=/usr/local

(should help more people locate this solution).

viluon avatar Nov 01 '18 22:11 viluon

To add to the above, installing with openresty and luarocks installed via openresty's instructions on Ubuntu, I used /usr/local/openresty/luajit/bin/luarocks install lapis CRYPTO_DIR=/usr/local/openresty/openssl/ OPENSSL_DIR=/usr/local/openresty/openssl/ after installing openresty-openssl-dev package from apt to get the header files.

ryanford avatar Nov 07 '18 06:11 ryanford

use OPENSSL_INCDIR fix crypto.h not found use CRYPTO_DIR fix ssl.h not found

where ssl.h use find -f . | grep ssl.h commond find that.

if nothing use brew install openssl or use libressl replace

luarocks install luaossl OPENSSL_INCDIR=/usr/local/Cellar/openssl/1.0.2p/include CRYPTO_DIR=/usr/local/Cellar/openssl/1.0.2p

MiYogurt avatar Nov 10 '18 12:11 MiYogurt

Ok so i've spent nearly one day trying to install lapis because of this error and i have to say i'm really pissed off. I don't know where to start but first is that the error message does not mention what should be those headers files (the example shows only CRYPTO_DIR whereas the error message mention INCCRYPTO_DIR). Secondly i don't know what is required (if i understand correctly CRYPTO_DIR is used for any crypto lib, but lapis requires luaossl which itself requires openssl) Openssl is installed but again when using" locate openssl" the list is way too big to know which one we should use.

Why not making an install guide? If not i would have to try out something else, it's really a shame because this project seems interesting.

Indianajaune avatar Jan 16 '19 22:01 Indianajaune

apt-get install libssl-dev will do the trick

BhanuPrakash531 avatar Jun 12 '19 14:06 BhanuPrakash531

A user posted that they were having this problem on OSX 10.15.2, so I tried working through the problem. Here is a log of what I did:

sharpobject's adventure installing lapis on osx 10.15.2

1. #install brew https://brew.sh/
2. brew install readline
3. #install luaver using the install script at https://github.com/DhavalKapil/luaver
4. #new shell session
5. luaver install-luajit 2.1.0-beta3
6. #the above step fails with https://github.com/LuaJIT/LuaJIT/issues/449
7. #literally edit luaver in ~/.luaver/luaver to pass MACOSX_DEPLOYMENT_TARGET=10.14 to make on line 559
8. #new shell session again
9. luaver install-luajit 2.1.0-beta3
10. luaver install-luarocks 3.3.0
11. #luaver is now insisting that I install lua, refuses to use luajit
12. luaver install 5.1.5
13. luaver install-luarocks 3.3.0
14. luarocks install lapis #(now I can see the error you mentioned)
15. brew install openssl
16. luarocks install lapis CRYPTO_DIR=/usr/local/opt/openssl/ OPENSSL_DIR=/usr/local/opt/openssl

Hope that helps some future visitors.

sharpobject avatar Feb 05 '20 19:02 sharpobject

On OSX it did pass that error and installing openssl helped to resolve it, but, right after it got broken on installing luabitop:

lapis 1.8.1-1 depends on pgmoon (not installed)
Installing https://luarocks.org/pgmoon-1.11.0-1.src.rock
Missing dependencies for pgmoon 1.11.0-1:
   luabitop (not installed)

pgmoon 1.11.0-1 depends on lua >= 5.1 (5.3-1 provided by VM)
pgmoon 1.11.0-1 depends on luabitop (not installed)
Installing https://luarocks.org/luabitop-1.0.1-1.src.rock

luabitop 1.0.1-1 depends on lua >= 5.1 (5.3-1 provided by VM)
Do not use 'module' as a build type. Use 'builtin' instead.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/opt/lua/include/lua5.3 -c bit.c -o bit.o
bit.c:79:2: error: "Unknown number type, check LUA_NUMBER_* in luaconf.h"
#error "Unknown number type, check LUA_NUMBER_* in luaconf.h"
 ^
bit.c:82:5: warning: implicit declaration of function 'luaL_typerror' is invalid
      in C99 [-Wimplicit-function-declaration]
    luaL_typerror(L, idx, "number");
    ^
bit.c:175:3: warning: implicit declaration of function 'luaL_register' is
      invalid in C99 [-Wimplicit-function-declaration]
  luaL_register(L, "bit", bit_funcs);
  ^
2 warnings and 1 error generated.

any idea how to fix this one?

skitsanos avatar May 03 '20 09:05 skitsanos

@skitsanos, I don't think you can build luabitop on lua 5.3. Maybe try building it on lua 5.1. I posted instructions that would cause you to do that.

sharpobject avatar May 12 '20 10:05 sharpobject

What worked for me (on mac) was making sure I had Lua 5.1 installed then using luarocks --lua-dir /usr/local/Cellar/[email protected]/5.1.5_8 install lapis CRYPTO_DIR=/usr/local/Cellar/[email protected]/1.1.1g OPENSSL_DIR=/usr/local/Cellar/[email protected]/1.1.1g/, where lua 5.1 and openssl 1.1/1 where installed with brew. Basically just forcing the use of lua 5.1 and explicitly saying where the needed directories are. I was having issues both with luaossl and later luabitop, this fixed both of them. Just posting here in case it's useful for someone!

sporkl avatar Jul 14 '20 11:07 sporkl

FWIW after Ubuntu 18.04.1 LTS, 5.4.0-56-generic:

sudo luarocks install http CRYPTO_LIBDIR=/usr/lib/x86_64-linux-gnu

Note LIBDIR not DIR

Tested with luajit 2.1.0-beta3 and lua5.1 and h2_streaming.lua all OK.

Loggy48 avatar Dec 05 '20 11:12 Loggy48

Just wanted to chime in, I had this problem when trying to install jitsi-meet-tokens through apt on an x86_64 Debian 11 system. For me what ended up fixing this was first installing some dependencies, using sudo apt update && sudo apt -y install libssl-dev build-essential and then installing the package luaossl, with the following command:

luarocks install luaossl \
CRYPTO_DIR=/usr/include CRYPTO_INCDIR=/usr/include \
CRYPTO_LIBDIR=/usr/lib/x86_64-linux-gnu \
OPENSSL_INCDIR=/usr/include OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu

Not sure if this is the right / intended way of fixing this, but it worked for my usecase, maybe this will help someone.

ThaRising avatar Jun 10 '22 14:06 ThaRising

Still having this problem in 2022 on a fresh install of Debian. Ridiculous, clearly the devs don't test their software and just ship it broken. PHP, Django and Flask all don't have this problem, it's only you Lapis.

I could probably find some convoluted fix but I recommend people use Sailor instead of Lapis. Development for it is slow but it actually works and is tested before being shipped to people.

30-silver avatar Jun 30 '22 19:06 30-silver

Potentially relevant for future searchers: on Fedora/Oracle Enterprise with OpenResty, using openssl-devel didn't seem to work and instead caused compilation issues for me. But in a luaossl issue comment, it was mentioned that openresty-openssl-devel can help remedy this issue, so installing that and following what they did was what worked for me.

Agapurnis avatar Mar 14 '23 21:03 Agapurnis

On macOS Ventura, I encountered a similar issue when trying to install the http module. Here is what helped me:

$ brew install openssl
$ luarocks install http CRYPTO_DIR=$(brew --prefix openssl) OPENSSL_DIR=$(brew --prefix openssl)

glebovdev avatar Mar 30 '23 18:03 glebovdev

I put together some information for mac users: https://gist.github.com/edgarberlinck/c50f4db6d09f6493b1c205a91c2a0264

edgarberlinck avatar Jun 21 '23 09:06 edgarberlinck

In my case on windows with cygwin you need either the mingw64 openssl devel installed first you can do with the installer setup-x86_64.exe -q -P mingw64-x86_64-openssl or if you want the win32 version look under Category devel

with find check each location of these find /usr -name ssl.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/openssl/ssl.h

find /usr -name libcrypto.a /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libcrypto.a

find /usr -name crypto.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/openssl/crypto.h

noted them down where they are located which you need to pass as arguments

in my case with the paths above

luarocks install luaossl CRYPTO_INCDIR=/usr/x86_64-w64-mingw32/sys-root/mingw/include CRYPTO_DIR=/usr/x86_64-w64-mingw32/sys-root/mingw OPENSSL_DIR=/usr/x86_64-w64-mingw32/sys-root/mingw

syarul avatar Jan 25 '24 08:01 syarul