Code Monkey home page Code Monkey logo

Comments (5)

houqp avatar houqp commented on September 18, 2024 1

Looks like you are using docker in Mac? There are two options to run GUI program in docker:

  1. run a vnc server in side the container
  2. export the host X11 socket into the container

You can read more about it at: http://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container

from koreader-base.

apletnev avatar apletnev commented on September 18, 2024

Yes, i use docker in Mac. But the problem with SDL library, not X11 socket.
I've used next article: https://fredrikaverpil.github.io/2016/07/31/docker-for-mac-and-gui-applications/

➜  baseimage git:(master) ✗ make shell
docker run --detach-keys "ctrl-q,ctrl-q" -e DISPLAY=192.168.1.195 -v /tmp/.X11-unix:/tmp/.X11-unix -v /Users/apletnev/Projects/kodev:/home/ko/kodev --rm -t -i apletnev/kobase:0.0.5 bash -l
ko@d1e561ba58c2:~$ env
HOSTNAME=d1e561ba58c2
TERM=xterm
PATH=/home/ko/x-tools/arm-kobo-linux-gnueabihf/bin:/home/ko/x-tools/arm-kindlepw2-linux-gnueabi/bin:/home/ko/x-tools/arm-kindle5-linux-gnueabi/bin:/home/ko/x-tools/arm-kindle-linux-gnueabi/bin:/home/ko/.luarocks/bin:/home/ko/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/ko
LUA_PATH=/home/ko/.luarocks/share/lua/5.1/?.lua;/home/ko/.luarocks/share/lua/5.1/?/init.lua;/home/ko/local/share/lua/5.1/?.lua;/home/ko/local/share/lua/5.1/?/init.lua;./?.lua;/home/ko/local/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua
LUA_CPATH=/home/ko/.luarocks/lib/lua/5.1/?.so;/home/ko/local/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
SHLVL=1
HOME=/home/ko
no_proxy=*.local, 169.254/16
DISPLAY=192.168.1.195
_=/usr/bin/env
ko@d1e561ba58c2:~$ ls
install_luarocks.sh  kodev  local
ko@d1e561ba58c2:~$ cd kodev/koreader/
ko@d1e561ba58c2:~/kodev/koreader$ ./kodev run
[*] Building KOReader...
make -C base
make[1]: Entering directory `/home/ko/kodev/koreader/base'
# set up some needed paths and links
install -d build/x86_64-linux-gnu/{cache,history,clipboard,fonts} /home/ko/kodev/koreader/base/build/x86_64-linux-gnu/plugins/evernote.koplugin/thrift
ln -sf /home/ko/kodev/koreader/base/thirdparty/kpvcrlib/cr3.css build/x86_64-linux-gnu/data/
# setup Evernote SDK
cd /home/ko/kodev/koreader/base/thirdparty/evernote-sdk-lua/build/x86_64-linux-gnu/evernote-sdk-lua-prefix/src/evernote-sdk-lua && \
        cp -r *.lua evernote /home/ko/kodev/koreader/base/build/x86_64-linux-gnu/plugins/evernote.koplugin && \
        cp thrift/*.lua /home/ko/kodev/koreader/base/build/x86_64-linux-gnu/plugins/evernote.koplugin/thrift
test -e build/x86_64-linux-gnu/rocks/share/lua/5.1/re.lua && chmod 664 build/x86_64-linux-gnu/rocks/share/lua/5.1/re.lua || true  # hot fix re.lua permission
make[1]: Leaving directory `/home/ko/kodev/koreader/base'
install -d koreader-emulator-x86_64-linux-gnu/koreader
rm -f koreader-emulator-x86_64-linux-gnu/koreader/git-rev; echo v2015.11-658-g683b038 > koreader-emulator-x86_64-linux-gnu/koreader/git-rev
cp -f base/ev_replay.py koreader-emulator-x86_64-linux-gnu/koreader/
[*] create symlink instead of copying files in development mode
cd koreader-emulator-x86_64-linux-gnu/koreader && \
        ln -sf ../../base/build/x86_64-linux-gnu/* .
[*] install front spec only for the emulator
cd koreader-emulator-x86_64-linux-gnu/koreader/spec && test -e front || \
        ln -sf ../../../../spec ./front
cd koreader-emulator-x86_64-linux-gnu/koreader/spec/front/unit && test -e data || \
        ln -sf ../../test ./data
for f in reader.lua frontend resources defaults.lua datastorage.lua l10n tools README.md COPYING; do \
        ln -sf ../../$f koreader-emulator-x86_64-linux-gnu/koreader/; \
    done
[*] Install plugins
cp -r plugins/* koreader-emulator-x86_64-linux-gnu/koreader/plugins/
[*] Installresources
cp -r -pL resources/fonts/* koreader-emulator-x86_64-linux-gnu/koreader/fonts/
install -d koreader-emulator-x86_64-linux-gnu/koreader/{screenshots,data/{dict,tessdata},fonts/host,ota}
[*] Running KOReader with arguments: ...
~/kodev/koreader/koreader-emulator-x86_64-linux-gnu/koreader ~/kodev/koreader
---------------------------------------------
                launching...
  _  _____  ____                _
 | |/ / _ \|  _ \ ___  __ _  __| | ___ _ __
 | ' / | | | |_) / _ \/ _` |/ _` |/ _ \ '__|
 | . \ |_| |  _ <  __/ (_| | (_| |  __/ |
 |_|\_\___/|_| \_\___|\__,_|\__,_|\___|_|

 [*] Current time: 11/13/16-16:22:32

./luajit: ./ffi/SDL2_0.lua:38: cannot initialize SDL
stack traceback:
    [C]: in function 'error'
    ./ffi/SDL2_0.lua:38: in function 'open'
    ./ffi/framebuffer_SDL2_0.lua:13: in function 'init'
    ./ffi/framebuffer.lua:59: in function 'new'
    frontend/device/sdl/device.lua:36: in function 'init'
    frontend/device.lua:39: in main chunk
    [C]: in function 'require'
    frontend/ui/uimanager.lua:1: in main chunk
    [C]: in function 'require'
    ./reader.lua:111: in main chunk
    [C]: at 0x00404dc0
~/kodev/koreader
ko@d1e561ba58c2:~/kodev/koreader$

from koreader-base.

houqp avatar houqp commented on September 18, 2024

Are you able to run xeyes from within the container?

To get the actual error message from SDL, we need to define SDL_GetError() through ffi.cdef, then call it after SDL_Init returns negative value on line 38 in SDL_GetError(). You can find the function signature from their documentation: https://wiki.libsdl.org/SDL_GetError

from koreader-base.

apletnev avatar apletnev commented on September 18, 2024

Sorry for misleading. I've figured out what happened. Unfortunately docker without virtualbox can't pass x stream to host without virtual network (OSX). So currently it is impossible to use x stream without virtual machine.

from koreader-base.

houqp avatar houqp commented on September 18, 2024

Yeah, running docker on mac does not give you much benefit since it's still a VM. You will only get a performance boost on Linux.

from koreader-base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.