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

module '_cqueues' not found #11

Open
konsumer opened this issue Dec 23, 2020 · 5 comments
Open

module '_cqueues' not found #11

konsumer opened this issue Dec 23, 2020 · 5 comments

Comments

@konsumer
Copy link

konsumer commented Dec 23, 2020

I am trying to pak a small demo program that uses socket & http.request. Here is the demo-project. I am probably doing something wrong. I am sort of new to luarocks and luapak.

Here is the entry-point:

local socket = require 'socket'
local http_request = require 'http.request'

local server = assert(socket.bind('*', 0))
local ip, port = server:getsockname()

print('Please telnet to localhost on port ' .. port .. '. Give it a URL to download & run.')

function run(url)
  local headers, stream = assert(http_request.new_from_uri(url):go())
  local body = assert(stream:get_body_as_string())
  if headers:get ':status' ~= '200' then
    error(body)
  end
  local f = loadstring(body)
  return f()
end

while 1 do
  local client = server:accept()
  local url, err = client:receive()
  if not err then client:send('Downloading '..url .. '\n') end
  run(url)
  client:close()
end

It's just a small test of luasocket + http, really. I basically just want a bundled luajit + those 2 libs.

When I run this to pak it:

luapak make --lua-lib=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so

I also tried:

luapak make --lua-lib=/usr/lib/x86_64-linux-gnu/libluajit-5.1.a

It says

Missing dependencies for rattata scm-1:
   http (not installed)
   luasocket (not installed)
   cqueues (not installed)

