Building LVGL From Source For Embedded Linux

Documentation is missing on building LVGL from source for Embedded Linux. It appears that cmake is used as the build system, however the CMakeLists.txt file is invalid. Some errors occur after running cmake .. in a QEMU VM. Attached is the cmake log file.
cmake_error_log.txt (6.9 KB)

What I want to do is build LVGL as a normal C library for Embedded Linux (to be used with a programming language like Kotlin for example), which contains a generated shared library file. It is very common on Linux to distribute C libraries as shared library files. I intend to use LVGL for a Hello World type project which will run on a Raspberry Pi 4 using the Linux Frame Buffer backend.

The LVGL build process is broken. Embedded Linux support is absent from the build process, and there is no way to specify the target (eg Linux ARM-A v7; with Kotlin Native the target would be known as linuxArm32Hfp).

Currently attempting the C library header only method which is running into some unexpected issues. First major issue is the broken include paths:

> Task :cinteropLvglLinuxArm32Hfp FAILED
Exception in thread "main" java.lang.Error: /home/napperley/idea_projects/lvgl-test/lv_drivers/display/fbdev.h:33:10: fatal error: 'lvgl/lvgl.h' file not found

Some users who are using the C programming language are running into the same issue (fbdev.h:33:10: fatal error: 'lvgl/lvgl.h' file not found) where there is no fix. It is possible to work around the issue by applying an ugly hack to fbdev.h:

// Prepend this line to the header file.
#define LV_LVGL_H_INCLUDE_SIMPLE 1

Second major issue (after working around the first major issue) is that some symbols are missing/undefined, like lv_disp_buf_init for example. With the Linux Frame Buffer example there is no way it will work. Did anyone check to see if the example works?

I have created a project that provides a Hello World type program using the LVGL library which is written in Kotlin. Currently the project hasn’t been tested to see if the program will actually run on a SBC running some form of Embedded Linux (eg Raspberry Pi). Some adjustments may be required in order to get the program to run.

How does one include a C header only library where the definitions are in the C source file instead of the header file? When running the program a symbol lookup error occurs:

undefined symbol: lv_init

Building both the LVGL and LV Drivers libraries via CMake, and using the generated static library files in the project has done the trick. The program now works although the end result is different from what is shown in the blog post. For example the text is fuzzy and the l letter doesn’t look like an actual l.