I faced "undefined reference to `lv_linux_fbdev_create'" error


I faced “undefined reference to `lv_linux_fbdev_create’” error message. How can I solve it?
I’m using lvgl lastest version. and I’d like to use lvgl library on linux embedded device.
I tested it as below:

  1. Downloads LVGL repository.

  2. copy to my project folder

  3. copy lv_conf.h file from lv_conf_template.h
    my_project folder/
    - src
    - lvgl
    - lv_conf.h

  4. set Crosscompiler on CMakelist file.

$ cd ./lvgl
$ gedit ./CMakeLists.txt
cmake_minimum_required(VERSION 3.12.4)

set(CMAKE_C_COMPILER "/opt/ivot/aarch64-ca53-linux-gnueabihf-8.4.01/usr/bin/aarch64-ca53-linux-gnu-gcc")
  1. modified lv_conf.h config
  1. build lvgl lib
$ cd ./lvgl
$ mkdir ./build && cd ./build
$ cmake ..
$ make -j
  1. added lvgl.mk file and liblvgl.a file on the my project Makefile
LVGL_DIR_NAME = lvgl     #The name of the lvgl folder (change this if you have renamed it)
LVGL_DIR = ${shell pwd}  #The path where the lvgl folder is
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/lvgl.mk
$(TARGETS): %: %.c Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LVGL_LIB)/liblvgl.a
  1. added source code
// LVGL Library
#include "lvgl.h"
int main(int argc, char *argv[])

    /*Linux frame buffer device init*/
    lv_display_t * disp = lv_linux_fbdev_create();
  1. Build my application.

and I faced these problems.
lv_init() is okay.
but, build system can’t find lv_linux_fbdev_create();

dvr.c:(.text+0x4a64): undefined reference to `lv_linux_fbdev_create'

It seems that lv_linux_fbdev_create is not included inside liblvgl.a.

I’m curious how to set it up so it can be included and built.

Please let me know if there is anything else I missed.

Your best starting point with linux frame buffer is this repo,

GitHub - lvgl/lv_port_linux_frame_buffer: LVGL configured to work with a standard Linux framebuffer.

If you follow the readme it should compile.

To add an evdev pointer to main, (make sure LV_USE_EVDEV 1 in lv_conf.h
This works on Raspberry Pi with official 7" DSI display.

int main(void)

    /*Linux frame buffer device init*/
    lv_display_t * disp = lv_linux_fbdev_create();
    lv_linux_fbdev_set_file(disp, "/dev/fb0");

    /*Linux evdev init*/
    lv_indev_t * indev = lv_evdev_create(LV_INDEV_TYPE_POINTER, "/dev/input/event0");
    lv_evdev_set_calibration( indev, 799, 479, 0, 0 );

#if 0
    /*Create a Demo*/
    char * name = 
    lv_demos_create(&name, 1); 

    /*Handle LVGL tasks*/
    while(1) {
        uint32_t ms = lv_timer_handler();

    return 0;

I still faced undefined reference to `lv_linux_fbdev_create’ error…
How can I use lv_linux_fbdev_create() function?

Following the instructions above on a Raspberry Pi 4 running Raspberry Pi OS Lite (64 bit) - Bookworm it compiles and runs without the undefined reference problem you mention. The only additional requirement is that cmake be installed.

Your response has no information that anyone can use to help you. If you want help, then try to provide some detail of significance that could help diagnose your problem.

For example, what MCU/Processor/Board and compiler are you using ? How does your platform differ from what I have described above ? What other distinguishing information of significance can you provide ?