What libraries do I need to link with and in what order?

Description

I have built and ran the lvlgsim using the lv_port_linux from GITHub and it runs fine. It is installed in my workspace next to my code project for an embedd logging application. I can get my code to find all the include files for lvgl, but when it comes to liking in the libraries of lvgl, I start getting errors that it can’t find references to certain functions.
Example: /usr/bin/ld: /home/pi/projects/QT_Logger/lv_port_linux/build/lvgl/lib/liblvgl.a(lv_wayland.c.o): in function wl_display_get_registry': [build] lv_wayland.c:(.text+0x10): undefined reference to wl_proxy_get_version’

In my vscode workspace I have the lvgl project and my project side by side. I am pretty sure it is a linking issue, but I haven’t been able to find anything that list the necessary libraries I need to link to and in what order thay need to be linked. I want to be able to build in my project and link in the lvgl libraries.

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

I’m building on a Raspberrry 5 and using VSCODE as my editor/debugger.

What do you want to achieve?

What have you tried so far?

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

I have solved my problem. Since I am using a separate project next to the lvgl project, I must find and link the needed Wayland and xkbcommon libraries that are part of the system. I haven’t had to work with cmake files in many years and it has change a lot. But I now have it all building and starting to experiment with creating a display on the PI 5.

Hi @twhittaker, great job. Could give more details how you solve this problem?

I certainly will as soon as I get back home next week sometime.

1 Like

Basically I had already started a project on the PI 5 using VS Code.
I used the instructions for the lv_port_linux and cloned it into my existing workspace folder, ie:
MyWorkSpace

  • MyWorkFiles
  • lv_port_linux

Next I went into the the lv_port_Linux folder.
Since PI5 comes with Wayland drivers by default I built the lv_conf.h file with those defaults

  • issue the command: cmake -B build -DCONFIG=wayland
  • This will build the correct lv_conf.h file set up for wayland drivers

Next I just ran the following to cmake commands:

  • cmake -B build
  • cmake --build build -j$(nproc)
    This compiles all the necessary lvgl files and creates the two main libraries
  • liblvgl.a and liblvgl_thorvg.a

After this you can run the lvglsim to chech out the demo progam that gets build.
After that I modified the lv_conf.h file to not build the examples and demos to save space by setting the defines to zero

  • /** Enable examples to be built with the library. /
    #define LV_BUILD_EXAMPLES 0
    /
    * Build the demos */
    #define LV_BUILD_DEMOS 0

Run the two cmake commands again and you should be ready to go.
The only other thing I have to work on was setting the correct paths to link the lvgl libraries into my project. It uses a CMakelList.txt file as well and it has been years since I worked with CMake files.