pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.62k stars 518 forks source link

"Error loading module 'wx'" for the IDE runinng from a docker container #1011

Closed ge-fan closed 5 years ago

ge-fan commented 5 years ago

Hi, I get the following error, bin/linux/x64/lua: error loading module 'wx' from file 'bin/linux/x64/clibs/libwx.so': libSM.so.6: cannot open shared object file: No such file or directory stack traceback: [C]: at 0x0047e7a2 [C]: in function 'require' src/main.lua:38: in main chunk [C]: at 0x00404f08

I installed ZeroBraneStudio 1.8 via Download the snapshot of the repository. I am using Ubuntu 16.04.6 LTS and lua version 5.3.4. I I've seen your responses to this problem on Error loading module 'wx' #417, but it didn't work for me, but I tried to add the following line at line 30 in src/main.lua: print(islinux, iswindows, os.getenv('DYLD_LIBRARY_PATH'), io.open("/proc"), package.cpath) os.exit() After running ./zbstudio.sh, it showed, true nil nil file (0x0252d010) ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so

What configuration is needed for my Linux to fix the error?

pkulchenko commented 5 years ago

@ge-fan; can you run ldd bin/linux/x64/clibs/libwx.so | grep libSM and check if the target file is present on your machine? What does uname -a show?

If looks like libSM (which is X session management library) is missing on your machine for some reason. You may try to fix it with sudo apt-get install libsm6 command.

ge-fan commented 5 years ago

After running, I get,

ldd bin/linux/x64/clibs/libwx.so | grep libSM

libSM.so.6 => not found

uname -a

Linux 17122a3365a3 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux So I have to install libsm6

apt-get install libsm6

and then I ran the above command again,

ldd bin/linux/x64/clibs/libwx.so | grep libSM

libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f66d63f8000)

Now I tried to open the IDE using zbstudio.sh, I get the error below,

./zbstudio.sh

18:37:52: Error: Unable to initialize GTK+, is DISPLAY set properly?

wxLuaModule - Error calling wxEntryStart(argc, argv), aborting. bin/linux/x64/lua: src/util.lua:10: attempt to index global 'wx' (a nil value) stack traceback: src/util.lua:10: in function 'GetPathSeparator' src/util.lua:14: in main chunk [C]: in function 'dofile' src/main.lua:43: in main chunk [C]: at 0x00404f08

How do I initialize GTK+ or set DISPLAY?

pkulchenko commented 5 years ago

It seems like you are using linuxkit; are you trying to run the IDE inside a docker container? What would be the purpose of this if it doesn't have a display attached?

If you really want to do this, you'll have to do something similar to what is described in this article: https://medium.com/dot-debug/running-chrome-in-a-docker-container-a55e7f4da4a8. As described there, you'll have to configure and use Xvfb:

Xvfb is an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.

ge-fan commented 5 years ago

Yes, It is a docker container and is easy to use the same configuration setup in different machines or delete the container and reload it for test purposes in a clean environment. I will look through the article to try it again.

ge-fan commented 5 years ago

Instead of using Xvfb, I am using X11 from host machine of my MacBook Pro. Now I do $ export DISPLAY="host.docker.internal:0" and I have the ZeroBraneStudio IDE opened, but the IDE font is in huge size, for example, only File, Edit, and Search on the top menu bar could be shown. What will it be changed somewhere?

pkulchenko commented 5 years ago

It looks like the resolution or DPI is not properly set (as the IDE itself doesn't have any control over those settings). Try calling xrandr --display :0 --output VGA1 --mode 800x600 (according to this SO answer). Output may also be HDMI1. If this doesn't work, at least it will give you some direction in which to research.

Please post an answer if you find one.

ge-fan commented 5 years ago

In the current docker container Ubuntu Linux, I installed xrandr and tried the command you suggested,

$ sudo apt-get install x11-xserver-utils ... ... $ xrandr --display :0 --output VGA1 --mode 800x600 Can't open display :0`

because I exported the display to "host.docker.internal:0". And I queried the current display,

$ xrandr -q xrandr: Failed to get size of gamma for output default Screen 0: minimum 640 x 480, current 1920 x 1958, maximum 3360 x 1980 default connected 1920x1958+0+0 0mm x 0mm 2880x1800 60.00 1440x900 60.00 2.00 1.00 2560x1600 60.00 2048x1280 60.00 1024x768 60.00 75.00 800x600 60.00 75.00 2.00 640x480 60.00 75.00 1680x1050 60.00 1280x800 60.00 1920x1958 1.00* 1920x1980 2.00 1440x878 1.00 1920x1080 60.00 2.00 50.00 1280x1024 75.00 60.00 1024x576 60.00 1344x1008 60.00 1600x900 60.00 1920x1058 1.00 1280x720 60.00 50.00 3360x1058 1.00 3360x1080 2.00 720x480 60.00 720x576 50.00 1280x960 60.00 1344x756 60.00 1440x922 2.00 800x578 1.00 `

I also tried to run command xrandr -s 800x600, but I got a black screen. After shutdown and restart the machine (MacBook Pro), I stopped, deleted the docker container, and started a brand new docker container. Follow the above instructions to install ZeroBraneStudio and libsm6, and set DISPLAY, then run ./zbstudio.sh.

$ sudo apt-get update $ sudo apt-get install libsm6 $ export DISPLAY="host.docker.internal:0" $ ./zbstudio.sh

The ZeroBraneStudio IDE got opened with normal font sizes!

pkulchenko commented 5 years ago

@ge-fan, great that you got it working; thank you for the update!