openai / go-vncdriver

Fast VNC driver
MIT License
123 stars 59 forks source link

Can't find -lGL while building go-vncserver, symlink issue? #26

Open arsenious opened 7 years ago

arsenious commented 7 years ago

Hi everyone

I'm trying to install Universe on a GTX1080 Ubuntu 14.04 Desktop. I'd like to have OpenGL rendering. However I was getting the "VNC server not built using OpenGL error", so I'm reinstalling go-vncserver.

However, I'm getting the following error:

(universe) exx@ubuntu:~/go-vncdriver$ python3 build.py 
Env info:

export GOPATH='/home/exx/go-vncdriver/.build'
export GO15VENDOREXPERIMENT='1'
export CGO_CFLAGS='-I/home/exx/anaconda2/envs/universe/lib/python3.6/site-packages/numpy/core/include -I/home/exx/anaconda2/envs/universe/include/python3.6m'
export CGO_LDFLAGS='/usr/lib/x86_64-linux-gnu/libjpeg.so -L/home/exx/anaconda2/envs/universe/lib -lpython3.6m'

Running build with OpenGL rendering.
Building with OpenGL: GOPATH=/home/exx/go-vncdriver/.build go build -buildmode=c-shared -o go_vncdriver.so github.com/openai/go-vncdriver. (Set GO_VNCDRIVER_NOGL to build without OpenGL.)
# github.com/openai/go-vncdriver/vendor/github.com/go-gl/glfw/v3.2/glfw
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
# github.com/openai/go-vncdriver/vendor/github.com/go-gl/gl/v2.1/gl
/usr/bin/ld: cannot find -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status

Note: could not build with OpenGL rendering (cf https://github.com/openai/go-vncdriver). This is expected on most servers. Going to try building without OpenGL. Building without OpenGL: GOPATH=/home/exx/go-vncdriver/.build go build -tags no_gl -buildmode=c-shared -o go_vncdriver.so github.com/openai/go-vncdriver

I'm relatively new to Linux. But from what I understand, I think there should be some sort of a shortcut/symbolic link perhaps that could resolve this. Becuase I do have openGL installed.


(universe) exx@ubuntu:~/go-vncdriver$ glxinfo | grep versionserver glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.3.0 NVIDIA 375.26
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL version string: 4.5.0 NVIDIA 375.26
OpenGL shading language version string: 4.50 NVIDIA

Also in the /usr/bin/ folder, I have an ld shortcut that links to ld.bfd

Please help. Thanks

arsenious commented 7 years ago

I tried stuff given here https://github.com/openai/go-vncdriver/issues/14 and here https://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html

For the 1st one, please can you tell me how to update to go 1.7? I tried using apt-get but it says its the latest version Yet the version is (universe) exx@ubuntu:~$ go version go version go1.6 linux/amd64

For the 2nd link, I can see that I have libGL.so at several places. But what about -lGL ? I'm relatively new to Linux so please could you tell what should be the name of the symbolic link and what it should point to? I have mesa folder

arsenious commented 7 years ago

Also, I tried the following based on https://github.com/openai/universe/issues/42

(universe)` exx@ubuntu:~$ go get -u github.com/go-gl/examples/gl21-cube
package github.com/go-gl/examples/gl21-cube: cannot download, $GOPATH not set. For more details see: go help gopath
(universe) exx@ubuntu:~$ mkdir -p $HOME/go
(universe) exx@ubuntu:~$ export GOPATH=$HOME/go
(universe) exx@ubuntu:~$ export PATH=$PATH:$GOPATH/bin
(universe) exx@ubuntu:~$ go get -u github.com/go-gl/examples/gl21-cube
# github.com/go-gl/glfw/v3.2/glfw
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
# github.com/go-gl/gl/v2.1/gl
/usr/bin/ld: cannot find -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
arsenious commented 7 years ago

Ok so after gaining some more understanding into symlinks, I finally fixed the issue. So basically there were a whole lot of libGL.so.* , all pointing to other similarly named files. But all were tiny files i.e. shortcuts. For some reason, the real file was not on my system. So I took a copy of a libGL file from another system (where default NVIDIA OpenGL was installed and untouched by mesa) but this one was .5 Mb i.e. a real file and not just a shortcut. And then created a symlink to point to this newly acquired file.

Detailed steps that I did (You may need to modify accordingly):

1) Look for a file named libGL.so* that isn't just a shortcut. If you can't find it on your PC(like me), you can take it from someone else or download from here https://github.com/arsenious/libGL_for_go-vncdriver_universe

2) Place the file inside mesa folder like this:

sudo cp ~/Downloads/libGL.so.1.2.0 /usr/lib/x86_64-linux-gnu/mesa/

3) Go to mesa folder and the ls to confirm it's there

 cd /usr/lib/x86_64-linux-gnu/mesa
ls

which showed : ld.so.conf libGL.so libGL.so.1.2.0

4) That libGL.so (shortcut) was already there but is was broken. I re-directed it to this newly acquired libGL

sudo ln -s libGL.so.1.2.0 libGL.so

5) Now move one folder up i.e. to /usr/lib/x86_64-linux-gnu/ Here I already had a libGL.so link that was in fact pointing to the libGL.so link inside the mesa folder. So I didn't have to take any further steps. But in case it isn't, then make that libGL.so point to the libGL.so inside the mesa folder.

So finally we have libGL.so(in the x86_64-linux-gnu/ folder) pointing to libGL.so (inside x86_64-linux-gnu/mesa ) which is finally pointing to libGL.so.1.2.0 (also inside the mesa folder but actually contains the file)

Build go-vncdriver as before and install it. It shouldn't give any error. Then install universe.