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

How to run on linux #1

Open
duramato opened this issue Jul 10, 2022 · 5 comments
Open

How to run on linux #1

duramato opened this issue Jul 10, 2022 · 5 comments

Comments

@duramato
Copy link

I'm trying to run this on linux, but I'm not being able to, either via lua or via wine.

@ivan386
Copy link
Owner

ivan386 commented Jul 11, 2022

Open command line in lua-dht directory and run command:
wine start ./start.cmd

@ivan386 ivan386 changed the title Still maintained? How to run on linux Jul 11, 2022
@duramato
Copy link
Author

duramato commented Jul 11, 2022

That shows `

# wine start ./start.cmd
~/lua-dht# err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.

If I try to run lua directly from wine it throws an error:

# wine lua5.1.exe lua/dht.lua > msgs.txt
Z:\root\lua-dht\lua5.1.exe: lua/dht.lua:834: attempt to call global 'on_error' (a nil value)
stack traceback:
        lua/dht.lua:834: in main chunk
        [C]: ?

@ivan386
Copy link
Owner

ivan386 commented Jul 11, 2022

On first command lua show error but programm is run. Second command fail because port is already assigned.

Need to stop lua first and try second command.

@duramato
Copy link
Author

duramato commented Mar 7, 2023

I just ended up creating a docker container to sort any issues with ports, which seems to have worked.

Here's the dockerfile should anyone want it.

FROM i386/ubuntu:latest

RUN dpkg --add-architecture i386 && \
    apt-get update && \
    apt-get install -y xvfb wine32 git make gcc g++ lua5.3 lua5.3-dev && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/ivan386/lua-dht.git \
    && cd lua-dht

WORKDIR /lua-dht

RUN sed -i 's|bind.\"127.0.0.1\"|bind\("0.0.0.0"|g' lua/dht.lua

EXPOSE 6543

CMD ["wine", "lua5.1.exe", "lua/dht.lua"]

On another note, it seems that sometimes it just hangs with no aparent reason, as there's nothing extraordinary on the logging. Have you ever experienced something like this?

Here's a relevant snippet of the logging before it hangs: https://gist.github.com/duramato/a8fe100f67b4ea9f11c2c9181696863b

@duramato
Copy link
Author

It seems to crash when there's a large ammout of peers, altough I can't be sure. The logs don't seem to mention anything relevant except for the traceback.

Here's the traceback from dht_error.log:

Z:\lua-dht\lua\compact_encoding.lua:40: bad argument #1 to 'mod' (number expected, got nil)
stack traceback:
        [C]: in function 'mod'
        Z:\lua-dht\lua\compact_encoding.lua:40: in function 'encode_port'
        Z:\lua-dht\lua\compact_encoding.lua:52: in function 'encode_peer'
        lua/dht.lua:664: in function 'add_peer'
        lua/dht.lua:472: in function <lua/dht.lua:422>
        (tail call): ?
        lua/dht.lua:82: in function <lua/dht.lua:57>

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