【飞凌RZ/G2L开发板试用体验】快速搭建vnc环境

描述

本文来源电子发烧友社区,作者:李先生, 帖子地址:https://bbs.elecfans.com/jishu_2299976_1_1.html


VCN连接

前言

某些时候我们可能没有HDMI显示器,在做某些图形界面开发时不是很方便,此时可以通过VNC解决。我们先交叉编译libvncserver,在开发板运行vncserver,PC端可以直接http访问开发板显示界面。这样非常方便。

如果没有网线,也可以使用wifi连接,就像我现在出差在外面只带了开发板的电源和USB串口线,也可以很方便的进行图形界面的开发测试。

编译libvncserver

sudo -s 输入密码切换到root

apt-get install cmake 安装cmake

cd ~/work 进入工作目录

git clone https://github.com/LibVNC/libvncserver.git 下载代码

. OKG2L-linux-sdk10/environment-setup-aarch64-smarc-rzg2l-toolchain 配置编译环境

cd libvncserver/ 进入代码

mkdir build 创建编译目录

cd build 进入编译目录

cmake ..

root@ubuntu:~/work/libvncserver/build# cmake ..

-- Toolchain file defaulted to '/opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake'

-- The C compiler identification is GNU 8.3.0

-- Check for working C compiler: /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc

-- Check for working C compiler: /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Found ZLIB: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/libz.so (found version "1.2.11") 

-- Found LZO: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/liblzo2.so

-- Found JPEG: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/libjpeg.so (found version "62") 

-- Performing Test FOUND_LIBJPEG_TURBO

-- Performing Test FOUND_LIBJPEG_TURBO - Success

-- Found PNG: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/libpng.so (found version "1.6.37") 

-- Looking for pthread.h

-- Looking for pthread.h - found

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

-- Looking for pthread_create in pthreads

-- Looking for pthread_create in pthreads - not found

-- Looking for pthread_create in pthread

-- Looking for pthread_create in pthread - found

-- Found Threads: TRUE  

-- Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR) 

-- Some or all of the gtk libraries were not found. (missing: GTK2_GTK_LIBRARY GTK2_GTK_INCLUDE_DIR GTK2_GDK_INCLUDE_DIR GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GDK_LIBRARY) 

CMake Warning at CMakeLists.txt:139 (find_package):

  By not providing "FindLibSSH2.cmake" in CMAKE_MODULE_PATH this project has

  asked CMake to find a package configuration file provided by "LibSSH2", but

  CMake did not find one.

 

  Could not find a package configuration file provided by "LibSSH2" with any

  of the following names:

 

    LibSSH2Config.cmake

    libssh2-config.cmake

 

  Add the installation prefix of "LibSSH2" to CMAKE_PREFIX_PATH or set

  "LibSSH2_DIR" to a directory containing one of the above files.  If

  "LibSSH2" provides a separate development package or SDK, be sure it has

  been installed.

 

 

-- Could NOT find GnuTLS (missing: GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR) (Required is at least version "3.4.0")

-- Found OpenSSL: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/lib64/libcrypto.so (found version "1.1.1d")  

-- Found PkgConfig: /opt/poky/3.1.5/sysroots/x86_64-pokysdk-linux/usr/bin/pkg-config (found version "0.29") 

-- Checking for module 'libsystemd'

--   Found libsystemd, version 244

-- Found FFMPEG: /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/include (found suitable version "4.2.2", minimum required is "3.1.0") found components: avformat avcodec avutil swscale 

-- Looking for dirent.h

-- Looking for dirent.h - found

-- Looking for endian.h

-- Looking for endian.h - found

-- Looking for fcntl.h

-- Looking for fcntl.h - found

-- Looking for netinet/in.h

-- Looking for netinet/in.h - found

-- Looking for sys/endian.h

-- Looking for sys/endian.h - not found

-- Looking for sys/socket.h

-- Looking for sys/socket.h - found

-- Looking for sys/stat.h

-- Looking for sys/stat.h - found

-- Looking for sys/time.h

-- Looking for sys/time.h - found

-- Looking for sys/types.h

-- Looking for sys/types.h - found

