Skip to content
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

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

Open
ItsSeaJay opened this issue Jul 26, 2018 · 17 comments

Comments

@ItsSeaJay
Copy link

ItsSeaJay commented Jul 26, 2018

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?

@leafo
Copy link
Owner

leafo commented Aug 8, 2018

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.

@viluon
Copy link

viluon commented Nov 1, 2018

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).

@ryanford
Copy link
Contributor

ryanford commented Nov 7, 2018

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.

@MiYogurt
Copy link

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

@Indianajaune
Copy link

Indianajaune commented Jan 16, 2019

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.

@BhanuPrakash531
Copy link

apt-get install libssl-dev will do the trick

@sharpobject
Copy link
Contributor

sharpobject commented Feb 5, 2020

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.

@skitsanos
Copy link

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?

@sharpobject
Copy link
Contributor

@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.

@sporkl
Copy link

sporkl commented Jul 14, 2020

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!

@Loggy48
Copy link

Loggy48 commented Dec 5, 2020

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.

@ThaRising
Copy link

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.

@30-silver
Copy link

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.

@Agapurnis
Copy link

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.

@glebovdev
Copy link

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)

@edgarberlinck
Copy link

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

@syarul
Copy link

syarul commented Jan 25, 2024

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

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

No branches or pull requests