Hi all,
I am trying to compile lvgl for RISCV, with riscv64-unknown-linux-gnu, on vscode
https://github.com/lvgl/lv_port_pc_vscode
The code compiles, but it makes error when linking,
Is the problem architecture (x86-64 - RISCV) difference? or something else?
I attached linux “file” command output of libSDL2.so;
test@test-virtual-machine:~/SDL2-2.30.8$ file /usr/local/lib/libSDL2-2.0.so.0
/usr/local/lib/libSDL2-2.0.so.0: symbolic link to libSDL2-2.0.so.0.3000.8
test@test-virtual-machine:~/SDL2-2.30.8$ file /usr/local/lib/libSDL2-2.0.so.0.3000.8
/usr/local/lib/libSDL2-2.0.so.0.3000.8: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=d177e7ab44b2ca21a2b8af4dbd603f63eaad695b, with debug_info, not stripped
I attached sdl library informations,
test@test-virtual-machine:~/SDL2-2.30.8$ dpkg -l | grep sdl
ii libsdl2-2.0-0:amd64 2.0.10+dfsg1-3 amd64 Simple DirectMedia Layer
ii libsdl2-dev:amd64 2.0.10+dfsg1-3 amd64 Simple DirectMedia Layer development files
ii libsdl2-image-2.0-0:amd64 2.0.5+dfsg1-2 amd64 Image loading library for Simple DirectMedia Layer 2, libraries
ii libsdl2-image-dev:amd64 2.0.5+dfsg1-2 amd64 Image loading library for Simple DirectMedia Layer 2, development files
ii libsdl2-mixer-2.0-0:amd64 2.0.4+dfsg1-2build1 amd64 Mixer library for Simple DirectMedia Layer 2, libraries
ii libsdl2-mixer-dev:amd64 2.0.4+dfsg1-2build1 amd64 Mixer library for Simple DirectMedia Layer 2, development files
ii libsdl2-ttf-2.0-0:amd64 2.0.15+dfsg1-1 amd64 TrueType Font library for Simple DirectMedia Layer 2, libraries
ii libsdl2-ttf-dev:amd64 2.0.15+dfsg1-1 amd64 TrueType Font library for Simple DirectMedia Layer 2, development files
Iam attaching build output below,
[main] Building folder: /home/test/lv_port_pc_vscode/build
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /home/test/lv_port_pc_vscode/build --config Debug --target all --
[build] [10/630 0% :: 0.112] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/lv_font_benchmark_montserrat_12_compr_az.c.c.o
[build] [11/630 0% :: 0.128] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/img_benchmark_cogwheel_indexed16.c.o
[build] [12/630 0% :: 0.144] Building C object CMakeFiles/main.dir/main/src/mouse_cursor_icon.c.o
[build] [13/630 0% :: 0.147] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/lv_font_benchmark_montserrat_16_compr_az.c.c.o
[build] [14/630 0% :: 0.160] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/img_benchmark_cogwheel_argb.c.o
[build] [15/630 0% :: 0.181] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/img_benchmark_cogwheel_rgb.c.o
[build] [16/630 1% :: 0.205] Building C object CMakeFiles/main.dir/main/src/main.c.o
[build] [17/630 1% :: 0.211] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/img_benchmark_cogwheel_alpha256.c.o
[build] [18/630 1% :: 0.216] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/assets/lv_font_benchmark_montserrat_28_compr_az.c.c.o
[build] [19/630 1% :: 0.223] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/benchmark/lv_demo_benchmark.c.o
[build] [20/630 1% :: 0.292] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/flex_layout/lv_demo_flex_layout_view.c.o
[build] [21/630 1% :: 0.312] Building C object lvgl/CMakeFiles/lvgl_demos.dir/demos/flex_layout/lv_demo_flex_layout_flex_loader.c.o
[build] [545/630 85% :: 9.166] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/cache/lv_image_header_cache.c.o
[build] [546/630 85% :: 9.172] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_anim_timeline.c.o
[build] [547/630 85% :: 9.177] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_array.c.o
[build] [548/630 85% :: 9.186] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_anim.c.o
[build] [549/630 85% :: 9.205] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_bidi.c.o
[build] [550/630 85% :: 9.217] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_color_op.c.o
[build] [551/630 86% :: 9.222] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_async.c.o
[build] [552/630 86% :: 9.224] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_area.c.o
[build] [553/630 86% :: 9.228] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_color.c.o
[build] [554/630 86% :: 9.239] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_lru.c.o
[build] [555/630 86% :: 9.262] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_ll.c.o
[build] [556/630 86% :: 9.267] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_event.c.o
[build] [557/630 86% :: 9.273] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_fs.c.o
[build] [558/630 87% :: 9.293] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_log.c.o
[build] [559/630 87% :: 9.309] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_text_ap.c.o
[build] [560/630 87% :: 9.322] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_rb.c.o
[build] [561/630 87% :: 9.339] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_math.c.o
[build] [562/630 87% :: 9.353] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_palette.c.o
[build] [563/630 87% :: 9.359] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_cmsis_rtos2.c.o
[build] [564/630 88% :: 9.383] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_text.c.o
[build] [565/630 88% :: 9.397] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_pthread.c.o
[build] [566/630 88% :: 9.409] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_style_gen.c.o
[build] [567/630 88% :: 9.425] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_profiler_builtin.c.o
[build] [568/630 88% :: 9.425] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_timer.c.o
[build] [569/630 88% :: 9.426] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_utils.c.o
[build] [570/630 89% :: 9.426] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_freertos.c.o
[build] [571/630 89% :: 9.427] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_os_none.c.o
[build] [572/630 89% :: 9.429] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_rtthread.c.o
[build] [573/630 89% :: 9.440] Building C object lvgl/CMakeFiles/lvgl.dir/src/osal/lv_windows.c.o
[build] [574/630 89% :: 9.459] Building C object lvgl/CMakeFiles/lvgl.dir/src/misc/lv_style.c.o
[build] [575/630 89% :: 9.464] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/file_explorer/lv_file_explorer.c.o
[build] [576/630 90% :: 9.489] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/fragment/lv_fragment_manager.c.o
[build] [577/630 90% :: 9.494] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/gridnav/lv_gridnav.c.o
[build] [578/630 90% :: 9.502] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/monkey/lv_monkey.c.o
[build] [579/630 90% :: 9.503] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/snapshot/lv_snapshot.c.o
[build] [580/630 90% :: 9.518] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/vg_lite_tvg/vg_lite_matrix.c.o
[build] [581/630 90% :: 9.528] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/fragment/lv_fragment.c.o
[build] [582/630 90% :: 9.539] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/ime/lv_ime_pinyin.c.o
[build] [583/630 91% :: 9.552] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/sysmon/lv_sysmon.c.o
[build] [584/630 91% :: 9.563] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/clib/lv_sprintf_clib.c.o
[build] [585/630 91% :: 9.573] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/builtin/lv_sprintf_builtin.c.o
[build] [586/630 91% :: 9.582] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/builtin/lv_string_builtin.c.o
[build] [587/630 91% :: 9.594] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/clib/lv_mem_core_clib.c.o
[build] [588/630 91% :: 9.605] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/clib/lv_string_clib.c.o
[build] [589/630 92% :: 9.617] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/builtin/lv_mem_core_builtin.c.o
[build] [590/630 92% :: 9.627] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/imgfont/lv_imgfont.c.o
[build] [591/630 92% :: 9.629] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/builtin/lv_tlsf.c.o
[build] [592/630 92% :: 9.631] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/micropython/lv_mem_core_micropython.c.o
[build] [593/630 92% :: 9.648] Building C object lvgl/CMakeFiles/lvgl.dir/src/others/observer/lv_observer.c.o
[build] [594/630 92% :: 9.660] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/rtthread/lv_sprintf_rtthread.c.o
[build] [595/630 93% :: 9.662] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/rtthread/lv_string_rtthread.c.o
[build] [596/630 93% :: 9.664] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/lv_mem.c.o
[build] [597/630 93% :: 9.665] Building C object lvgl/CMakeFiles/lvgl.dir/src/stdlib/rtthread/lv_mem_core_rtthread.c.o
[build] [598/630 93% :: 9.733] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/button/lv_button.c.o
[build] [599/630 93% :: 9.753] Building C object lvgl/CMakeFiles/lvgl.dir/src/tick/lv_tick.c.o
[build] [600/630 93% :: 9.815] Building C object lvgl/CMakeFiles/lvgl.dir/src/themes/mono/lv_theme_mono.c.o
[build] [601/630 93% :: 9.824] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/bar/lv_bar.c.o
[build] [602/630 94% :: 9.834] Building C object lvgl/CMakeFiles/lvgl.dir/src/themes/lv_theme.c.o
[build] [603/630 94% :: 9.842] Building C object lvgl/CMakeFiles/lvgl.dir/src/themes/simple/lv_theme_simple.c.o
[build] [604/630 94% :: 9.854] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/calendar/lv_calendar_header_arrow.c.o
[build] [605/630 94% :: 9.859] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/arc/lv_arc.c.o
[build] [606/630 94% :: 9.887] Building C object lvgl/CMakeFiles/lvgl.dir/src/themes/default/lv_theme_default.c.o
[build] [607/630 94% :: 9.915] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/buttonmatrix/lv_buttonmatrix.c.o
[build] [608/630 95% :: 9.920] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/canvas/lv_canvas.c.o
[build] [609/630 95% :: 9.934] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/calendar/lv_calendar.c.o
[build] [610/630 95% :: 9.946] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/calendar/lv_calendar_header_dropdown.c.o
[build] [611/630 95% :: 9.975] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/checkbox/lv_checkbox.c.o
[build] [612/630 95% :: 9.995] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/imagebutton/lv_imagebutton.c.o
[build] [613/630 95% :: 10.026] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/keyboard/lv_keyboard.c.o
[build] [614/630 96% :: 10.040] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/dropdown/lv_dropdown.c.o
[build] [615/630 96% :: 10.065] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/led/lv_led.c.o
[build] [616/630 96% :: 10.078] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/image/lv_image.c.o
[build] [617/630 96% :: 10.083] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/line/lv_line.c.o
[build] [618/630 96% :: 10.090] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/list/lv_list.c.o
[build] [619/630 96% :: 10.095] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/chart/lv_chart.c.o
[build] [620/630 96% :: 10.096] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/label/lv_label.c.o
[build] [621/630 97% :: 10.116] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/menu/lv_menu.c.o
[build] [622/630 97% :: 10.153] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/msgbox/lv_msgbox.c.o
[build] [623/630 97% :: 10.209] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/roller/lv_roller.c.o
[build] [624/630 97% :: 10.218] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/slider/lv_slider.c.o
[build] [625/630 97% :: 10.235] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/span/lv_span.c.o
[build] [625/630 97% :: 10.264] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/scale/lv_scale.c.o
[build] [625/630 98% :: 10.270] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/switch/lv_switch.c.o
[build] [625/630 98% :: 10.302] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/spinbox/lv_spinbox.c.o
[build] [625/630 98% :: 10.308] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/spinner/lv_spinner.c.o
[build] [625/630 98% :: 10.333] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/tileview/lv_tileview.c.o
[build] [625/630 98% :: 10.362] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/table/lv_table.c.o
[build] [625/630 98% :: 10.375] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/tabview/lv_tabview.c.o
[build] [625/630 99% :: 10.382] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/textarea/lv_textarea.c.o
[build] [625/630 99% :: 10.389] Building C object lvgl/CMakeFiles/lvgl.dir/src/widgets/win/lv_win.c.o
[build] [626/630 99% :: 10.499] Linking C static library lib/liblvgl.a
[build] [629/630 99% :: 10.516] Linking CXX static library lib/liblvgl_thorvg.a
[build] [629/630 99% :: 10.533] Linking C static library lib/liblvgl_demos.a
[build] [629/630 99% :: 10.566] Linking C static library lib/liblvgl_examples.a
[build] [630/630 100% :: 10.582] Linking CXX executable ../bin/main
[build] FAILED: ../bin/main
[build] : && /opt/riscv/bin/riscv64-unknown-linux-gnu-g++ -march=rv64imafdc -g CMakeFiles/main.dir/main/src/main.c.o CMakeFiles/main.dir/main/src/mouse_cursor_icon.c.o -o ../bin/main -L/usr/local/lib -Wl,-rpath,/usr/local/lib lib/liblvgl.a lib/liblvgl_examples.a lib/liblvgl_demos.a lib/liblvgl_thorvg.a /usr/local/lib/libSDL2.so -lm -lpthread lib/liblvgl.a && :
[build] /opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/14.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /usr/local/lib/libSDL2.so: error adding symbols: file in wrong format
[build] collect2: error: ld returned 1 exit status
[build] ninja: build stopped: subcommand failed.
[proc] The command: /usr/bin/cmake --build /home/test/lv_port_pc_vscode/build --config Debug --target all -- exited with code: 1
[driver] Build completed: 00:00:10.615
[build] Build finished with exit code 1