乐鑫技术交流
直播中

罗星

8年用户 1575经验值
擅长:模拟技术
私信 关注
[问答]

编译IDF example/hello_world例程时,编译报错说找不到lwip inet.h头文件,为什么?

大家好,我在编译IDF example/hello_world例程时,编译报错说找不到lwip inet.h头文件,但是我到该路径下发现了该头文件,这是为什么?还有组件lwip并没有源码,该如何更新lwip源码 ?git submodule update指令不能更新该代码,期待你的回答,谢谢!

编译信息如下:
jinming.lu@CNSHA0900L MINGW32 ~/esp/esp-idf
$ git submodule update

jinming.lu@CNSHA0900L MINGW32 ~/esp/esp-idf
$ cd ..

jinming.lu@CNSHA0900L MINGW32 ~/esp
$ cd hello_world/

jinming.lu@CNSHA0900L MINGW32 ~/esp/hello_world
$ make
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
Compiler version: 5.2.0
Python requirements from C:/esp32/msys32/home/jinming.lu/esp/esp-idf/requirement                           s.txt are satisfied.

Project is not inside a git repository, will not use 'git describe' to determine                            PROJECT_VER.
App "hello-world" version: 1
CC build/coap/libcoap/src/address.o
In file included from C:/esp32/msys32/home/jinming.lu/esp/esp-idf/components/coa                           p/libcoap/src/address.c:11:0:
C:/esp32/msys32/home/jinming.lu/esp/esp-idf/components/lwip/port/esp32/include/a                           rpa/inet.h:18:49: fatal error: ../../../lwip/src/include/lwip/inet.h: No such fi                           le or directory
compilation terminated.
make[1]: *** [/home/jinming.lu/esp/esp-idf/make/component_wrapper.mk:290:libcoa                           p/src/address.o] 错误 1
make: *** [C:/esp32/msys32/home/jinming.lu/esp/esp-idf/make/project.mk:551:comp                           onent-coap-build] 错误 2


                           

回帖(1)

潘飘稚

2024-6-26 17:31:47
根据您提供的信息,我将分步分析问题并提供解决方案。

1. 首先,确保您已经正确克隆了esp-idf仓库。在克隆时,需要使用`--recursive`选项,以便同时克隆子模块。例如:

```
git clone --recursive https://github.com/espressif/esp-idf.git
```

如果您之前没有使用`--recursive`选项,可以尝试以下命令来更新子模块:

```
git submodule update --init --recursive
```

2. 确保您的工作目录是正确的。根据您提供的命令,您已经切换到了`hello_world`目录。请确保您在该目录下运行`make`命令。

3. 检查您的环境变量设置。确保`PATH`和`IDF_PATH`环境变量已经正确设置。`IDF_PATH`应该指向您的esp-idf目录。例如:

```
export IDF_PATH=~/esp/esp-idf
```

4. 确保您的makefile正确地包含了lwip的头文件路径。在`hello_world`目录下,找到`Makefile`或`CMakeLists.txt`文件,检查是否包含了以下行:

```
COMPONENT_INCLUDES := $(COMPONENT_PATH)/include
```

5. 如果以上步骤都无法解决问题,您可以尝试手动将lwip头文件路径添加到编译器的搜索路径中。在`make`命令中添加以下参数:

```
make EXTRA_CFLAGS="-I$(IDF_PATH)/components/lwip/include/lwip"
```

6. 如果问题仍然存在,您可以尝试重新克隆esp-idf仓库,并确保使用`--recursive`选项。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分