Lua-cURLv3
Lua-cURLv3 copied to clipboard
Error when requiring module
When I require the module I get this error:
C:\Lua51\lua5.1.exe: error loading module 'lcurl' from file 'C:\Lua51\systree\lib\lua\5.1\lcurl.dll':
The specified module could not be found.
stack traceback:
[C]: ?
[C]: in function 'require'
C:\Lua51\systree\share\lua\5.1\curl.lua:11: in main chunk
[C]: in function 'require'
main.lua:2: in main chunk
[C]: ?
I installed Lua-cURL with Windows 32 bit cURL:
luarocks install lua-curl CURL_DIR=C:\curl-7.82.0_1-win32-mingw
Seems like when I installed it, it didn't install a lcurl file. How do I fix this?
I am also running into this error (not being able to find lcurl). I am installed on Mac OS 11.3 using homebrew/luarocks. To reproduce:
brew install luarocks&brew install curlluarocks install lua-curl CURL_INCDIR=/opt/homebrew/opt/curl/includeThis produces the following:
Installing https://luarocks.org/lua-curl-0.3.13-1.src.rock
lua-curl 0.3.13-1 depends on lua >= 5.1, < 5.5 (5.4-1 provided by VM)
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/l52util.c -o src/l52util.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lceasy.c -o src/lceasy.o -I/opt/homebrew/opt/curl/include
src/lceasy.c:203:1: warning: non-void function does not return a value [-Wreturn-type]
}
^
src/lceasy.c:1512:31: warning: add explicit braces to avoid dangling else [-Wdangling-else]
if(ret == 0) ret = 1; else ret = 0;
^
2 warnings generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcerror.c -o src/lcerror.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lchttppost.c -o src/lchttppost.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcurl.c -o src/lcurl.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcutils.c -o src/lcutils.o -I/opt/homebrew/opt/curl/include
src/lcutils.c:358:12: warning: cast to smaller integer type 'curl_socket_t' (aka 'int') from 'void *' [-Wvoid-pointer-to-int-cast]
return (curl_socket_t)lua_touserdata(L, idx);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcmulti.c -o src/lcmulti.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcshare.c -o src/lcshare.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcmime.c -o src/lcmime.o -I/opt/homebrew/opt/curl/include
src/lcmime.c:186:20: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
for(i=0;method = lcurl_mime_part_fields[i]; ++i){
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lcmime.c:186:20: note: place parentheses around the assignment to silence this warning
for(i=0;method = lcurl_mime_part_fields[i]; ++i){
^
( )
src/lcmime.c:186:20: note: use '==' to turn this assignment into an equality comparison
for(i=0;method = lcurl_mime_part_fields[i]; ++i){
^
==
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lcurlapi.c -o src/lcurlapi.o -I/opt/homebrew/opt/curl/include
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o lcurl.so src/l52util.o src/lceasy.o src/lcerror.o src/lchttppost.o src/lcurl.o src/lcutils.o src/lcmulti.o src/lcshare.o src/lcmime.o src/lcurlapi.o -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lcurl
lua-curl 0.3.13-1 is now installed in /opt/homebrew (license: MIT/X11)
- Run the lua script containing
local curl = require("curl"). This produces:
/opt/homebrew/Cellar/luarocks/3.8.0/share/lua/5.4/curl.lua:11: module 'lcurl' not found:
no field package.preload['lcurl']
[lua searcher]: module not found: 'lcurl'
no file '/opt/homebrew/Cellar/luarocks/3.8.0/share/lua/5.4/lcurl.lua'
no file '/opt/homebrew/share/lua/5.4/lcurl.lua'
no file '/opt/homebrew/share/lua/5.4/lcurl/init.lua'
no file '/opt/homebrew/lib/lua/5.4/lcurl.lua'
no file '/opt/homebrew/lib/lua/5.4/lcurl/init.lua'
no file './lcurl.lua'
no file './lcurl/init.lua'
no file '/Users/jessebrault/.luarocks/share/lua/5.4/lcurl.lua'
no file '/Users/jessebrault/.luarocks/share/lua/5.4/lcurl/init.lua'
stack traceback:
[C]: in function 'require'
/opt/homebrew/Cellar/luarocks/3.8.0/share/lua/5.4/curl.lua:11: in main chunk
[C]: in function 'require'
./vazneExamples.lua:1: in main chunk
[C]: in function 'require'
[\directlua]:2: in main chunk.
N.B. In my case, the lua script is a script for LuaLaTeX.
Using find /opt/homebrew -name lcurl and similar, I can find no lcurl files installed whatsoever.
I suspect this is related to #183, as I also had to separately install cURL (via homebrew, see above), perhaps something isn't working at that step and lua-curl depends on it?
Any help would be greatly appreciated as I would love to use this library in my project!
Search your entire system for lcurl.so
You can tell from the log it successfully compiled lcurl.so without any error.
Usually it's because you don't configure the path correctly
luarocks path