-- Looking for sys/wait.h

-- Looking for sys/wait.h - found

-- Looking for unistd.h

-- Looking for unistd.h - found

-- Looking for sys/resource.h

-- Looking for sys/resource.h - found

-- Looking for vfork.h

-- Looking for vfork.h - not found

-- Looking for ws2tcpip.h

-- Looking for ws2tcpip.h - not found

-- Looking for arpa/inet.h

-- Looking for arpa/inet.h - found

-- Looking for stdint.h

-- Looking for stdint.h - found

-- Looking for stddef.h

-- Looking for stddef.h - found

-- Looking for sys/types.h

-- Looking for sys/types.h - found

-- Looking for gettimeofday

-- Looking for gettimeofday - found

-- Looking for vfork

-- Looking for vfork - found

-- Looking for vprintf

-- Looking for vprintf - found

-- Looking for mmap

-- Looking for mmap - found

-- Looking for fork

-- Looking for fork - found

-- Looking for ftime

-- Looking for ftime - found

-- Looking for gethostbyname

-- Looking for gethostbyname - found

-- Looking for gethostname

-- Looking for gethostname - found

-- Looking for inet_ntoa

-- Looking for inet_ntoa - found

-- Looking for memmove

-- Looking for memmove - found

-- Looking for memset

-- Looking for memset - found

-- Looking for mkfifo

-- Looking for mkfifo - found

-- Looking for select

-- Looking for select - found

-- Looking for socket

-- Looking for socket - found

-- Looking for strchr

-- Looking for strchr - found

-- Looking for strcspn

-- Looking for strcspn - found

-- Looking for strdup

-- Looking for strdup - found

-- Looking for strerror

-- Looking for strerror - found

-- Looking for strstr

-- Looking for strstr - found

-- Looking for htobe64

-- Looking for htobe64 - found

-- Looking for OSSwapHostToBigInt64

-- Looking for OSSwapHostToBigInt64 - not found

-- Building crypto with Libgcrypt

-- Threads support is using pthreads

-- Check size of pid_t

-- Check size of pid_t - done

-- Check size of size_t

-- Check size of size_t - done

-- Check size of socklen_t

-- Check size of socklen_t - done

-- Check size of in_addr_t

-- Check size of in_addr_t - done

-- Check if the system is big endian

-- Searching 16 bit integer

-- Check size of unsigned short

-- Check size of unsigned short - done

-- Using unsigned short

-- Check if the system is big endian - little endian

-- Building TLS with OpenSSL

-- Configuring done

-- Generating done

-- Build files have been written to: /home/forlinx/work/libvncserver/build

cmake --build . 编译

root@ubuntu:~/work/libvncserver/build# cmake --build .

Scanning dependencies of target vncserver

[  1%] Building C object CMakeFiles/vncserver.dir/libvncserver/main.c.o

/home/forlinx/work/libvncserver/libvncserver/main.c: In function ‘rfbShutdownServer’:

