Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By davydnorris
#55095 Hi everyone!

First post on these forums, so Hi from Australia!

I've been using the esp8266 for quite a while now via the Arduino and Lua routes, and now I need to get down and dirty with the C SDK for some high rate I2S input (that's a whole other post for later!)

I am a long time Eclipe CDT user using Cygwin and MinGW via Cygwin on Windows for Ada/C/C++/FORTRAN so I really want to be able to stick with my current dev environment.

I looked at @CHERTS Dev Kit and may just give up and install that (and a huge thank you to @CHERTS, @kolban and @scargill for the incredible work you have done!! I have learned so much about the ESP8266 in such a short time thanks to you all), however I decided to build and install from scratch using esp-open-sdk.

Running latest releases of Cygwin with all the appropriate tools installed, latest pull of esp-open-sdk, and running the Makefile inside Eclipse Neon. I get as far as the final compiler stage and then I see the identical errors CHERTS got way back in 2014, which is virtually identical to that documented here:

basically with two xgpp missing file errors followed by a segfault in stdc++ at about the same place.

Got exactly the same result running from the command line.

So my following random questions are:
- has anyone managed a recent esp-open-sdk build with Cygwin64 (gcc 5.4.0)?

- has anybody got a Makefile or Eclipse config that uses the Arduino esp8266 toolchain for a C SDK build? Would be nice to have the same toolchain for both but I'm getting pvPortMalloc etc. errors at the moment so I must be missing a -L<lib> or something

- does anybody know how to add -no-cygwin to the gcc compiler path when building esp-open-sdk?

- does anybody know how how to add -STANDALONE=n etc. to build directives in the latest Eclipse? Currently I'm editing the Makefile to select the standalone or SDK versions.

Many thanks for any pointers, tips or tricks you may have!!
Last edited by davydnorris on Tue Oct 04, 2016 7:42 am, edited 2 times in total.
User avatar
By davydnorris
#55659 OK so after a lot of messing round with the various forks of the crosstool-NG toolchain I've had some significant success.

It turns out that Cygwin64 is known for not liking precompiled headers, and when I disabled them I got a lot further in the compile of crosstool-NG inside esp-open-sdk. In order to do this I had to add the following line to crosstool-config-overrides:


I now have an error in the final link phase of gdb.exe, and I am pretty sure it's to do with Cygwin64 splitting the ncurses library into libncurses and libtinfo. I'm now trying to work out how to add both libraries into the link line.
User avatar
By davydnorris
#56003 And I finally got crosstool-NG built, but I'm not proud...

Turns out they fairly recently enabled support for TUI in gdb, and Cygwin64 was throwing errors with missing references to things that should be in ncurses, such as stdscr, curscr, LINES, COLS...

In the end, I am going to use Eclipse as my IDE so I don't really need TUI, and so I just disabled it again with CT_GDB_CROSS_EXTRA_CONFIG_ARRAY="--disable-tui" in crosstool-config-overrides.

A couple of things I noticed and I wondered if people had any comment:
- default compiler is gcc4.8.5 but it appears that gcc5.2 is supported by crosstool-NG. Is there any reason to prefer the earlier version?
- I built gcc5.2 and it worked, but you can't do it by adding CT_CC_V_5_2_0=y to your overrides file. It gets ignored and you still end up with 4.8.5. You have to explicitly edit the ct-ng .config file AFTER it has been created.
- I noticed that esp-open-sdk doesn't have the latest pull from @jcmvbkbc crosstool-NG and that there are some additional patches for gcc5.2, as well as a -mforce-l32 patch that doesn't get applied to gcc5.2. Is this needed?

What do people here normally do? Do they
- use the latest HEAD from the stand alone crosstool-NG provided by @jcmvbkbc,
- use the older crosstool-NG in the latest esp-open-sdk provided by @pfalcon, or
- use esp-open-sdk but update crosstool-NG to the very latest from @jcmvbkbc

Any opinions welcome!