页次: 1
感谢
@哇酷小二
开源的 littlevgl 读取并显示TTF字体的程序,使用 freetype ttf字体库
https://whycan.com/t_2475.html#p19291
这个教程实在是看不懂,就放了几个包,不知道到怎么编译,然后放到板子里运行
参考网上例程,做了一个用libfreetype解析微软雅黑msyh.ttf文件的demo
https://whycan.com/t_741.html看下这个能不能跑。
这个没明白怎么跑,小白
@pzh
大佬编译了为啥一直报下面这种错误
home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c: In function ‘lv_port_disp_init’:
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:34:5: warning: implicit declaration of function ‘fbdev_init’; did you mean ‘lv_init’? [-Wimplicit-function-declaration]
34 | fbdev_init();
| ^~~~~~~~~~
| lv_init
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:47:25: error: expected expression before ‘;’ token
47 | disp_drv.flush_cb = ;
| ^
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c: In function ‘lv_port_indev_init’:
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:80:25: error: ‘sdl_mouse_read’ undeclared (first use in this function)
80 | indev_drv.read_cb = sdl_mouse_read;
| ^~~~~~~~~~~~~~
[ 51%] Building C object CMakeFiles/lvgl_linux.dir/assets/mouse_cursor_icon.c.o
[ 51%] Building C object CMakeFiles/lvgl_linux.dir/src/lv_port.c.o
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:12:10: fatal error: component/lv_drivers-8.3.0/display/fbdev.h: No such file or directory
12 | #include <component/lv_drivers-8.3.0/display/fbdev.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/lvgl_linux.dir/build.make:76: CMakeFiles/lvgl_linux.dir/src/lv_port.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: CMakeFiles/lvgl_linux.dir/all] Error 2
make: *** [Makefile:152: all] Error 2。
可参考下 https://gitee.com/zeepunt/lvgl_linux_simulator.git 的 commit log:[port] support freetype
请问一下,我编译报如下错误,你有遇到过嘛,那么编译通过后,又该怎么移植到实际板子上运行
CMake Error at CMakeLists.txt:18 (find_package):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.
Could not find a package configuration file provided by "SDL2" with any of
the following names:
SDL2Config.cmake
sdl2-config.cmake
Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
"SDL2_DIR" to a directory containing one of the above files. If "SDL2"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/lvgl_linux/lvgl_linux_simulator/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.
lv_port_linux_frame_buffer.tar.gz.zip
这个文件是移植了lvgl的freetype的版本
1.在lvgl下使用freetype显示字体,lvgl是移植成功了,只要基于framebuffer 就可以
git clone https://github.com/lvgl/lv_port_linux_frame_buffer
git submodule update --init --recursive。
只需要修改Makefile里面的CC就可:
# CC ?= gcc
CC = /home/ubuntu/nano/buildroot-2021.02.4/output/host/bin/arm-linux-gcc
2.需要在lvgl中加入freetype字体
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz
tar xvfz freetype-2.10.1.tar.gz
cd freetype-2.10.1
//安装目录为当前目录下的lib,不需要依赖zlib和png库
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix=$PWD/lib --with-zlib=no --with-png=no
make
make install
同时在Makefile中加入
LDFLAGS ?= -lm -lfreetype
移植过程也是参考了网上一位前辈的:
lv_lib
└── lv_lib_freetype
├── arial.ttf
├── freetype
│ ├── config
│ │ ├── ftconfig.h
│ │ ├── ftheader.h
│ │ ├── ftmodule.h
│ │ ├── ftoption.h
│ │ ├── ftstdlib.h
│ │ ├── integer-types.h
│ │ ├── mac-support.h
│ │ └── public-macros.h
│ ├── freetype.h
│ ├── ftadvanc.h
│ ├── ftbbox.h
│ ├── ftbdf.h
│ ├── ftbitmap.h
│ ├── ftbzip2.h
│ ├── ftcache.h
│ ├── ftchapters.h
│ ├── ftcid.h
│ ├── ftcolor.h
│ ├── ftdriver.h
│ ├── fterrdef.h
│ ├── fterrors.h
│ ├── ftfntfmt.h
│ ├── ftgasp.h
│ ├── ftglyph.h
│ ├── ftgxval.h
│ ├── ftgzip.h
│ ├── ftimage.h
│ ├── ftincrem.h
│ ├── ftlcdfil.h
│ ├── ftlist.h
│ ├── ftlogging.h
│ ├── ftlzw.h
│ ├── ftmac.h
│ ├── ftmm.h
│ ├── ftmodapi.h
│ ├── ftmoderr.h
│ ├── ftotval.h
│ ├── ftoutln.h
│ ├── ftparams.h
│ ├── ftpfr.h
│ ├── ftrender.h
│ ├── ftsizes.h
│ ├── ftsnames.h
│ ├── ftstroke.h
│ ├── ftsynth.h
│ ├── ftsystem.h
│ ├── fttrigon.h
│ ├── fttypes.h
│ ├── ftwinfnt.h
│ ├── otsvg.h
│ ├── t1tables.h
│ ├── ttnameid.h
│ ├── tttables.h
│ └── tttags.h
├── ft2build.h
├── lv_freetype.c
├── lv_freetype.h
└── lv_lib_freetype.mk
其中lv_lib_freetype.mk的内容如下:
LV_LIB_FREETYPE_DIR_NAME ?= lv_lib_freetype
CSRCS += lv_freetype.c
DEPPATH += --dep-path $(LVGL_DIR)/lv_lib/$(LV_LIB_FREETYPE_DIR_NAME)
VPATH += :$(LVGL_DIR)/lv_lib/$(LV_LIB_FREETYPE_DIR_NAME)
CFLAGS += "-I$(LVGL_DIR)/lv_lib/$(LV_LIB_FREETYPE_DIR_NAME)"
CFLAGS += "-I$(LVGL_DIR)/lv_lib/$(LV_LIB_FREETYPE_DIR_NAME)/freetype"
编译成功了但是运行出错了
# ./demo
-sh: ./demo: not found
# ./demo
# ldd demo
checking sub- depends for ' /lib/l ibfreetype. so.6
checking sub- dependsfo r/lib/ l ibc. so
checking sub- dependsfor ' /lib/libc.so.6'
/lib/ld-linux. so.3 ( 0xb6f 1a000 )
libfreetype.so.6 =>/l ib/libfreetype.so.6 (libc.so => /lib/l ibc.so ( 0x00000000 )
libc,so,6 => /lib/libc.so.6 ( 0x00000000 )
/lib/ld-linux.so.3 => /lib/ld-linux.so.3 (0
需要已经成功移植的大神帮忙指点一下,非常感谢
lv_port_linux_frame_buffer.tar.gz.zip
页次: 1