Page 1 of 1

Cannot compile openOCD-ESP32 within msys2 env

Posted: Thu Jul 20, 2017 7:15 pm
by linuxpaul
Hello,

I'm using Win7 64bit, msys2, mingw32 from ESP with latest updates and the latest clone of openOCD-ESP32.
Running make results in this output:

Code: Select all

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src -I../../../src -I../../../src/helper -DPKGDATADIR=\"/mingw32/share/openocd\" -DBINDIR=\"/mingw32/bin\" -I../../../jimtcl -I../../../jimtcl -isystem D:/Source/msys32/mingw32/include/libusb-1.0 -ID:/Source/msys32/mingw32/include -ID:/Source/msys32/mingw32/include/libusb-1.0 -ID:/Source/msys32/mingw32/include/hidapi -g -O2 -D__USE_MINGW_ANSI_STDIO -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -MT libocdjtagdrivers_la-ftdi.lo -MD -MP -MF .deps/libocdjtagdrivers_la-ftdi.Tpo -c ftdi.c -o libocdjtagdrivers_la-ftdi.o
ftdi.c: In function 'ftdi_handle_set_signal_command':
ftdi.c:854:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
   if (CMD_ARGV[1][1] == '\0') {
      ^
ftdi.c:858:2: note: here
  default:
  ^~~~~~~
cc1.exe: all warnings being treated as errors
make[7]: *** [Makefile:789: libocdjtagdrivers_la-ftdi.lo] Fehler 1
Any ideas what went wrong?

Compiling the same sources under debian9 works very fine.

regards,
linuxpaul

Re: Cannot compile openOCD-ESP32 within msys2 env

Posted: Fri Jul 21, 2017 7:19 am
by f.h-f.s.
make CFLAGS='-Wno-error=implicit-fallthrough'

Re: Cannot compile openOCD-ESP32 within msys2 env

Posted: Fri Jul 21, 2017 9:12 am
by ESP_krzychb
Compiling the same sources under debian9 works very fine.
Indeed compilation with Linux work very fine (and quick)
make CFLAGS='-Wno-error=implicit-fallthrough'
Expanding on answer by @f.h-f.s., the issue report https://github.com/espressif/openocd-esp32/issues/13 provides a recepie how to handle "error: this statement may fall through"

Re: Cannot compile openOCD-ESP32 within msys2 env

Posted: Fri Jul 21, 2017 10:48 am
by linuxpaul
thank you guys,

leading your Posts I found another solution.
make CFLAGS="" seem override other settings (e.g. headerfile not found) but now I knew what I have to looking for.
Wimplicit-fallthrough=3 is implitit from Wextra and can be disabled by Wimplicit-fallthrough=0

After adding the switch -Wimplicit-fallthrough=0 to this Makefiles: (CFLAGS line)
...\openocd-esp32\src\flash\Makefile
...\openocd-esp32\src\flash\nand\Makefile
...\openocd-esp32\src\helper\Makefile
...\openocd-esp32\src\jtag\drivers\Makefile
...\openocd-esp32\src\svf\Makefile
...\openocd-esp32\src\target\Makefile

I got a successful make from clean.

regards,
linuxpaul