最新Ubuntu LVGL SDL模拟器安装

前言

本文主要说明Ubuntu 23.4安装LVGL 9.0以及基于SDL的模拟环境。

代码下载

访问lv_port_pc_eclipse可以看到相信信息,官方已经打包好了整个代码环境。

安装CMAKE。

bash 复制代码
sudo apt install cmake

安装SDL。

bash 复制代码
sudo apt-get update && sudo apt-get install -y build-essential libsdl2-dev

安装LVGL,因为我们下载的是lv_port_pc_eclipse仓库,所以加上recursive参数会把lvgl也一起下载下来。

bash 复制代码
git clone --recursive https://github.com/lvgl/lv_port_pc_eclipse.git

下载完成后是这样的目录结构。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse$ ls
CMakeLists.txt  Dockerfile   lv_conf.h  main.c    mouse_cursor_icon.c    pc_simulator.launch
confdef.txt     licence.txt  lvgl       Makefile  mouse_cursor_icon.png  README.md

编译

在lv_port_pc_eclipse目录中,创建编译文件夹build,然后执行cmake生成makefile文件。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse$ mkdir build
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse/build$ cd build/
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse/build$ cmake .. .

log如下。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse/build$ cmake .. .
CMake Warning:
  Ignoring extra path from command line:

   "."


-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anruliu/workspace/lv_port_pc_eclipse/build

最后执行make -j即可。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse/build$ make -j

编译完成后,可执行文件在上一层目录的bin/main,执行即可看到程序运行。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse/bin$ ./main


当然还有很多的demo程序可以运行测试,添加入口函数即可。

bash 复制代码
name@name-HP-Pavilion-g6-Notebook-PC:~/workspace/lv_port_pc_eclipse$ git diff .
diff --git a/main.c b/main.c
index ed24d8b..a8d993a 100644
--- a/main.c
+++ b/main.c
@@ -76,6 +76,9 @@ int main(int argc, char **argv)
   hal_init(800, 480);
 
   lv_demo_widgets();
+  //lv_demo_music();
+  //lv_demo_benchmark(LV_DEMO_BENCHMARK_MODE_RENDER_AND_DRIVER);
+  /lv_demo_flex_layout();
 
   while(1) {
       /* Periodically call the lv_task handler.
相关推荐
oMcLin1 小时前
Linux服务器出现“Out of Memory”错误,如何通过调整swap、hugepages等配置来缓解内存压力
linux·服务器·jenkins
Jet_582 小时前
Linux 下安装与运行 checkra1n 全流程指南(含依赖修复与系统检测)
linux·ubuntu·ios逆向·checkra1n·ios越狱·libncurses5·系统依赖修复
liulilittle2 小时前
CLANG 交叉编译
linux·服务器·开发语言·前端·c++
Chlittle_rabbit3 小时前
50系显卡在Ubuntu22.04环境下安装nvidia驱动+CUDA+cuDNN,anaconda下配置pytorch环境一站式解决方案(2025年7月版本)已完结!!!
linux·人工智能·pytorch·深度学习·ubuntu
ZKNOW甄知科技3 小时前
2025 甄知科技年度报告
运维·人工智能·低代码·ci/cd·自动化·数据库架构·敏捷流程
月上柳青4 小时前
dsoftbus-软总线中多层网络的通信栈
linux
sy134108191954 小时前
AI服务器设备中ISO系列信号隔离器应用场景
运维·服务器·人工智能
L1624764 小时前
linux环境安装MySQL的详细步骤(二进制包形式)
linux·运维·mysql
阿巴~阿巴~4 小时前
TCP可靠传输的底层密码:序号、窗口与六大标志位全解析
运维·服务器·网络·tcp·序列号·六大标志位·确认序号
默默在路上5 小时前
CentOS Stream 9 安装mysql8.0
linux·mysql·centos