Discuss here different C compiler set ups, and compiling executables for the ESP8266
User avatar
By RichardS
#1104 Can you put them in 2 directories? under the one.... if not I can do a crosstools also

Richard.
User avatar
By jcmvbkbc
#1108
admin wrote:Can you put them in 2 directories? under the one.... if not I can do a crosstools also

Richard, I just requested transfer of both gcc and crosstool repos to esp8266.
The crosstool repo has gcc call0 ABI patches in it, so it's the only thing that's needed to build the toolchain.
gcc repo may be interesting to people who'd like to hack gcc more or to build it manually.
User avatar
By igrr
#1111
jcmvbkbc wrote:Build crosstool-NG:
$ ./bootstrap && ./configure --prefix=`pwd` && make && make install

Configure it for lx106:
$ ./ct-ng xtensa-lx106-elf

And build the toolchain:
$ ./ct-ng build

Great! That's neat.
I had to make a few changes to get it working though.
First, 'custom_config' variable in scripts/arc/xtensa.sh was not defined, changed that to custom_overlay:
Code: Select alldiff --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh
index e4adae8..7e49312 100644
--- a/scripts/build/arch/xtensa.sh
+++ b/scripts/build/arch/xtensa.sh
@@ -51,9 +51,9 @@ CT_ConfigureXtensa() {
         CT_Abort
     fi
 
-    CT_DoLog EXTRA "Using '${custom_config}' from ${custom_location}"
-    CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_config}" \
-                              "${CT_TARBALLS_DIR}/${custom_config}"
+    CT_DoLog EXTRA "Using '${custom_overlay}' from ${custom_location}"
+    CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_overlay}" \
+                              "${CT_TARBALLS_DIR}/${custom_overlay}"
 
     CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configuring"
 


Next, some notes for those on a Mac.
  • Create a case-sensitive filesystem image and mount it somewhere before cloning crosstool-NG:
    $ hdiutil create -size 10g -fs "Case-sensitive HFS+" -volname ESPTools ESPTools.sparsebundle
    $ hdiutil attach ESPTools.sparsebundle
    $ ln -s /Volumes/ESPTools/ esptools
  • Install gcc 4.9. I use macports, homebrew should also work. Note that you may also need to install other packages, I might have had them installed already. If you use macports, don't forget to set the default gcc:
    $ sudo port select gcc mp-gcc49
  • When running configure, encourage it to pick the GNU version of grep (which also has to be installed via macports/homebrew):
    grep=/opt/local/bin/grep ./configure --prefix=`pwd`
  • Before doing ct-ng build, run menuconfig ($ ./ct-ng menuconfig), go into "C compiler" and disable "Link libstdc++ statically into the gcc binary". Otherwise crosstool-NG will feed '-static' option to gcc, but on OS X gcc doesn't have it.
Hope that helps someone.
User avatar
By jcmvbkbc
#1113
igrr wrote:I had to make a few changes to get it working though.
First, 'custom_config' variable in scripts/arc/xtensa.sh was not defined, changed that to custom_overlay

Thanks for the report. I've pushed the fix for it. Didn't notice that, because on linux I guess the only effect is incorrect debug logging.

igrr wrote:Before doing ct-ng build, run menuconfig ($ ./ct-ng menuconfig), go into "C compiler" and disable "Link libstdc++ statically into the gcc binary". Otherwise crosstool-NG will feed '-static' option to gcc, but on OS X gcc doesn't have it.

Disabled that in the default config and pushed the fix.
Thanks for testing!