新建项目编译失败,New project Compilation failed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

新建项目编译失败,New project Compilation failed

1,101 Views
laoma1108
Contributor I

从这行开始报错,Error comes from this line

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/monitor.c:20:10: fatal error: 'SDL2/SDL.h' file not found
#include MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drv_conf.h:102:39: note: expanded from macro 'MONITOR_SDL_INCLUDE_PATH'
# define MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~
:64:1: note: expanded from here

^~~~~~~~~~~~
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mouse.c
make: *** [build/object/monitor.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/keyboard.c:9:
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/keyboard.h:36:10: fatal error: 'SDL2/SDL.h' file not found
#include MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drv_conf.h:102:39: note: expanded from macro 'MONITOR_SDL_INCLUDE_PATH'
# define MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~
:64:1: note: expanded from here

^~~~~~~~~~~~
1 error generated.
make: *** [build/object/keyboard.o] Error 1
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mouse.c:9:
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mouse.h:36:10: fatal error: 'SDL2/SDL.h' file not found
#include MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drv_conf.h:102:39: note: expanded from macro 'MONITOR_SDL_INCLUDE_PATH'
# define MONITOR_SDL_INCLUDE_PATH
^~~~~~~~~~~~
:64:1: note: expanded from here

^~~~~~~~~~~~
make: *** [build/object/mouse.o] Error 1
Compilation failed!
0 Kudos
Reply
11 Replies

1,038 Views
HangZhang
NXP Employee
NXP Employee

Hi @laoma1108 

根据这个报错信息,

这个错误是因为编译器找不到'SDL2/SDL.h'头文件。要解决这个问题,你需要确保已经安装了SDL2库,并且头文件路径已经添加到编译器的搜索路径中。

首先,确保你已经安装了SDL2库。在macOS上,你可以使用Homebrew来安装:

brew install sdl2

安装完成后,你需要找到SDL2头文件的路径。通常,它们位于/usr/local/include/SDL2/usr/include/SDL2。然后,你需要将这个路径添加到编译器的搜索路径中。在你的Makefile或者编译命令中,添加-I选项,后面跟上SDL2头文件的路径。

BR

Hang

0 Kudos
Reply

1,029 Views
laoma1108
Contributor I
SDL2/SDL_stdinc.h:426:5: error: call to undeclared function 'memset_pattern4'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
memset_pattern4(dst, &val, dwords * 4);
^
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/../custom/custom.c
In file included from main.c:14:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/../lvgl/lvgl.h:28:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/../lvgl/src/misc/lv_mem.h:20:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:156:10: error: conflicting types for 'memset_pattern4'
void memset_pattern4(void *__b, const void *__pattern4, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);
^

 

查找整个项目发现有三个地方条件编译,判断了mac电脑的情况下,调用函数
memset_pattern4
提示找不到该方法,不知道是因为此版本SDL不支持Mac还是不支持Mac 的M3?

 

Searching 808 files for "memset_pattern4"

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/SDL2/include/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

3 matches across 3 files


Searching 808 files for "memset_pattern4"

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/SDL2/include/SDL2/SDL_stdinc.h:
  424  {
  425  #ifdef __APPLE__
  426:     memset_pattern4(dst, &val, dwords * 4);
  427  #elif defined(__GNUC__) && defined(i386)
  428      int u0, u1, u2;

3 matches across 3 files

 

0 Kudos
Reply

991 Views
HangZhang
NXP Employee
NXP Employee

Hi @laoma1108 

这个问题是由于在Mac系统上,memset_pattern4函数没有被定义。你可以尝试使用memset函数替代memset_pattern4,或者检查你的编译器和库是否支持memset_pattern4函数。
如果你想使用memset函数,可以将以下代码替换到SDL_stdinc.h文件中的相关位置:#ifdef __APPLE__
memset(dst, val, dwords * 4);
#elif defined(__GNUC__) && defined(i386)
int u0, u1, u2;

这样,当编译到Mac系统时,将使用标准的memset函数。

BR

Hang

0 Kudos
Reply

976 Views
laoma1108
Contributor I

虽然将 memset_pattern4 修改为 memset 解决了之前条件编译的错误,但是又引发了新的问题:

我的Mac OS 版本为 Sonoma 14.4,看起来在此环境下没法正常的运行,不知道官方发布时是否测试过这个环境? 是因为我的环境和gui-guider冲突还是安装gui-guider时候缺少安装依赖导致的呢?

期待有新的更新可以完美解决此问题

SDL2/SDL_stdinc.h:427:17: error: incompatible pointer to integer conversion passing 'Uint32 *' (aka 'unsigned int *') to parameter of type 'int' [-Wint-conversion]
memset(dst, &val, dwords * 4);
^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:77:33: note: expanded from macro 'memset'
__builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
^~~~~~~~~~~
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mousewheel.c
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/evdev.c
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/libinput.c
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/XPT2046.c
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/keyboard.c:9:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/keyboard.h:36:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL.h:32:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_main.h:25:
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:427:17: error: incompatible pointer to integer conversion passing 'Uint32 *' (aka 'unsigned int *') to parameter of type 'int' [-Wint-conversion]
memset(dst, &val, dwords * 4);
^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:77:33: note: expanded from macro 'memset'
__builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
^~~~~~~~~~~
Compiling /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/win_drv.c
make: *** [build/object/monitor.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mousewheel.c:9:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/indev/mousewheel.h:36:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL.h:32:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_main.h:25:
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:427:17: error: incompatible pointer to integer conversion passing 'Uint32 *' (aka 'unsigned int *') to parameter of type 'int' [-Wint-conversion]
memset(dst, &val, dwords * 4);
^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:77:33: note: expanded from macro 'memset'
__builtin___memset_chk (dest, __VA_ARGS__, __darwin_obsz0 (dest))
^~~~~~~~~~~
1 error generated.
make: *** [build/object/mouse.o] Error 1
make: *** [build/object/keyboard.o] Error 1
1 errorIn file included from main.c:13:
In file included from generated.
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL.h:32:
In file included from /Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_main.h:25:
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:427:5: error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
memset(dst, &val, dwords * 4);
^
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:427:5: note: include the header or explicitly provide a declaration for 'memset'
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/lv_drivers/display/SDL2/SDL_stdinc.h:427:17: error: incompatible pointer to integer conversion passing 'Uint32 *' (aka 'unsigned int *') to parameter of type 'int' [-Wint-conversion]
memset(dst, &val, dwords * 4);
^~~~
make: *** [build/object/mousewheel.o] Error 1
2 errors generated.
make: *** [build/object/main.o] Error 1
/Users/martinmao/GUI-Guider-Projects/esp-cnc/lvgl-simulator/../generated/guider_fonts/lv_font_SourceHanSerifSC_Regular_18.c:160760:18: warning: implicit conversion from 'double' to 'lv_coord_t' (aka 'short') changes value from 2.7 to 2 [-Wliteral-conversion]
.base_line = 2.6999999999999997 , /*Baseline measured from the bottom of the line*/
^~~~~~~~~~~~~~~~~~
1 warning generated.
Compilation failed!

 

0 Kudos
Reply

879 Views
HangZhang
NXP Employee
NXP Employee

Hi @laoma1108 

是否尝试了最新版的GUI Guider

BR

Hang

0 Kudos
Reply

696 Views
laoma1108
Contributor I
是的我用的是最新版,版本1.8.0-GA (1.8.0-GA)
0 Kudos
Reply

601 Views
HangZhang
NXP Employee
NXP Employee

Hi @laoma1108 

可以分享一下您的工程么?

我们尝试复现您的问题。

BR

Hang

0 Kudos
Reply

397 Views
laoma1108
Contributor I

通过网盘分享的文件:esp-cnc.zip
链接: https://pan.baidu.com/s/1Y0gI4_wPtOxnHzM_z8SbZg?pwd=y8u6 提取码: y8u6

 

截屏2024-09-27 18.13.53.png截屏2024-09-27 18.14.02.png

0 Kudos
Reply

343 Views
HangZhang
NXP Employee
NXP Employee

Hi @laoma1108 

很抱歉,我确认了一下,我们目前官方支持M2,M3的环境没有验证过。

BR

Hang

0 Kudos
Reply

1,028 Views
laoma1108
Contributor I

我用的是从这里copy过去的SDL2

0 Kudos
Reply

1,093 Views
laoma1108
Contributor I
CPU: Mac M3 Pro, lvgl version : v8.3.10
Any one can help?
0 Kudos
Reply