/home/forlinx/work/libvncserver/libvncserver/main.c:1236:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]

       write(screen->pipe_notify_listener_thread[1], "x00", 1);

       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[  2%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbserver.c.o

/home/forlinx/work/libvncserver/libvncserver/rfbserver.c: In function ‘rfbProcessExtendedServerCutTextData’:

/home/forlinx/work/libvncserver/libvncserver/rfbserver.c:2141:20: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

     stream.next_in = data;

                    ^

[  3%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbregion.c.o

[  4%] Building C object CMakeFiles/vncserver.dir/libvncserver/auth.c.o

[  5%] Building C object CMakeFiles/vncserver.dir/libvncserver/sockets.c.o

/home/forlinx/work/libvncserver/libvncserver/sockets.c: In function ‘rfbCloseClient’:

/home/forlinx/work/libvncserver/libvncserver/sockets.c:588:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]

  write(cl->pipe_notify_client_thread[1], "x00", 1);

  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[  6%] Building C object CMakeFiles/vncserver.dir/libvncserver/stats.c.o

[  7%] Building C object CMakeFiles/vncserver.dir/libvncserver/corre.c.o

[  8%] Building C object CMakeFiles/vncserver.dir/libvncserver/hextile.c.o

[  9%] Building C object CMakeFiles/vncserver.dir/libvncserver/rre.c.o

[ 10%] Building C object CMakeFiles/vncserver.dir/libvncserver/translate.c.o

[ 11%] Building C object CMakeFiles/vncserver.dir/libvncserver/cutpaste.c.o

[ 11%] Building C object CMakeFiles/vncserver.dir/libvncserver/httpd.c.o

[ 12%] Building C object CMakeFiles/vncserver.dir/libvncserver/cursor.c.o

[ 13%] Building C object CMakeFiles/vncserver.dir/libvncserver/font.c.o

[ 14%] Building C object CMakeFiles/vncserver.dir/libvncserver/draw.c.o

[ 15%] Building C object CMakeFiles/vncserver.dir/libvncserver/selbox.c.o

[ 16%] Building C object CMakeFiles/vncserver.dir/common/vncauth.c.o

[ 17%] Building C object CMakeFiles/vncserver.dir/common/sockets.c.o

[ 18%] Building C object CMakeFiles/vncserver.dir/libvncserver/cargs.c.o

[ 19%] Building C object CMakeFiles/vncserver.dir/libvncserver/ultra.c.o

[ 20%] Building C object CMakeFiles/vncserver.dir/libvncserver/scale.c.o

[ 21%] Building C object CMakeFiles/vncserver.dir/common/crypto_libgcrypt.c.o

[ 22%] Building C object CMakeFiles/vncserver.dir/libvncserver/rfbssl_openssl.c.o

[ 23%] Building C object CMakeFiles/vncserver.dir/libvncserver/zlib.c.o

[ 24%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrle.c.o

[ 25%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrleoutstream.c.o

[ 26%] Building C object CMakeFiles/vncserver.dir/libvncserver/zrlepalettehelper.c.o

[ 27%] Building C object CMakeFiles/vncserver.dir/libvncserver/tight.c.o

[ 28%] Building C object CMakeFiles/vncserver.dir/common/turbojpeg.c.o

[ 29%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/rfbtightserver.c.o

[ 30%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c.o

[ 31%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/filetransfermsg.c.o

[ 32%] Building C object CMakeFiles/vncserver.dir/libvncserver/tightvnc-filetransfer/filelistinfo.c.o

[ 33%] Building C object CMakeFiles/vncserver.dir/libvncserver/websockets.c.o

[ 34%] Building C object CMakeFiles/vncserver.dir/libvncserver/ws_decode.c.o

[ 35%] Building C object CMakeFiles/vncserver.dir/common/base64.c.o

[ 36%] Linking C shared library libvncserver.so

[ 36%] Built target vncserver

Scanning dependencies of target vncclient

[ 37%] Building C object CMakeFiles/vncclient.dir/libvncclient/cursor.c.o

[ 38%] Building C object CMakeFiles/vncclient.dir/libvncclient/listen.c.o

[ 39%] Building C object CMakeFiles/vncclient.dir/libvncclient/rfbproto.c.o

[ 40%] Building C object CMakeFiles/vncclient.dir/libvncclient/sockets.c.o

[ 41%] Building C object CMakeFiles/vncclient.dir/libvncclient/vncviewer.c.o

[ 42%] Building C object CMakeFiles/vncclient.dir/common/sockets.c.o

[ 43%] Building C object CMakeFiles/vncclient.dir/common/crypto_libgcrypt.c.o

[ 44%] Building C object CMakeFiles/vncclient.dir/common/turbojpeg.c.o

[ 45%] Building C object CMakeFiles/vncclient.dir/libvncclient/tls_openssl.c.o

[ 46%] Linking C shared library libvncclient.so

[ 46%] Built target vncclient

Scanning dependencies of target test_wstest

[ 47%] Building C object CMakeFiles/test_wstest.dir/test/wstest.c.o

[ 48%] Linking C executable test/wstest

[ 48%] Built target test_wstest

Scanning dependencies of target test_tjbench

[ 49%] Building C object CMakeFiles/test_tjbench.dir/test/tjbench.c.o

/home/forlinx/work/libvncserver/test/tjbench.c: In function ‘decomptest’:

/home/forlinx/work/libvncserver/test/tjbench.c:96:27: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]

   snprintf(qualstr, 6, "_Q%d", jpegqual);

                           ^~

/home/forlinx/work/libvncserver/test/tjbench.c:96:24: note: directive argument in the range [1, 2147483647]

   snprintf(qualstr, 6, "_Q%d", jpegqual);

                        ^~~~~~

In file included from /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/include/stdio.h:873,

                 from /home/forlinx/work/libvncserver/test/tjbench.c:29:

/opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 4 and 13 bytes into a destination of size 6

   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        __bos (__s), __fmt, __va_arg_pack ());

        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[ 50%] Building C object CMakeFiles/test_tjbench.dir/test/tjutil.c.o

[ 51%] Building C object CMakeFiles/test_tjbench.dir/test/bmp.c.o

[ 52%] Building C object CMakeFiles/test_tjbench.dir/common/turbojpeg.c.o

[ 53%] Linking C executable test/tjbench

[ 53%] Built target test_tjbench

Scanning dependencies of target test_tjunittest

[ 54%] Building C object CMakeFiles/test_tjunittest.dir/test/tjunittest.c.o

[ 54%] Building C object CMakeFiles/test_tjunittest.dir/test/tjutil.c.o

[ 55%] Building C object CMakeFiles/test_tjunittest.dir/common/turbojpeg.c.o

[ 56%] Linking C executable test/tjunittest

[ 56%] Built target test_tjunittest

Scanning dependencies of target test_encodingstest

[ 57%] Building C object CMakeFiles/test_encodingstest.dir/test/encodingstest.c.o

/home/forlinx/work/libvncserver/test/encodingstest.c: In function ‘main’:

/home/forlinx/work/libvncserver/test/encodingstest.c:202:24: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 7 [-Wformat-overflow=]

  sprintf(cd->display,":%d",server->port-5900);

                        ^~

/home/forlinx/work/libvncserver/test/encodingstest.c:202:22: note: directive argument in the range [-2147483648, 2147477747]

  sprintf(cd->display,":%d",server->port-5900);

                      ^~~~~

In file included from /opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/include/stdio.h:873,

                 from /home/forlinx/work/libvncserver/rfb/rfb.h:41,

                 from /home/forlinx/work/libvncserver/test/encodingstest.c:6:

/opt/poky/3.1.5/sysroots/aarch64-poky-linux/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 3 and 13 bytes into a destination of size 8

   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       __bos (__s), __fmt, __va_arg_pack ());

       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[ 58%] Linking C executable test/encodingstest

[ 58%] Built target test_encodingstest

Scanning dependencies of target test_cargstest

[ 59%] Building C object CMakeFiles/test_cargstest.dir/test/cargstest.c.o

[ 60%] Linking C executable test/cargstest

[ 60%] Built target test_cargstest

Scanning dependencies of target client_examples_vnc2mpg

[ 61%] Building C object CMakeFiles/client_examples_vnc2mpg.dir/client_examples/vnc2mpg.c.o

[ 62%] Linking C executable client_examples/vnc2mpg

[ 62%] Built target client_examples_vnc2mpg

Scanning dependencies of target client_examples_backchannel

[ 62%] Building C object CMakeFiles/client_examples_backchannel.dir/client_examples/backchannel.c.o

[ 63%] Linking C executable client_examples/backchannel

[ 63%] Built target client_examples_backchannel

Scanning dependencies of target examples_vncev

[ 64%] Building C object CMakeFiles/examples_vncev.dir/examples/vncev.c.o

/home/forlinx/work/libvncserver/examples/vncev.c: In function ‘read_keys’:

/home/forlinx/work/libvncserver/examples/vncev.c:46:7: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

       fgets(buffer,1024,keysyms);

       ^~~~~~~~~~~~~~~~~~~~~~~~~~

[ 65%] Linking C executable examples/vncev

[ 65%] Built target examples_vncev

Scanning dependencies of target examples_storepasswd

[ 66%] Building C object CMakeFiles/examples_storepasswd.dir/examples/storepasswd.c.o

[ 67%] Linking C executable examples/storepasswd

[ 67%] Built target examples_storepasswd

Scanning dependencies of target examples_cursors

[ 68%] Building C object CMakeFiles/examples_cursors.dir/examples/cursors.c.o

[ 69%] Linking C executable examples/cursors

[ 69%] Built target examples_cursors

Scanning dependencies of target examples_fontsel

[ 70%] Building C object CMakeFiles/examples_fontsel.dir/examples/fontsel.c.o

[ 71%] Linking C executable examples/fontsel

[ 71%] Built target examples_fontsel

Scanning dependencies of target examples_backchannel

[ 72%] Building C object CMakeFiles/examples_backchannel.dir/examples/backchannel.c.o

[ 73%] Linking C executable examples/backchannel

[ 73%] Built target examples_backchannel

Scanning dependencies of target examples_camera

[ 74%] Building C object CMakeFiles/examples_camera.dir/examples/camera.c.o

[ 75%] Linking C executable examples/camera

[ 75%] Built target examples_camera

Scanning dependencies of target examples_filetransfer

[ 76%] Building C object CMakeFiles/examples_filetransfer.dir/examples/filetransfer.c.o

[ 77%] Linking C executable examples/filetransfer

[ 77%] Built target examples_filetransfer

Scanning dependencies of target examples_pnmshow

[ 78%] Building C object CMakeFiles/examples_pnmshow.dir/examples/pnmshow.c.o

/home/forlinx/work/libvncserver/examples/pnmshow.c: In function ‘main’:

/home/forlinx/work/libvncserver/examples/pnmshow.c:33:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

   fgets(buffer,1024,in);

   ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:50:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

     fgets(buffer,1024,in);

     ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:57:2: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

  fgets(buffer,1024,in);

  ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:84:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]

   fread(rfbScreen->frameBuffer,width*bitsPerPixelInFile/8,height,in);

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[ 79%] Linking C executable examples/pnmshow

[ 79%] Built target examples_pnmshow

Scanning dependencies of target copy-compile-commands

[ 79%] Built target copy-compile-commands

Scanning dependencies of target examples_regiontest

[ 79%] Building C object CMakeFiles/examples_regiontest.dir/examples/regiontest.c.o

[ 80%] Linking C executable examples/regiontest

[ 80%] Built target examples_regiontest

Scanning dependencies of target test_copyrecttest

[ 81%] Building C object CMakeFiles/test_copyrecttest.dir/test/copyrecttest.c.o

[ 82%] Linking C executable test/copyrecttest

[ 82%] Built target test_copyrecttest

Scanning dependencies of target examples_simple15

[ 83%] Building C object CMakeFiles/examples_simple15.dir/examples/simple15.c.o

[ 84%] Linking C executable examples/simple15

[ 84%] Built target examples_simple15

Scanning dependencies of target examples_colourmaptest

[ 85%] Building C object CMakeFiles/examples_colourmaptest.dir/examples/colourmaptest.c.o

[ 86%] Linking C executable examples/colourmaptest

[ 86%] Built target examples_colourmaptest

Scanning dependencies of target examples_example

[ 87%] Building C object CMakeFiles/examples_example.dir/examples/example.c.o

[ 88%] Linking C executable examples/example

[ 88%] Built target examples_example

Scanning dependencies of target examples_pnmshow24

[ 89%] Building C object CMakeFiles/examples_pnmshow24.dir/examples/pnmshow24.c.o

/home/forlinx/work/libvncserver/examples/pnmshow24.c: In function ‘main’:

/home/forlinx/work/libvncserver/examples/pnmshow24.c:41:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

   fgets(buffer,1024,in);

   ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow24.c:49:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

     fgets(buffer,1024,in);

     ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow24.c:55:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

   fgets(buffer,1024,in);

   ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow24.c:83:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]

   fread(rfbScreen->frameBuffer,width*3,height,in);

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[ 90%] Linking C executable examples/pnmshow24

[ 90%] Built target examples_pnmshow24

Scanning dependencies of target client_examples_ppmtest

[ 91%] Building C object CMakeFiles/client_examples_ppmtest.dir/client_examples/ppmtest.c.o

[ 92%] Linking C executable client_examples/ppmtest

[ 92%] Built target client_examples_ppmtest

Scanning dependencies of target examples_rotate

[ 93%] Building C object CMakeFiles/examples_rotate.dir/examples/rotate.c.o

In file included from /home/forlinx/work/libvncserver/examples/rotate.c:84:

/home/forlinx/work/libvncserver/examples/pnmshow.c: In function ‘main’:

/home/forlinx/work/libvncserver/examples/pnmshow.c:33:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

   fgets(buffer,1024,in);

   ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:50:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

     fgets(buffer,1024,in);

     ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:57:2: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

  fgets(buffer,1024,in);

  ^~~~~~~~~~~~~~~~~~~~~

/home/forlinx/work/libvncserver/examples/pnmshow.c:84:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]

   fread(rfbScreen->frameBuffer,width*bitsPerPixelInFile/8,height,in);

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[ 94%] Linking C executable examples/rotate