but all of those are installed (on my system) and the script works outside of luapak. After this, it builds things (it looks like it's building the things in the list) and finishes with no errors (and a lot of warnings)

uapak: Resolving dependencies...
luapak: warn: The following modules are required, but not found:
luapak: warn:    _cqueues
luapak: warn:    _cqueues.auxlib
luapak: warn:    _cqueues.condition
luapak: warn:    _cqueues.errno
luapak: warn:    _cqueues.socket
luapak: warn:    _openssl.pkey
luapak: warn:    _openssl.rand
luapak: warn:    _openssl.ssl
luapak: warn:    _openssl.ssl.context
luapak: warn:    _openssl.x509.verify_param
luapak: warn:    bit
luapak: warn:    coroutine
luapak: warn:    math
luapak: warn:    psl
luapak: warn:    string
luapak: warn:    struct
luapak: warn:    zlib
luapak: Loading and minifying Lua modules...
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: warn: Source equivalence test failed!
luapak: Generating dist/rattata.c...
luapak: Compiling dist/rattata.o...
luapak: Linking dist/rattata...
luapak: Build completed: dist/rattata

When I try to run ./dist/rattata, I get this:

main:11384: module '_cqueues' not found:
	no field package.preload['_cqueues']
stack traceback:
	[C]: in function 'require'
	main:11384: in function <main:11383>
	[C]: in function 'require'
	main:7060: in function <main:7059>
	[C]: in function 'require'
	main:6421: in function <main:6416>
	[C]: in function 'require'
	main:11835: in main chunk

It seems like it's not finding the native stuff it built. What am I doing wrong?

@konsumer
Copy link
Author

I tried being more explicit:

luapak make --lua-lib=/usr/lib/x86_64-linux-gnu/libluajit-5.1.a --lua-impl=LuaJIT --lua-incdir=/usr/include/luajit-2.1

with same issues.

luapak's directory-structure seems sensible:

.luapak
├── bin
│   ├── rattata.lua
│   ├── rattata.lua~
│   └── rattata.lua~~
├── lib
│   ├── lua
│   │   └── 5.1
│   │       ├── bit32.a
│   │       ├── compat53
│   │       │   ├── string.a
│   │       │   ├── table.a
│   │       │   └── utf8.a
│   │       ├── _cqueues.so
│   │       ├── lpeg.a
│   │       ├── mime
│   │       │   └── core.a
│   │       ├── _openssl.a
│   │       └── socket
│   │           ├── core.a
│   │           ├── serial.a
│   │           └── unix.a
│   └── luarocks
│       └── rocks
│           ├── basexx
│           │   └── 0.4.1-1
│           │       ├── basexx-0.4.1-1.rockspec
│           │       ├── rock_manifest
│           │       └── test
│           │           ├── base32_spec.lua
│           │           ├── base64_spec.lua
│           │           ├── bit_spec.lua
│           │           ├── crockford_spec.lua
│           │           ├── hex_spec.lua
│           │           ├── url64_spec.lua
│           │           └── z85_spec.lua
│           ├── binaryheap
│           │   └── 0.4-1
│           │       ├── binaryheap-0.4-1.rockspec
│           │       ├── doc
│           │       │   └── README.md
│           │       └── rock_manifest
│           ├── bit32
│           │   └── 5.3.5.1-1
│           │       ├── bit32-5.3.5.1-1.rockspec
│           │       ├── doc
│           │       │   ├── LICENSE
│           │       │   └── README.md
│           │       └── rock_manifest
│           ├── compat53
│           │   └── 0.8-1
│           │       ├── compat53-0.8-1.rockspec
│           │       ├── doc
│           │       │   ├── LICENSE
│           │       │   └── README.md
│           │       └── rock_manifest
│           ├── cqueues
│           │   └── 20200726.51-0
│           │       ├── cqueues-20200726.51-0.rockspec
│           │       ├── doc
│           │       │   ├── art
│           │       │   │   ├── lua.pdf
│           │       │   │   └── lua.ps
│           │       │   ├── cqueues.pdf
│           │       │   └── cqueues.tex
│           │       └── rock_manifest
│           ├── fifo
│           │   └── 0.2-0
│           │       ├── doc
│           │       │   └── index.md
│           │       ├── fifo-0.2-0.rockspec
│           │       └── rock_manifest
│           ├── http
│           │   └── 0.3-0
│           │       ├── doc
│           │       │   ├── interfaces
│           │       │   │   ├── connection.md
│           │       │   │   └── stream.md
│           │       │   ├── interfaces.md
│           │       │   ├── introduction.md
│           │       │   ├── links.md
│           │       │   ├── Makefile
│           │       │   ├── metadata.yaml
│           │       │   ├── modules
│           │       │   │   ├── http.bit.md
│           │       │   │   ├── http.client.md
│           │       │   │   ├── http.compat.prosody.md
│           │       │   │   ├── http.compat.socket.md
│           │       │   │   ├── http.cookie.md
│           │       │   │   ├── http.h1_connection.md
│           │       │   │   ├── http.h1_reason_phrases.md
│           │       │   │   ├── http.h1_stream.md
│           │       │   │   ├── http.h2_connection.md
│           │       │   │   ├── http.h2_error.md
│           │       │   │   ├── http.h2_stream.md
│           │       │   │   ├── http.headers.md
│           │       │   │   ├── http.hpack.md
│           │       │   │   ├── http.hsts.md
│           │       │   │   ├── http.proxies.md
│           │       │   │   ├── http.request.md
│           │       │   │   ├── http.server.md
│           │       │   │   ├── http.socks.md
│           │       │   │   ├── http.tls.md
│           │       │   │   ├── http.util.md
│           │       │   │   ├── http.version.md
│           │       │   │   ├── http.websocket.md
│           │       │   │   └── http.zlib.md
│           │       │   ├── modules.md
│           │       │   ├── README.md
│           │       │   ├── site.css
│           │       │   └── template.html
│           │       ├── http-0.3-0.rockspec
│           │       └── rock_manifest
│           ├── lpeg
│           │   └── 1.0.2-1
│           │       ├── lpeg-1.0.2-1.rockspec
│           │       └── rock_manifest
│           ├── lpeg_patterns
│           │   └── 0.5-0
│           │       ├── doc
│           │       │   ├── LICENSE.md
│           │       │   └── README.md
│           │       ├── lpeg_patterns-0.5-0.rockspec
│           │       └── rock_manifest
│           ├── luaossl
│           │   └── 20200709-0
│           │       ├── doc
│           │       │   ├── luaossl.pdf
│           │       │   └── luaossl.tex
│           │       ├── luaossl-20200709-0.rockspec
│           │       └── rock_manifest
│           ├── luasocket
│           │   └── 3.0rc1-2
│           │       ├── doc
│           │       │   ├── dns.html
│           │       │   ├── ftp.html
│           │       │   ├── http.html
│           │       │   ├── index.html
│           │       │   ├── installation.html
│           │       │   ├── introduction.html
│           │       │   ├── ltn12.html
│           │       │   ├── lua05.ppt
│           │       │   ├── luasocket.png
│           │       │   ├── mime.html
│           │       │   ├── reference.css
│           │       │   ├── reference.html
│           │       │   ├── smtp.html
│           │       │   ├── socket.html
│           │       │   ├── tcp.html
│           │       │   ├── udp.html
│           │       │   └── url.html
│           │       ├── etc
│           │       │   ├── b64.lua
│           │       │   ├── check-links.lua
│           │       │   ├── check-memory.lua
│           │       │   ├── cookie.lua
│           │       │   ├── dict.lua
│           │       │   ├── dispatch.lua
│           │       │   ├── eol.lua
│           │       │   ├── forward.lua
│           │       │   ├── get.lua
│           │       │   ├── links
│           │       │   ├── lp.lua
│           │       │   ├── qp.lua
│           │       │   ├── README
│           │       │   └── tftp.lua
│           │       ├── luasocket-3.0rc1-2.rockspec
│           │       ├── rock_manifest
│           │       ├── samples
│           │       │   ├── cddb.lua
│           │       │   ├── daytimeclnt.lua
│           │       │   ├── echoclnt.lua
│           │       │   ├── echosrvr.lua
│           │       │   ├── listener.lua
│           │       │   ├── lpr.lua
│           │       │   ├── mclisten.lua
│           │       │   ├── mcsend.lua
│           │       │   ├── README
│           │       │   ├── talker.lua
│           │       │   └── tinyirc.lua
│           │       └── test
│           │           ├── auth
│           │           │   └── index.html
│           │           ├── cgi
│           │           │   ├── cat
│           │           │   ├── cat-index-html
│           │           │   ├── env
│           │           │   ├── query-string
│           │           │   ├── redirect-loop
│           │           │   └── request-uri
│           │           ├── dicttest.lua
│           │           ├── excepttest.lua
│           │           ├── find-connect-limit
│           │           ├── ftptest.lua
│           │           ├── hello.lua
│           │           ├── httptest.lua
│           │           ├── index.html
│           │           ├── ltn12test.lua
│           │           ├── luasocket.png
│           │           ├── mimetest.lua
│           │           ├── README
│           │           ├── smtptest.lua
│           │           ├── stufftest.lua
│           │           ├── tcp-getoptions
│           │           ├── test_bind.lua
│           │           ├── testclnt.lua
│           │           ├── test_getaddrinfo.lua
│           │           ├── testmesg.lua
│           │           ├── test_socket_error.lua
│           │           ├── testsrvr.lua
│           │           ├── testsupport.lua
│           │           ├── tftptest.lua
│           │           ├── udpconnectclnt.lua
│           │           ├── udpconnectsrvr.lua
│           │           ├── udp-zero-length-send
│           │           ├── udp-zero-length-send-recv
│           │           ├── unixclnt.lua
│           │           ├── unixsrvr.lua
│           │           ├── upload.html
│           │           ├── urltest.lua
│           │           ├── utestclnt.lua
│           │           └── utestsrvr.lua
│           ├── manifest
│           └── rattata
│               └── scm-1
│                   ├── bin
│                   │   └── rattata.lua
│                   ├── doc
│                   │   ├── LICENSE
│                   │   └── README.md
│                   ├── rattata-scm-1.rockspec
│                   └── rock_manifest
└── share
    └── lua
        └── 5.1
            ├── basexx.lua
            ├── binaryheap.lua
            ├── compat53
            │   ├── init.lua
            │   └── module.lua
            ├── cqueues
            │   ├── auxlib.lua
            │   ├── condition.lua
            │   ├── dns
            │   │   ├── config.lua
            │   │   ├── hints.lua
            │   │   ├── hosts.lua
            │   │   ├── packet.lua
            │   │   ├── record.lua
            │   │   ├── resolver.lua
            │   │   └── resolvers.lua
            │   ├── dns.lua
            │   ├── errno.lua
            │   ├── notify.lua
            │   ├── promise.lua
            │   ├── signal.lua
            │   ├── socket.lua
            │   └── thread.lua
            ├── cqueues.lua
            ├── fifo.lua
            ├── http
            │   ├── bit.lua
            │   ├── client.lua
            │   ├── compat
            │   │   ├── prosody.lua
            │   │   └── socket.lua
            │   ├── connection_common.lua
            │   ├── cookie.lua
            │   ├── h1_connection.lua
            │   ├── h1_reason_phrases.lua
            │   ├── h1_stream.lua
            │   ├── h2_connection.lua
            │   ├── h2_error.lua
            │   ├── h2_stream.lua
            │   ├── headers.lua
            │   ├── hpack.lua
            │   ├── hsts.lua
            │   ├── proxies.lua
            │   ├── request.lua
            │   ├── server.lua
            │   ├── socks.lua
            │   ├── stream_common.lua
            │   ├── tls.lua
            │   ├── util.lua
            │   ├── version.lua
            │   ├── websocket.lua
            │   └── zlib.lua
            ├── lpeg_patterns
            │   ├── core.lua
            │   ├── email.lua
            │   ├── http.lua
            │   ├── IPv4.lua
            │   ├── IPv6.lua
            │   ├── language.lua
            │   ├── phone.lua
            │   ├── uri.lua
            │   └── util.lua
            ├── ltn12.lua
            ├── mime.lua
            ├── openssl
            │   ├── auxlib.lua
            │   ├── bignum.lua
            │   ├── cipher.lua
            │   ├── des.lua
            │   ├── digest.lua
            │   ├── hmac.lua
            │   ├── kdf.lua
            │   ├── ocsp
            │   │   ├── basic.lua
            │   │   └── response.lua
            │   ├── pkcs12.lua
            │   ├── pkey.lua
            │   ├── pubkey.lua
            │   ├── rand.lua
            │   ├── ssl
            │   │   └── context.lua
            │   ├── ssl.lua
            │   ├── x509
            │   │   ├── altname.lua
            │   │   ├── chain.lua
            │   │   ├── crl.lua
            │   │   ├── csr.lua
            │   │   ├── extension.lua
            │   │   ├── name.lua
            │   │   ├── store.lua
            │   │   └── verify_param.lua
            │   └── x509.lua
            ├── openssl.lua
            ├── rattata.lua
            ├── re.lua
            ├── socket
            │   ├── ftp.lua
            │   ├── headers.lua
            │   ├── http.lua
            │   ├── smtp.lua
            │   ├── tp.lua
            │   └── url.lua
            └── socket.lua

67 directories, 270 files

@konsumer
Copy link
Author

Additionally, I tried using a pure-lua (via ffi) socket-library: https://github.com/CapsAdmin/luajitsocket

Here is my rockspec:

package = "rattata"
version = "scm-1"

source = {
   url = "https://github.com/notnullgames/rattata.git"
}

description = {
   detailed = "![rattata](https://cdn.bulbagarden.net/upload/thumb/4/46/019Rattata.png/500px-019Rattata.png)",
   homepage = "https://github.com/notnullgames/rattata",
   license = "MIT"
}

dependencies = {
}

build = {
   type = "builtin",
   modules = {
      rattata = "src/rattata.lua",
      ["src.ljsocket"] = "src/ljsocket.lua"
   },
   
   install = {
      bin = {
        "src/rattata.lua"
      }
   }
}

and it seems to be leaving out ffi.

luapak make --lua-lib=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so
luapak: Building /home/konsumer/Documents/otherdev/pakemon/rattata/./rattata-scm-1.rockspec (.)
No existing manifest. Attempting to rebuild...
rattata scm-1 is now installed in /home/konsumer/Documents/otherdev/pakemon/rattata/.luapak (license: MIT)

luapak: Resolving dependencies...
luapak: warn: The following modules are required, but not found:
luapak: warn:    ffi
luapak: Loading and minifying Lua modules...
luapak: Generating dist/rattata.c...
luapak: Compiling dist/rattata.o...
luapak: Linking dist/rattata...
luapak: Build completed: dist/rattata
./dist/rattata
main:11: libdl is not implemented
stack traceback:
	[C]: in function '__index'
	main:11: in function 'o'
	main:242: in function <main:2>
	[C]: in function 'require'
	main:575: in main chunk

@Olical
Copy link

Olical commented May 4, 2021

Did you ever manage to work this out? Guessing not since there wasn't a follow up but I'm stuck on something similar, I have a few things building and working but once I introduced luasocket I ran into issues of not being able to load package.preload['socket.core'] at runtime, the build it self seems kinda healthy if I ignore all the warnings.

@konsumer
Copy link
Author

konsumer commented May 4, 2021

No, I ended up just not using luapak.

@Olical
Copy link

Olical commented May 5, 2021

Thanks for the response! I think I should give up too but I'm not sure what my alternatives will be... possibly using a system Lua (locked to 5.1 so will cause other issues with cqueues 🙃).

Pretty stuck! Thanks again though, useful to know.

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

2 participants