pc机wayland环境编译glfw窗口管理器

找了很多Linux发行版,都没有明确标注是否采用了wayland作为显示服务器,尝试了ubuntu17.10,suse,centos7,fedora28,终于找到了fedora28原生使用wayland的发行版

ubuntu17.10也采用wayland作为原生图形服务器,但是没两下就死机,变砖了

centos7连窗口都没有,完全自己搭建,编译了无数的源码,最终因为运行weston提示版本不适配而无法进行
也参考了如下几篇文章
https://www.cnblogs.com/ratfree/articles/5063741.html
https://www.cnblogs.com/bouygues/p/5684216.html
https://wayland.freedesktop.org/ubuntu16.04.html

最后也卡在了libinput,gtk,libc等版本不匹配上

查到fedora25计划默认采用wayland作为显示服务器,于是打开之前用于学习systemd的fedora28,如下命令可确认:

  • xrandr
  • echo $XDG_SESSION_TYPE
  • loginctl

确认了显示服务器是wayland

于是在fedora28上部署wayland开发环境,将glfw窗口管理器编译出来
大概下载了如下工具:

yum install autoconf  automake make gcc gcc-c++  libtool bison  flex wget  bzip2 pkgconfig
yum install libffi-devel.x86_64 expat-devel.x86_64
yum install systemd-devel.x86_64
yum install wqy-microhei-fonts.noarch wqy-zenhei-fonts.noarch   zlib-devel.x86_64
yum install glib2-devel.x86_64
yum install libpng-devel.x86_64  pixman-devel.x86_64
yum install libxkbcommon-devel.x86_64  libjpeg-turbo-devel.x86_64 pam-devel.x86_64
yum install cmake-gui

安装cmake,有多种方法,安装编译完后加个连接才好用
ln -s /usr/cmake-3.12.2-Linux-x86_64/bin/* /usr/bin/

http://www.glfw.org/下载最新glfw-3.2.1

首次编译会出现如下几个环境配置问题:

  • 在cmake-gui上导入glfw-3.2.1,在Makelist.txt上记得开启wayland,否则默认是x11,会提示没有x11的开发库;
    导入后点击configure,会产生一个ecm错误,这是cmake的问题,安装有一个扩展包即可
    git clone git://anongit.kde.org/extra-cmake-modules.git
    cd extra-cmake-modules/
    cmake .
    make
    sudo make install
    
    ps:如果在交叉编译里遇到,直接在ECM_DIR里指定路径即可,如/usr/local/share/ECM/cmake

     

  • 在cmake-gui上删除当前配置Delete Cache,重新configure,有一个新的错误产生,missing WAYLAND_LIBRARY**,安装wayland开发库
    yum install wayland-devel

     

  • 在cmake-gui上删除当前配置Delete Cache,重新configure,又有一个新的错误产生,missing WAYLAND_PROTOCOLS,安装wayland_protocols开发库,可从该网站下载,http://rpm.pbone.net/index.php3?stat=3&search=wayland-protocols-devel&srodzaj=3
    rpm -ivh wayland-protocols-devel-1.2-13.1.noarch.rpm

     

  • 在cmake-gui上删除当前配置Delete Cache,重新configure,此时configure和generate成功运行,在build目录生成马可肥了,终端进入build目录执行make,此时又产生一个错误,找不到头文件<GL/gl.h>****等,此时安装OpenGL开发库
    yum install -y SDL-devel mesa-libGL-devel

     

到此,glfw-3.2.1顺利编译,examples文件可完美运行

 

有几个命令可能关于egl的

yum install mesa-libGLES-devel.x86_64
yum install mesa-libGL-devel.x86_64
yum install mesa-libGLU-devel.x86_64
 
yum install libXrandr-devel.x86_64
yum install libXinerama-devel.x86_64
yum install libXcursor-devel.x86_64

 

 

附一个操作记录

   19  sudo chmod cmake-3.12.2-Linux-x86_64.sh 
   20  sudo chmod 777 cmake-3.12.2-Linux-x86_64.sh 
   22  ./cmake-3.12.2-Linux-x86_64.sh 
   23  cmake
   25  cd cmake-3.12.2-Linux-x86_64/
   35  sudo yum install autoconf
   36  sudo wget https://launchpadlibrarian.net/189487929/extra-cmake-modules_1.4.0.orig.tar.xz
   37  git clone https://commits.kde.org/extra-cmake-modules
   39  git clone https://commits.kde.org/extra-cmake-modules.git
   40  git clone https://commits.kde.org/extra-cmake-modules
   41  git clone git://anongit.kde.org/extra-cmake-modules.git
   42  cd extra-cmake-modules/
   44  cmake .
   45  make
   51  sudo make install
   52  cmake .
   53  sudo yum install libxkbcommon-devel.x86_64 libjpeg-turbo-devel.x86_64 pam-devel.x86_64
   54  sudo yum install libpng-devel.x86_64 pixman-devel.x86_64
   55  sudo yum install glib2-devel.x86_64
   56  sudo git clone git://anongit.freedesktop.org/wayland/wayland
   57  sudo git clone git://anongit.freedesktop.org/wayland/wayland.git
   58  cd  wayland/
   60  ./autogen.sh 
   61  echo $HOME
   65  cd wayland/
   68  cd glfw-learning/
   70  cd glfw-3.2.1/
   76  cd cmake-3.12.2-Linux-x86_64/
   78  cd bin/
   88  cd wayland/
   90  ./autogen.sh  --prefix=$WLD
   91  sudo yum instll wayland
   92  sudo yum install wayland
   93  sudo yum install weston
   94  sudo yum install build-devel
   95  sudo yum install build-dep
   96  sudo yum install wayland-egl
   97  sudo yum install wayland-devel
  105  sudo yum install wayland-protocalls
  106  sudo yum install wayland-protocals
  107  sudo yum install wayland-protocols
  110  cd wayland/
  112  cd wayland-protocols-1.15/
  113  ./configure --prefix=/usr
  114  make
  116  ./configure --prefix=/usr
  118  make
  119  make all
  120  make clean
  121  make
  123  ./configure --prefix=/usr && make
  130  sudo yum install WaylandProtocols
  131  sudo yum install WaylandProtocols-devel
  132  sudo yum install waylandprotocols
  133  sudo yum install wayland*
  134  sudo yum install wayland-protocols-1.15
  135  sudo yum install libwayland
  136  sudo yum install libwayland-proto*
  140  rpm -ivh wayland-protocols-devel-1.2-13.1.noarch.rpm 
  141  sudo rpm -ivh wayland-protocols-devel-1.2-13.1.noarch.rpm 
  144  cd wayland/
  146  cd glfw-learning/
  148  cd glfw-3.2.1/
  150  cd build-glfw/
  152  make
  153  yum install -y SDL-devel mesa-libGL-devel
  154  sudo yum install -y SDL-devel mesa-libGL-devel
  156  make
  158  cd application/
  160  ./angle 
  161  ./window 
  164  cd examples/
  169  cd wayland/
  171  cd glfw-learning/
  173  cd glfw-3.2.1/
  175  make
  176  cd build-glfw/
  178  make
  180  cd examples/
  182  ./boing 
  184  cd ..
  186  cd tests/
  188  ./gamma 
  189  ./clipboard 
  190  ./cursor 
  192  cd ..
  193  cd application/
  195  ./angle 
  196  cd ../examples/
  198  ./simple 
  200  cd 
  201  history > build-wayland.file2

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值