[ 94%] Built target examples_rotate

Scanning dependencies of target examples_blooptest

[ 95%] Building C object CMakeFiles/examples_blooptest.dir/examples/blooptest.c.o

[ 96%] Linking C executable examples/blooptest

[ 96%] Built target examples_blooptest

Scanning dependencies of target examples_repeater

[ 97%] Building C object CMakeFiles/examples_repeater.dir/examples/repeater.c.o

[ 98%] Linking C executable examples/repeater

[ 98%] Built target examples_repeater

Scanning dependencies of target examples_simple

[ 99%] Building C object CMakeFiles/examples_simple.dir/examples/simple.c.o

[100%] Linking C executable examples/simple

[100%] Built target examples_simple

ls查看生成的文件

ls

client_examples  CMakeFiles           compile_commands.json  examples         libvncclient.so         libvncclient.so.1         LibVNCServerConfigVersion.cmake  libvncserver.so         libvncserver.so.1  rfb

CMakeCache.txt   cmake_install.cmake  CTestTestfile.cmake    libvncclient.pc  libvncclient.so.0.9.13  LibVNCServerConfig.cmake  libvncserver.pc                  libvncserver.so.0.9.13  Makefile           test

root@ubuntu:~/work/libvncserver/build# ls examples/

backchannel  blooptest  camera  colourmaptest  cursors  example  filetransfer  fontsel  pnmshow  pnmshow24  regiontest  repeater  rotate  simple  simple15  storepasswd  vncev

