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

Simple example not working on Windows #7

Open
daylanKifky opened this issue Dec 2, 2021 · 8 comments
Open

Simple example not working on Windows #7

daylanKifky opened this issue Dec 2, 2021 · 8 comments

Comments

@daylanKifky
Copy link

Hi! thanks for this great library. It's not easy to find simple and effective packages to do async https request within the love framework.
I had no problems using it in a linux machine, but I'm having some problems making the package work under windows.

The problematic machine is running:

  • Windows 10 64bit
  • tried with both: love x32 11.3 and love x64 11.3

The submodules are pulled, and I double checked there's content on them

This is what I tried:

  1. Following the instructions in the README and using the Simple Example code I get this error:
Error: lib/REST-love/module-loader.lua:37: module 'luajit-request' not found: 
        no field package.preload['luajit-request'] 
        no 'luajit-request' in LOVE game directories. 
        no file 'luajit-request' in LOVE paths. 
        no file '.\luajit-request.lua' 
        no file 'C:\Program Files (x86)\LOVE\lua\luajit-request.lua' 
        no file 'C:\Program Files (x86)\LOVE\lua\luajit-request\init.lua' 
        no file '.\luajit-request.dll' 
        no file 'C:\Program Files (x86)\LOVE\luajit-request.dll' 
        no file 'C:\Program Files (x86)\LOVE\loadall.dll' 
stack traceback: 
        [string "boot.lua"]:777: in function <[string "boot.lua"]:773> 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        lib/REST-love/rest-lib/win-rest.lua:2: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/REST.lua:62: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        main.lua:5: in main chunk 
        [C]: in function 'require' 
        [string "boot.lua"]:570: in function <[string "boot.lua"]:380> 
        [C]: in function 'xpcall' 
        [string "boot.lua"]:787: in function <[string "boot.lua"]:780> 
        [C]: in function 'xpcall'
  1. Copied REST-love/luajit-request to project root as a quick workaround
Error: luajit-request/luajit-request/luajit-curl.lua:28: cannot load module 'libcurl': The specified module could not be found. 
 
stack traceback: 
        [string "boot.lua"]:777: in function <[string "boot.lua"]:773> 
        [C]: in function 'load' 
        luajit-request/luajit-request/luajit-curl.lua:28: in main chunk 
        [C]: in function 'require' 
        luajit-request/luajit-request/init.lua:30: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        lib/REST-love/rest-lib/win-rest.lua:2: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/REST.lua:62: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        main.lua:5: in main chunk 
        [C]: in function 'require' 
        [string "boot.lua"]:570: in function <[string "boot.lua"]:380> 
        [C]: in function 'xpcall' 
        [string "boot.lua"]:787: in function <[string "boot.lua"]:780> 
        [C]: in function 'xpcall'
  1. Copied both REST-love/luajit-request and REST-love/luajit-request/luajit-request/libcurl.dll to project root running Love x32 11.3
Error: luajit-request/luajit-request/luajit-curl.lua:28: cannot load module 'libcurl': %1 is not a valid Win32 application. 
 
stack traceback: 
        [string "boot.lua"]:777: in function <[string "boot.lua"]:773> 
        [C]: in function 'load' 
        luajit-request/luajit-request/luajit-curl.lua:28: in main chunk 
        [C]: in function 'require' 
        luajit-request/luajit-request/init.lua:30: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        lib/REST-love/rest-lib/win-rest.lua:2: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/REST.lua:62: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        main.lua:5: in main chunk 
        [C]: in function 'require' 
        [string "boot.lua"]:570: in function <[string "boot.lua"]:380> 
        [C]: in function 'xpcall' 
        [string "boot.lua"]:787: in function <[string "boot.lua"]:780> 
        [C]: in function 'xpcall'
  1. Copied both REST-love/luajit-request and REST-love/luajit-request/luajit-request/libcurl.dll to project root running Love x64 11.3
