warmcat / libwebsockets

canonical libwebsockets.org networking library
https://libwebsockets.org
Other
4.77k stars 1.49k forks source link

Error Compiling with ESP-IDF #995

Closed tbnobody closed 7 years ago

tbnobody commented 7 years ago

Hello,

I just tried to implement a simple webserver on the ESP32. When I try to compile libwebsockts I get the following message:

esptool.py v2.1-beta1
/home/thomas/esp/esp-idf/components/ulp/../build/romfs.img: No such file or directory
stat: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/romfs.img': No such file or directory
stat: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/software.bin': No such file or directory
             Original length: 0x000000 (       0)
/bin/bash: line 7: % 256 : syntax error: operand expected (error token is "% 256 ")
/bin/bash: line 7: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 8: (  / 256 ) % 256 : syntax error: operand expected (error token is "/ 256 ) % 256 ")
/bin/bash: line 8: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 9: (  / 65536 ) % 256 : syntax error: operand expected (error token is "/ 65536 ) % 256 ")
/bin/bash: line 9: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 10: (  / 16777216 ) % 256 : syntax error: operand expected (error token is "/ 16777216 ) % 256 ")
/bin/bash: line 10: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 11: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
stat: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/software.bin': No such file or directory
/bin/bash: line 14: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 15: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 16: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 17: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 18: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 19: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 20: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 21: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 22: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 23: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 24: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 25: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 26: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 27: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
/bin/bash: line 28: /home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo: No such file or directory
stat: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/json-buildinfo': No such file or directory
/bin/bash: line 30: % 256 : syntax error: operand expected (error token is "% 256 ")
/bin/bash: line 30: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 31: (  / 256 ) % 256 : syntax error: operand expected (error token is "/ 256 ) % 256 ")
/bin/bash: line 31: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 32: (  / 65536 ) % 256 : syntax error: operand expected (error token is "/ 65536 ) % 256 ")
/bin/bash: line 32: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 33: (  / 16777216 ) % 256 : syntax error: operand expected (error token is "/ 16777216 ) % 256 ")
/bin/bash: line 33: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
/bin/bash: line 34: /home/thomas/esp/esp-idf/components/ulp/../build/software.bin: No such file or directory
cp: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/software.bin': No such file or directory
stat: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/software.bin': No such file or directory
cp: cannot stat '/home/thomas/esp/esp-idf/components/ulp/../build/software.bin': No such file or directory
    After ROMFS + Build info: 0x000000 (       0)
To flash all build output, run 'make flash' or:

In my opinion the path of the ulp component makes no sense here. But I don't know where it comes from.

My Makefile for the IDF project looks as followed:

PROJECT_NAME := wordclock

LWS_IS_FACTORY_APPLICATION=0
export LWS_IS_FACTORY_APPLICATION

include $(IDF_PATH)/make/project.mk
include sdkconfig
include ${PWD}/components/libwebsockets/scripts/esp32.mk

CFLAGS+= -I$(COMPONENT_PATH)/../components/libwebsockets/plugins  -DLWS_IS_FACTORY_APPLICATION=$(LWS_IS_FACTORY_APPLICATION)

export IDF_PATH

I had a look at the esp32.mk file and just saw this line: jbi=$(COMPONENT_PATH)/../build/json-buildinfo in my build directory there is no json-buildinfo file. Is this maybe a problem with a newer ESP-IDF version?

lws-team commented 7 years ago

It looks like HEAD esp-idf has moved on too much and needs fixing.

You can work around it by doing this in your esp-idf dir

git reset --hard 15a61459610d6ead47d0a940bba65215c37a541d

which is the esp-idf version I was building with. You can force yourself back to esp-idf HEAD with

git reset --hard origin/master

later when I update the lws pieces against latest esp-idf.

tbnobody commented 7 years ago

I don't know whether it helps, figured out, that the latest working commit is 2c1fe6663d7532fd3e0d703540f143a6ce39aa9a The next commit 2571e66a295b26a222775e8e61b2cf05ce2e16de throws the error.

lws-team commented 7 years ago

Yeah... COMPONENT_PATH in the toplevel project makefile has changed its meaning in latest esp-idf.

commit 2571e66a295b26a222775e8e61b2cf05ce2e16de
Author: Angus Gratton <gus@projectgus.com>
Date:   Wed Jun 21 14:41:04 2017 +1000

    build system: Make component searching more explicit, obsolete SRCDIRS

I am working through it adapting the lws / app pieces and will post again when it's pushed and working. But for now you can just use the last happy esp-idf.

lws-team commented 7 years ago

Well I adapted the build process okay for latest esp-idf, but it looks like the bootloader also changed, So I'll look at that next.

lws-team commented 7 years ago

I updated -factory and -test-server-apps for the new esp-idf changes. It's tested against esp-idf 969f1bb9be1ce02f37115359111852a9bd2c9197 from Aug 15th.

You'll need to make one change in your forked Makefile if you still have the line:

CFLAGS+= -I$(COMPONENT_PATH)/../components/libwebsockets/plugins ...

it will need to become

CFLAGS+= -I$(PROJECT_PATH)/components/libwebsockets/plugins ...

Edit: ...and you will need to do a git pull in your ./components/libwebsockets subproject to update it to the latest.