lv_platformio icon indicating copy to clipboard operation
lv_platformio copied to clipboard

MacOS:'SDL2/SDL.h' file not found

Open TANG617 opened this issue 2 years ago • 3 comments

When I try to compile main.c, I encounter this problem. The details are as follow

> Executing task: platformio run --environment emulator_64bits <

Processing emulator_64bits (platform: native@^1.1.3)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <lvgl> 8.2.0
|-- <lv_drivers> 8.2.0
|   |-- <lvgl> 8.2.0
Building in release mode
Compiling .pio/build/emulator_64bits/lib44b/lv_drivers/sdl/sdl.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_2.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_2_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_3.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_3_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_4.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_4_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_list_border.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:53:10: fatal error: 'SDL2/SDL.h' file not found
#include SDL_INCLUDE_PATH
         ^~~~~~~~~~~~~~~~
<command line>:12:26: note: expanded from here
#define SDL_INCLUDE_PATH "SDL2/SDL.h"
                         ^~~~~~~~~~~~
1 error generated.
*** [.pio/build/emulator_64bits/lib44b/lv_drivers/sdl/sdl.o] Error 1
========================== [FAILED] Took 2.36 seconds ==========================

Environment      Status    Duration
---------------  --------  ------------
emulator_64bits  FAILED    00:00:02.365
==================== 1 failed, 0 succeeded in 00:00:02.365 ====================
终端进程“platformio 'run', '--environment', 'emulator_64bits'”已终止,退出代码: 1。

终端将被任务重用,按任意键关闭。

I Found Some Solution On This Website https://stackoverflow.com/questions/10488775/sdl-h-no-such-file-or-directory-found-when-compiling I think it's the solution to this SDL problem, but I still don't know how to fix it. THX for your help!

TANG617 avatar Apr 20 '22 12:04 TANG617

  1. brew install sdl2

  2. find header and lib path brew list sdl2 example: image

  3. config plamio.ini

image

  1. enjoy it!

wupeaking avatar Jun 14 '22 11:06 wupeaking

@TANG617 https://github.com/lvgl/lv_platformio#install-sdl-drivers did you installed sdl as been said in readme?

puzrin avatar Jun 17 '22 18:06 puzrin

for M1, add -arch arm64

After lots of gyrations, I did manage to compile and execute this project on a Mac M1. The change was simple. Add a few items to build_flags in platformio.ini -arch arm64 -I /opt/homebrew/include -L /opt/homebrew/lib https://github.com/lvgl/lv_platformio/issues/29#issuecomment-1251725224

fbiego avatar Sep 21 '22 09:09 fbiego

@TANG617 I encountered the same problem on Windows 10. I fix it through the following method:

image

sslogan666 avatar Nov 10 '22 02:11 sslogan666

Thanks you guys a lot! I have tried the solution and problem was solved!

TANG617 avatar Dec 12 '22 15:12 TANG617