Error: luajit-request/luajit-request/luajit-curl.lua:28: cannot load module 'libcur 
stack traceback: 
        [string "boot.lua"]:777: in function <[string "boot.lua"]:773> 
        [C]: in function 'load' 
        luajit-request/luajit-request/luajit-curl.lua:28: in main chunk 
        [C]: in function 'require' 
        luajit-request/luajit-request/init.lua:30: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        lib/REST-love/rest-lib/win-rest.lua:2: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/REST.lua:62: in main chunk 
        [C]: in function 'require' 
        lib/REST-love/module-loader.lua:37: in function 'requireFromLib' 
        main.lua:5: in main chunk 
        [C]: in function 'require' 
        [string "boot.lua"]:570: in function <[string "boot.lua"]:380> 
        [C]: in function 'xpcall' 
        [string "boot.lua"]:787: in function <[string "boot.lua"]:780> 
        [C]: in function 'xpcall'

So I guess your dll is x64. Also tried downloading new dlls from here but nothing changed.

Any ideas?

@daylanKifky
Copy link
Author

daylanKifky commented Dec 2, 2021

I have just found this issue in the original luajit-request repo. Will test that

@lmfff
Copy link

lmfff commented Dec 3, 2021

On the same system, I can get Simple Example in the README working by copying these files to the root of the project (where main.lua is):

  • lib/REST-love/luajit-request
  • lib/REST-love/module-loader.lua
  • libcurl.dll quoted in daylaKifky's comment

I have just found this issue in the original luajit-request repo. Will test that

@MrcSnm
Copy link
Owner

MrcSnm commented Dec 3, 2021

Humm any chance of module-loader being broken?

@daylanKifky
Copy link
Author

I would say it's broken at least in windows. In which platform did you developed/tested this package @MrcSnm ?

I'm not really familiar with lua's package search method, apart from what is described in the documentation, so I'm not sure how to deal with this problem

In my linux machine the package.path is:

./?.lua;/usr/share/luajit-2.0.5/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua

and the love.filesystem.getRequirePath() is:

?.lua;?/init.lua

I don't have a windows pc to test it there at the moment. @lmfff what are your paths?

@MrcSnm
Copy link
Owner

MrcSnm commented Dec 3, 2021

So, it seems that I found 2 problems:

One is that it feels that module-loader is unupdated, I'm doing that right now.
There is another problem that I'm requiring module-loader inside the REST-love. That is a problem because it loads module-loader twice and that makes it lose its current context.

Although I'm a bit rusty with Lua, I'm trying to update it ASAP

@MrcSnm
Copy link
Owner

MrcSnm commented Dec 4, 2021

1: module-loader is updated
2: It seems that it occurred some threading problems which I fixed right now. The only thing is that REST-love will always need to be located at lib/REST-love and it should work

@daylanKifky
Copy link
Author

great! tested #09aaf47 and it's working under linux, will try in windows asap

@lmfff
Copy link

lmfff commented Dec 10, 2021

I'm still having problems with #09aaf47 on Windows 10 64bit

  1. Following the instructions in the README and using the Simple Example code I get this error:
Error: lib/REST-love/luajit-request/luajit-request/luajit-curl.lua:28: cannot load module 'libcurl': The specified module could not be found.

stack traceback:
        [string "boot.lua"]:777: in function <[string "boot.lua"]:773>
        [C]: in function 'load'
        lib/REST-love/luajit-request/luajit-request/luajit-curl.lua:28: in main chunk
        [C]: in function 'require'
        lib/REST-love/luajit-request/luajit-request/init.lua:30: in main chunk
        [C]: in function 'require'
        lib/REST-love/module-loader.lua:73: in function 'requireFromLib'
        lib/REST-love/rest-lib/win-rest.lua:5: in main chunk
        [C]: in function 'require'
        lib/REST-love/REST.lua:62: in main chunk
        [C]: in function 'require'
        lib/REST-love/module-loader.lua:73: in function 'requireFromLib'
        main.lua:5: in main chunk
        [C]: in function 'require'
        [string "boot.lua"]:570: in function <[string "boot.lua"]:380>
        [C]: in function 'xpcall'
        [string "boot.lua"]:787: in function <[string "boot.lua"]:780>
        [C]: in function 'xpcall'
  1. I get the same error copying lib/REST-love/luajit-request/luajit-request/libcurl.dll to the root of the project

  2. I can get README Simple Example to work by copying libcurl.dll quoted in @daylanKifky comment

I have just found this issue in the original luajit-request repo. Will test that

(just replacing the dll in lib/REST-love/luajit-request/luajit-request/ still produces same error as in point 1)

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

3 participants