cguimaraes / zenoh-web-browser

Zenoh-based web browsing proof-of-concept
GNU General Public License v3.0
1 stars 0 forks source link

Docker build fails on Mac OS X #1

Open Mallets opened 3 years ago

Mallets commented 3 years ago

When I try to build zenoh-web-browser on Mac OS X I get the following error:

$ docker build .

...

Step 12/13 : RUN cd /home/user-docker/app &&     qmake && make
 ---> Running in dec2cc794dbd
Usage: /usr/lib/qt5/bin/qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
  -project       Put qmake into project file generation mode
                 In this mode qmake interprets [files] as files to
                 be added to the .pro file. By default, all files with
                 known source extensions are added.
                 Note: The created .pro file probably will
                 need to be edited. For example add the QT variable to
                 specify what modules are required.
  -makefile      Put qmake into makefile generation mode (default)
                 In this mode qmake interprets files as project files to
                 be processed, if skipped qmake will try to find a project
                 file in your current working directory

Warnings Options:
  -Wnone         Turn off all warnings; specific ones may be re-enabled by
                 later -W options
  -Wall          Turn on all warnings
  -Wparser       Turn on parser warnings
  -Wlogic        Turn on logic warnings (on by default)
  -Wdeprecated   Turn on deprecation warnings (on by default)

Options:
   * You can place any variable assignment in options and it will be *
   * processed as if it was in [files]. These assignments will be    *
   * processed before [files] by default.                            *
  -o file        Write output to file
  -d             Increase debug level
  -t templ       Overrides TEMPLATE as templ
  -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
  -help          This help
  -v             Version information
  -early         All subsequent variable assignments will be
                 parsed right before default_pre.prf
  -before        All subsequent variable assignments will be
                 parsed right before [files] (the default)
  -after         All subsequent variable assignments will be
                 parsed after [files]
  -late          All subsequent variable assignments will be
                 parsed right after default_post.prf
  -norecursive   Don't do a recursive search
  -recursive     Do a recursive search
  -set <prop> <value> Set persistent property
  -unset <prop>  Unset persistent property
  -query <prop>  Query persistent property. Show all if <prop> is empty.
  -qtconf file   Use file instead of looking for qt.conf
  -cache file    Use file as cache           [makefile mode only]
  -spec spec     Use spec as QMAKESPEC       [makefile mode only]
  -nocache       Don't use a cache file      [makefile mode only]
  -nodepend      Don't generate dependencies [makefile mode only]
  -nomoc         Don't generate moc targets  [makefile mode only]
  -nopwd         Don't look for files in pwd [project mode only]
The command '/bin/sh -c cd /home/user-docker/app &&     qmake && make' returned a non-zero code: 1
cguimaraes commented 3 years ago

Pushed a fix to this. Let me know if you still have the problem.

Mallets commented 3 years ago

I succesfully managed to build it on Mac OS X. However, it fails to run:

$ docker run zenoh-web-browser

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted

I'm running XQuartz as X server on Mac OS X. Am I missing something?

cguimaraes commented 3 years ago

You need to set the DISPLAY environment variable in the container by using -e option. In Ubuntu/Debian, it is enough to pass it like -e DISPLAY=$DISPLAY.

However, it seems that for Mac OS X and XQuartz you need to do additional steps (untested since I do not own a Mac OS X machine):

  1. Install the latest XQuartz X11 server and run it.
  2. Activate the option ‘Allow connections from network clients’ in XQuartz settings.
  3. Quit & restart XQuartz (to activate the setting).

Then, run the container by:

# allow access from localhost
xhost + 127.0.0.1

# run zenoh-browser with X11 forwarding and keep running until it quits
docker run -e DISPLAY=host.docker.internal:0 zenoh-browser:latest
Mallets commented 3 years ago

Thanks for the step by step instructions. Unfortunately I stumbled upon another issue:

$ docker run -e DISPLAY=host.docker.internal:0 zenoh-web-browser:latest

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user-docker'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.
Please register the custom scheme 'zenoh' via QWebEngineUrlScheme::registerScheme() before installing the custom scheme handler.
QGLXContext: Failed to create dummy context
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)

I've also followed this and the libGL errors went away. Now, I'm left with the following error:

$ docker run -e DISPLAY=host.docker.internal:0 -e LIBGL_ALWAYS_INDIRECT=1 zenoh-web-browser:latest

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user-docker'
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.
Please register the custom scheme 'zenoh' via QWebEngineUrlScheme::registerScheme() before installing the custom scheme handler.
QGLXContext: Failed to create dummy context
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
Aborted
cguimaraes commented 3 years ago

I am trying to get a Mac OS X, so that I can properly debug the problem. I will come back to you as soon as possible