TobleMiner / mk_esp32fat

A simple tool for building FAT filesystem images for the ESP32 fatfs with wear levelling support
Apache License 2.0
15 stars 4 forks source link

[Windows] Errors on running make - typedefs with __ fail #1

Open jcsbanks opened 5 years ago

jcsbanks commented 5 years ago

I'm on this ESP IDF: commit c76f00373fa695c017cd0c8cd0f6d622c7dffd5f (HEAD -> release/v3.3, origin/release/v3.3)

On make:

In file included from /usr/include/sys/select.h:15:0, from /usr/include/sys/types.h:68, from /usr/include/time.h:28, from /home/jcsba/esp/esp-idf/components/spi_flash/sim/stubs/newlib/include/sys/lock.h:3, from /usr/include/sys/_types.h:25, from /usr/include/sys/reent.h:15, from /usr/include/stdio.h:60, from src/main.c:1: /usr/include/sys/_timeval.h:35:9: error: unknown type name ‘suseconds_t’ typedef __suseconds_t suseconds_t; ^~~~~ /usr/include/sys/_timeval.h:40:9: error: unknown type name ‘_TIMET’ typedef _TIMET time_t; ^~~~ In file included from /usr/include/time.h:28:0, from /home/jcsba/esp/esp-idf/components/spi_flash/sim/stubs/newlib/include/sys/lock.h:3, from /usr/include/sys/_types.h:25, from /usr/include/sys/reent.h:15, from /usr/include/stdio.h:60, from src/main.c:1: /usr/include/sys/types.h:123:9: error: unknown type name ‘_CLOCKT’ typedef _CLOCKT clock_t; ^~~~~ /usr/include/sys/types.h:150:9: error: unknown type name ‘id_t’ typedef id_t id_t; / can hold a uid_t or pid_t / ^~ /usr/include/sys/types.h:173:9: error: unknown type name ‘off_t’ typedef off_t off_t; / file offset / ^~~ /usr/include/sys/types.h:190:9: error: unknown type name ‘pid_t’ typedef pid_t pid_t; / process id / ^~~ /usr/include/sys/types.h:200:9: error: unknown type name ‘_ssize_t’ typedef _ssize_t ssize_t; ^~~~ /usr/include/sys/types.h:205:9: error: unknown type name ‘__mode_t’ typedef mode_t mode_t; / permissions / ^~~~ /usr/include/sys/types.h:210:9: error: unknown type name ‘nlink_t’ typedef nlink_t nlink_t; / link count / ^~~~~ /usr/include/sys/types.h:215:9: error: unknown type name ‘clockid_t’ typedef clockid_t clockid_t; ^~~ /usr/include/sys/types.h:221:9: error: unknown type name ‘timer_t’ typedef timer_t timer_t; ^~~~~ /usr/include/sys/types.h:227:9: error: unknown type name ‘useconds_t’ typedef useconds_t useconds_t; / microseconds (unsigned) / ^~~~ In file included from /usr/include/sys/types.h:240:0, from /usr/include/time.h:28, from /home/jcsba/esp/esp-idf/components/spi_flash/sim/stubs/newlib/include/sys/lock.h:3, from /usr/include/sys/_types.h:25, from /usr/include/sys/reent.h:15, from /usr/include/stdio.h:60, from src/main.c:1: /usr/include/machine/types.h:33:9: error: unknown type name ‘__loff_t’ typedef __loff_t loff_t; ^~~~ In file included from /usr/include/sys/reent.h:15:0, from /usr/include/stdio.h:60, from src/main.c:1: /usr/include/sys/_types.h:175:9: error: unknown type name ‘_LOCK_RECURSIVE_T’ typedef _LOCK_RECURSIVE_T _flock_t; ^~~~~ make: *** [Makefile:92: build/main.o] Error 1

TobleMiner commented 5 years ago

Hey,

I'm not quite sure why this is happening. I've just rebuild the tool using ESP-IDF v3.3 and it worked just fine. Since at least _LOCK_RECURSIVE_T is defined in glibc newlib I'd guess that you local libc version is either not a glibc or misses required headers. Please try installing glibc headers. (package libc6-dev for debian based systems)

jcsbanks commented 5 years ago

Thanks, I'll see if I can work out how to add that to mingw32.

FrenchLab47 commented 5 years ago

Hello,

I also have the same mistakes when I run "make".

I tried several versions of ESP-IDF and I re-installed Python in several ways. I specify that I work with Windows 10.

I also have a problem writing a verified .bin image on the Fat partition of my ESP32 with Python. The write_flash command seems to work correctly with the correct address (progression ok 0% ... 100%) but the partition remains empty.

Finally I managed to upload my files by programming my ESP32 as an FTP server, but it's a lot of manipulation, and I would like a simple solution like "Upload Data files" from Arduino.

All your ideas will be welcome. Thank you.

TobleMiner commented 5 years ago

I've to admit that I have not tried building under Windows using Arduino at all. I'm not quie sure how flashing and flash layout are handled by the Arduino IDE. If I have enough spare time I'll try investigating this after the weekend.

FrenchLab47 commented 5 years ago

Thank you, I will also continue to search.

gsteckman commented 5 years ago

I'm also trying to build under Windows. No Arduino, just plain IDF, and I get the same errors. I tried both v3.2 and latest versions of IDF.

TobleMiner commented 5 years ago

Ok, I'll try looking into it again. May take me a few days though since my plate is really full atm.

FrenchLab47 commented 5 years ago

Thank you for relaunching the subject. Just a question : Would it be possible to provide a compiled .jar file to add to the tools folder of Arduino IDE? Or it must absolutely be compiled with windows?

TobleMiner commented 5 years ago

Um, I'm not quite sure where Java comes into play here? All code run is pure C. Providing precompiled executables is pretty difficult since the partition code depends on your partition layout and the layout is defined at compile time. One could probably rewrite the code to parse new parition and flash layouts at runtime but that would be pretty difficult.

gsteckman commented 5 years ago

I got it to compile, and I was able to create an image, flash it to the esp32, and read back a file, so it appears to be working. I had to make the following changes:

  1. In the file ${IDF-PATH}/components/spi_flash/sim/stubs/newlib/include/sys/lock.h: a) comment out line 3, #include b) insert line 10 with the following: typedef _lock_t _LOCK_RECURSIVE_T;

time.h isn't used within this file, so it isn't necessary. Once you do that, most of the original reported errors don't occur. I don't know why the 2nd change (b) is required - that is, why isn't it correctly defined somewhere?

  1. In the file /usr/include: a) comment out line 115, size_t strlcat (char , const char , size_t); b) comment out line 116, size_t strlcpy (char , const char , size_t);

Once I made the changes from #1 above, I got these errors:

/usr/include/string.h:115:1: error: declaration does not declare anything [-fpermissive] size_t strlcat (char , const char , size_t); ^~ /usr/include/string.h:116:1: error: declaration does not declare anything [-fpermissive] size_t strlcpy (char , const char , size_t);

So I commented out those 2 lines, and it compiled. Fortunately none of the code uses the functions strlcat or strlcpy. I didn't determine the root cause of what was causing this error.

FrenchLab47 commented 5 years ago

Thank you for this information, I will try.

TobleMiner commented 5 years ago

Mh, interesting. Thanks for your work. This is probably an issue with the upstream ESP-IDF code then? Unfortunately I'm still pretty busy and didn't find any time to investigate the issue properly.

gsteckman commented 5 years ago

I think it's some combination of ESP-IDF, msys32, and/or the toolchain.