Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Dockerfile request #7

Closed
ShawnMilo opened this issue Mar 17, 2015 · 6 comments
Closed

Dockerfile request #7

ShawnMilo opened this issue Mar 17, 2015 · 6 comments

Comments

@ShawnMilo
Copy link
Contributor

Regarding the compile issues described in issue #2:

If someone is able to get an environment set up that enables them to build the project, and is feeling generous, please create a Dockerfile that builds it, perhaps using the official "golang" Docker image as the base.

This would allow more people to contribute to the project, especially those who have trouble dealing with the dependencies, or simply don't want to add the various dependencies to their own machines.

@ben-clayton
Copy link
Member

Hi @ShawnMilo - I've made a couple of pushes today that mean GLEW is no longer a dependency, arial is now the default font, and the OS font directory is now searched. Please give this a try - let me know if there's still issues for you.

@ShawnMilo
Copy link
Contributor Author

Thanks. In a fresh golang container, the build fails due to GL dependencies. I'm going to see if there's an easy fix. In the meantime, here is the output from my attempt:

$ docker run -it --rm golang /bin/bash
root@e4feff5f8ad7:/go# go get github.com/google/gxui    
root@e4feff5f8ad7:/go# cd src/github.com/google/gxui/samples/progress_bar/
root@e4feff5f8ad7:/go/src/github.com/google/gxui/samples/progress_bar# go get
# github.com/go-gl/glfw/v3.1/glfw
In file included from ../../../../go-gl/glfw/v3.1/glfw/context.go:4:0:
glfw/include/GLFW/glfw3.h:185:21: fatal error: GL/gl.h: No such file or directory
   #include <GL/gl.h>
                     ^
compilation terminated.
# github.com/go-gl/gl/v3.2-core/gl
../../../../go-gl/gl/v3.2-core/gl/procaddr.go:52:21: fatal error: GL/glx.h: No such file or directory
  #include <GL/glx.h>
                     ^
compilation terminated.

@ShawnMilo
Copy link
Contributor Author

Update:

Was able to install gl.h by installing mesa-common-dev. Then it was missing Xrandr.h. Fixed by installing libxrandr-dev. Then missing Xcursor.h, needed libxcursor-dev. Then xf86vmode.h (installed libxxf86vm-dev). Then XInput2.h. Installed libxi-dev. Then Xinerama.h. Installed libghc-x11-dev.

After all that, now I get this error, and I don't know how to fix it. I did a Google search on the error and found similar issues, but wasn't able to adapt them to solve this issue.

root@e4feff5f8ad7:/go/src/github.com/google/gxui/samples/progress_bar# go get
# github.com/go-gl/gl/v3.2-core/gl
/usr/bin/ld: cannot find -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
# github.com/go-gl/glfw/v3.1/glfw
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status

@ben-clayton
Copy link
Member

Have you tried the libgl1-mesa-dev package?

@ShawnMilo
Copy link
Contributor Author

Thanks, Ben. That solves my go get problems. I'm now getting an execution error due to the Arial font, but I'll open a separate ticket for that.

Working Dockerfile:

FROM golang 
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install libgl1-mesa-dev libxrandr-dev libxcursor-dev libxi-dev libghc-x11-dev -y
RUN go get github.com/google/gxui
WORKDIR src/github.com/google/gxui/samples/progress_bar/
RUN go get
RUN go build
CMD /bin/bash

To run:

Builds container. Replace gxui with anything you like. Have Dockerfile in the current working directory.
docker build -t gxui .

To use (will delete container upon exit):
docker run -it --rm gxui

To mount a volume (so you can compile a binary and copy it to the host system):

mkdir /tmp/gxui
docker run -it --rm -v /tmp/gxui:/gxui gxui

@ShawnMilo
Copy link
Contributor Author

There is now a Dockerfile that allows a build, so this issue is satisfied.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants