LVGL Linux Framebuffer Driver - Functions not declared

Description

Im new to LVGL and Im currently trying to set it up. I want to develop an application for my RPI4 which should run on a linux framebuffer. Im currently using CLion with an SSH Remote Project to develop the project.
Im currently trying to create a simple HelloWorld program but Im failing at including the framebuffer driver correctly. All its functions (e.g. ‘fbdev_init()’, ‘lv_linux_fbdev_set_file’…) are marked as undeclared even tho I included ‘fbdev.h’ and CMake does not output any errors.

What MCU/Processor/Board and compiler are you using?

My source code is on my host machine (Windows 10) and CLion syncs it with my RaspberryPi 4. It executes CMake and compiles on the RPI.

What do you want to achieve?

I want to start working with LVGL and Im trying to create a simple HelloWorld project which is displayed on a linux framebuffer (which is displayed on a GC9A01 connected via SPI).

What have you tried so far?

I tried manually cloning and including lvgl and lv-drivers, fetching it with CMake and other kinds of inclusions I found online. I set #define LV_USE_LINUX_FBDEV 1 in the lv_conf.h

Code to reproduce

My CMakeLists.txt

cmake_minimum_required(VERSION 3.25)
include(FetchContent)

project(LVGL-Display-C LANGUAGES C CXX)
set(CMAKE_C_STANDARD 99)

# Build an executable called "LVGL-Display-C"
add_executable(LVGL-Display-C src/main.c)

# Specify path to own LVGL config header
set(LV_CONF_PATH
        ${CMAKE_CURRENT_SOURCE_DIR}/src/lv_conf.h
        CACHE STRING "" FORCE)

# Fetch LVGL from GitHub
FetchContent_Declare(lvgl GIT_REPOSITORY https://github.com/lvgl/lvgl.git)
FetchContent_MakeAvailable(lvgl)

# Fetch LVGL drivers from GitHub
FetchContent_Declare(lv_drivers GIT_REPOSITORY https://github.com/lvgl/lv_drivers)
FetchContent_MakeAvailable(lv_drivers)

# Include directories
target_include_directories(LVGL-Display-C PRIVATE
        ${lvgl_SOURCE_DIR}
        ${lv_drivers_SOURCE_DIR}
        ${lv_drivers_SOURCE_DIR}/display
    )

# The target "LVGL-Display-C" depends on LVGL
target_link_libraries(LVGL-Display-C PRIVATE lvgl::lvgl lvgl::drivers)

# Add definitions
target_compile_definitions(LVGL-Display-C PRIVATE LV_CONF_INCLUDE_SIMPLE=1)

My main.c

// lib includes
#include "lvgl.h"
#include "display/fbdev.h"

int main(void)
{
    // Init LVGL
    lv_init();

    // Create display
    lv_display_t *disp = lv_linux_fbdev_create();
    lv_linux_fbdev_set_file(disp, "/dev/fb0");

    return 0;
}

The “Create display” lines are copied from the wiki.

Screenshot and/or video

Here is a screenshot of the error Im getting. IntelliSense doesnt even suggest the fbdev functions so it doesnt find them at all…

Your best starting point with Linux Frame Buffer is the repo below,

Read the repo’s readme, clone the repo compile and run.

Already tried that but couldnt get it to run. At first it gave me the error:

[Error] (4160866.420, +4160866420)       lv_display_set_buffers: Asserted at expression: stride * h <= buf_size DIRECT mode requires screen sized buffer(s) lv_display.c:420

After changing #define LV_LINUX_FBDEV_RENDER_MODE in the lv_conf.h from

LV_DISPLAY_RENDER_MODE_DIRECT
to
LV_DISPLAY_RENDER_MODE_PARTIAL

I get this error ioctl(FBIOBLANK): Invalid argument.

Im compiling and running it directly on my raspberry pi with a framebuffer. Any idea whats wrong?

I just did cloned, built and ran the repo code as is and it runs fine on the pi I used to test it.
I am running a pi5 with bookworm 64 bit with the vc4-kms-v3d driver disabled.
in /boot/firmware/config.txt change the following,
#dtoverlay=vc4-kms-v3d

That did the trick. Ill have a look at the example now, thank you!

What I just realized: My functions are marked as not declared but the app does compile and run. Seems like its an issue of CLion.