I’ve installed VirtualGL and TurboVNC in my Jetson Nano. I followed and adapted the tutorial that do the same but on the Jetson TK1 :
and also this script that does not work out of the box :
On this cezs github there are two scripts that should be modified a little bit and also some packages should be installed before running these scripts. Below there are the scripts modified by me :
nv_nano_build_and_install_vgl_and_vnc.sh :
# Built VirtualGL, TurboVNC and libjpeg-turbo for 64-bit Linux / Jetson nano / For Tegra R32.4.2
#
# Largely based on https://devtalk.nvidia.com/default/topic/828974/jetson-tk1/-howto-install-virtualgl-and-turbovnc-to-jetson-tk1/2
#
rm -r tmp
mkdir tmp
cd tmp
currentDir=$(pwd)
# DEPENDENCIES
# install necessary packages to build them.
sudo apt-get install git
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install cmake
sudo apt-get install g++
sudo apt-get install libpam0g-dev
sudo apt-get install libssl-dev
sudo apt-get install libjpeg-turbo8-dev libjpeg8-dev libturbojpeg0-dev
sudo apt-get install ocl-icd-opencl-dev
# upgrade CMAKE
wget https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5.tar.gz
tar -zxvf cmake-3.16.5.tar.gz
cd cmake-3.16.5
./bootstrap
make
make install
# LIBJPEG-TURBO
wget http://launchpadlibrarian.net/482987839/libturbojpeg_1.5.2-0ubuntu5.18.04.4_arm64.deb
dpkg -i libturbojpeg_1.5.2-0ubuntu5.18.04.4_arm64.deb
# Build and install libjpeg-turbo
#git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
#mkdir libjpeg-turbo-build
#cd libjpeg-turbo
#autoreconf -fiv
#cd ../libjpeg-turbo-build
#sh ../libjpeg-turbo/configure
#make
# Change "DEBARCH=aarch64" to "DEBARCH=arm64"
#sed -i 's/aarch64/arm64/g' pkgscripts/makedpkg.tmpl
#make deb
#sudo dpkg -i libjpeg-turbo_1.5.2_arm64.deb
#cd ../
# VIRTUALGL
# Preventing link error from "libGL.so", check this:
# https://devtalk.nvidia.com/default/topic/946136/jetson-tx1/building-an-opengl-application/
#cd /usr/lib/aarch64-linux-gnu
#sudo rm libGL.so
#sudo ln -s /usr/lib/aarch64-linux-gnu/tegra/libGL.so libGL.so
# Build and install VirtualGL
cd $currentDir
git clone https://github.com/VirtualGL/virtualgl.git
mkdir virtualgl-build
cd virtualgl-build
cmake -G "Unix Makefiles" -DTJPEG_LIBRARY="-L/usr/lib/ -lturbojpeg" ../virtualgl
make
# Change "DEBARCH=aarch64" to "DEBARCH=arm64"
sed -i 's/aarch64/arm64/g' pkgscripts/makedpkg
# Change "Architecture: aarch64" to "Architecture: arm64"
sed -i 's/aarch64/arm64/g' pkgscripts/deb-control
make deb
# sudo dpkg -i virtualgl_2.5.2_arm64.deb
cd ..
# TURBOVNC
# Build and install TurboVNC
git clone https://github.com/TurboVNC/turbovnc.git
mkdir turbovnc-build
cd turbovnc-build
cmake -G "Unix Makefiles" -DTVNC_BUILDJAVA=0 -DTJPEG_LIBRARY="-L/usr/lib/ -lturbojpeg" ../turbovnc
# Prevent error like #error "GLYPHPADBYTES must be 4",
# edit ../turbovnc/unix/Xvnc/programs/Xserver/include/servermd.h
# and prepend before "#ifdef __avr32__"
#servermd="$currentDir/turbovnc/unix/Xvnc/programs/Xserver/include/servermd.h"
#line="#ifdef __avr32__"
#defs="#ifdef __aarch64__\n\
# define IMAGE_BYTE_ORDER LSBFirst\n\
# define BITMAP_BIT_ORDER LSBFirst\n\
# define GLYPHPADBYTES 4\n\
#endif\n"
#sed -i "/$line/i $defs" "$servermd"
make
# Change "DEBARCH=aarch64" to "DEBARCH=arm64"
#sed -i 's/aarch64/arm64/g' pkgscripts/makedpkg
# Change "Architecture: aarch64" to "Architecture: arm64"
#sed -i 's/aarch64/arm64/g' pkgscripts/deb-control
#make deb
# sudo dpkg -i turbovnc_2.1.1_arm64.deb
# SYSTEM
# Add system-wide configurations
cd $currentDir
echo "/opt/libjpeg-turbo/lib64" > libjpeg-turbo.conf
sudo cp libjpeg-turbo.conf /etc/ld.so.conf.d/
sudo ldconfig
rm ./libjpeg-turbo.conf
# Add TurboVNC to path
if ! grep -Fq "/root/Desktop/turbovnc/jtx1_remote_access/tmp/turbovnc-build/bin" "$HOME/.bashrc"; then
echo '-export PATH=$PATH:/root/Desktop/turbovnc/jtx1_remote_access/tmp/turbovnc-build/bin' >> ~/.bashrc
fi
# Add VirtualGL to path
if ! grep -Fq "/root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl-build/bin" "$HOME/.bashrc"; then
echo 'export PATH=$PATH:/root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl-build/bin' >> ~/.bashrc
fi
# copied from https://github.com/nicksp/dotfiles/blob/master/setup.sh
answer_is_yes() {
[[ "$REPLY" =~ ^[Yy]$ ]] \
&& return 0 \
|| return 1
}
print_question() {
# Print output in yellow
printf "\e[0;33m [?] $1\e[0m"
}
# copied from https://github.com/nicksp/dotfiles/blob/master/setup.sh
ask_for_confirmation() {
print_question "$1 (y/n) "
read -n 1
printf "\n"
}
cd ..
ask_for_confirmation "Do you want to remove leftover files?"
if answer_is_yes; then
rm -drf tmp
fi
nano_configure_vgl_and_vnc.sh :
# Built VirtualGL, TurboVNC and libjpeg-turbo for 64-bit Linux for Jetson Nano / Tegra R32.4.2
#
# Based on https://devtalk.nvidia.com/default/topic/828974/jetson-tk1/-howto-install-virtualgl-and-turbovnc-to-jetson-tk1/2
#
# copied from https://github.com/nicksp/dotfiles/blob/master/setup.sh
answer_is_yes() {
[[ "$REPLY" =~ ^[Yy]$ ]] \
&& return 0 \
|| return 1
}
print_question() {
# Print output in yellow
printf "\e[0;33m [?] $1\e[0m"
}
# copied from https://github.com/nicksp/dotfiles/blob/master/setup.sh
ask_for_confirmation() {
print_question "$1 (y/n) "
read -n 1
printf "\n"
}
# Configure VirtualGL
# See https://cdn.rawgit.com/VirtualGL/virtualgl/2.5/doc/index.html#hd006
echo -e "Configuring VirtualGL..."
#sudo /opt/VirtualGL/bin/vglserver_config
chmod +x /root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl/server/vglserver_config
chmod +x /root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl/server/vglgenkey
sudo /root/Desktop/turbovnc/jtx1_remote_access/tmp/virtualgl/server/./vglserver_config
#sudo usermod -a -G vglusers ubuntu
echo -e "\n"
# Install xfce4
echo -e "Configuring window manager...\n"
ask_for_confirmation "Do you want to install xfce4 window manager? (There might be problems with running default unity on TurboVNC)."
if answer_is_yes; then
cp /root/.vnc/xstartup xstartup.turbovnc
chmod -x /root/.vnc/xstartup
xstartup="$HOME/.vnc/xstartup.turbovnc"
line="unset DBUS_SESSION_BUS_ADDRESS"
startline="# enable copy and paste from remote system\n\
vncconfig -nowin &\n\
export XKL_XMODMAP_DISABLE=1\n\
autocutsel -fork\n\
# start xfce4\n\
startxfce4 &"
# sudo apt-get install xfce4 gnome-icon-theme-full xfce4-terminal
if ! grep -Fq "startxfce4" $xstartup; then
sed -i "/$line/a $startline" $xstartup
fi
fi
root@zi-desktop:/# /usr/local/cuda-10.2/samples/5_Simulations/oceanFFT/./oceanFFT
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
Error unable to find GLSL vertex and fragment shaders!
root@zi-desktop:/usr/local/cuda/samples/5_Simulations/oceanFFT# ./oceanFFT
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
GPU Device 0: “Maxwell” with compute capability 5.3
CUDA error at oceanFFT.cpp:296 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_heightVB_resource, heightVertexBuffer, cudaGraphicsMapFlagsWriteDiscard)”
corrupted size vs. prev_size
Aborted
ERROR: ld.so: object ‘libvglfaker-nodl.so’ from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
GPU Device 0: “Maxwell” with compute capability 5.3
CUDA error at oceanFFT.cpp:296 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_heightVB_resource, heightVertexBuffer, cudaGraphicsMapFlagsWriteDiscard)”
corrupted size vs. prev_size
Aborted
VirtualGL needs Xorg running for 3D rendering even if your machine is not connected to display.
Are you sure Xorg running?
If not, you might need to add Option “AllowEmptyInitialConfiguration” in xorg.conf to run Xorg without the external display.
Xorg runs in display 0 and TurboVnc runs in display 1 in default.
In that case, you don’t need to add “-d 1” option to vglrun.
root@zi-desktop:/usr/local/cuda/samples/5_Simulations/oceanFFT# ./oceanFFT
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
GPU Device 0: “Maxwell” with compute capability 5.3
CUDA error at oceanFFT.cpp:296 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_heightVB_resource, heightVertexBuffer, cudaGraphicsMapFlagsWriteDiscard)”
corrupted size vs. prev_size
Aborted
@marietto2008
it seems you need may to edit your xorg.conf to overcome the “:296 code=999(” error.
you may try adding the Section for screen 0, unless it is there already,
otherwise Xorg won’t start without a connected display on Display=:0 interface, likely
virtualgl-build/bin# /usr/local/cuda/samples/5_Simulations/oceanFFT/./oceanFFT
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
Error unable to find GLSL vertex and fragment shaders!
root@zi-desktop:/usr/local/cuda/samples/5_Simulations/oceanFFT# ./oceanFFT
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
[CUDA FFT Ocean Simulation]
Left mouse button - rotate
Middle mouse button - pan
Right mouse button - zoom
‘w’ key - toggle wireframe
[CUDA FFT Ocean Simulation]
GPU Device 0: “Maxwell” with compute capability 5.3
CUDA error at oceanFFT.cpp:296 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_heightVB_resource, heightVertexBuffer, cudaGraphicsMapFlagsWriteDiscard)”
Segmentation fault
When I put Display=:0 on the xorg file echo $DISPLAY returns 1,so I’ve put 1 but it gives that error.