其中 libvncserver.so.0.9.13 为动态库,examples/下有一些示例程序

file libvncserver.so.0.9.13

libvncserver.so.0.9.13: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=cc026110b20f44b67644940e3d0469a5c0c8b643, with debug_info, not stripped

将libvncserver.so.0.9.13和examples/example 导入到开发板

运行

将libvncserver.so.0.9.13复制到/lib文件夹下

cp libvncserver.so.0.9.13 /lib/libvncserver.so.1

chmod +x example

连接wifi

fltest_wifi.sh -i wlan0 -s wifi名 -p 密码

电脑和开发板处于同一wifi下

ifconfig查看ip,我这里是192.168.250.5

./example 运行server

root@okg2l:~# ./example

16/08/2022 18:21:45 Unable to establish connection with systemd socket

16/08/2022 18:21:45 Listening for VNC connections on TCP port 5900

16/08/2022 18:21:45 rfbListenOnTCP6Port: error in bind IPv6 socket: Address family not supported by protocol

16/08/2022 18:21:45 Listening for HTTP connections on TCP port 5800

16/08/2022 18:21:45 URL http://okg2l:5800

16/08/2022 18:21:45 rfbListenOnTCP6Port: error in bind IPv6 socket: Address family not supported by protocol

电脑端浏览器中输入

http://192.168.250.5/
飞凌

这时就可以看到桌面了。
飞凌

总结

通过交叉编译开源的libvncserver库,很快速的就搭建了vnc服务。这得益于厂家提供的现成的工具链,只要clone make即可,非常快速方便。解决了无显示器开发图形界面的问题。

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分