pfalcon / esp-open-sdk

Free and open (as much as possible) integrated SDK for ESP8266/ESP8285 chips
1.97k stars 624 forks source link

Compiler fails on MacOS 10.14 #342

Closed conkerkh closed 4 years ago

conkerkh commented 6 years ago

Attached log below, I can't figure this one out I'm compiling on case-sensitive volume on MacOS Mojave getting same error all the time. All the packages are installed with brew.

Makefile:184: warning: overriding commands for target `ESP8266_NONOS_SDK-2.1.0-18-g61248df/.dir'
Makefile:179: warning: ignoring old commands for target `ESP8266_NONOS_SDK-2.1.0-18-g61248df/.dir'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C crosstool-NG -f ../Makefile _ct-ng
../Makefile:184: warning: overriding commands for target `ESP8266_NONOS_SDK-2.1.0-18-g61248df/.dir'
../Makefile:179: warning: ignoring old commands for target `ESP8266_NONOS_SDK-2.1.0-18-g61248df/.dir'
./bootstrap
Running autoconf...
Done. You may now run:
    ./configure
./configure --prefix=`pwd`
checking build system type... x86_64-apple-darwin18.0.0
checking host system type... x86_64-apple-darwin18.0.0
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for grep that handles long lines and -e... /usr/local/bin/grep
checking for egrep... /usr/local/bin/grep -E
checking for a sed that does not truncate output... /usr/local/bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for gobjcopy... gobjcopy
checking for absolute path to gobjcopy... /usr/local/bin/gobjcopy
checking for gobjdump... gobjdump
checking for absolute path to gobjdump... /usr/local/bin/gobjdump
checking for greadelf... greadelf
checking for absolute path to greadelf... /usr/local/bin/greadelf
checking for gperf... gperf
checking for absolute path to gperf... /usr/bin/gperf
checking for bison... bison
checking for flex... flex
checking for makeinfo... makeinfo
checking for cut... cut
checking for stat... stat
checking for readlink... readlink
checking for wget... wget
checking for tar... tar
checking for gzip... gzip
checking for bzip2... bzip2
checking for help2man... help2man
checking for gpatch... no
checking for patch... patch
checking for absolute path to patch... /usr/local/bin/patch
checking for bash >= 3.1... /bin/bash
checking for GNU awk... /usr/local/bin/gawk
checking for GNU make >= 3.80... /usr/bin/make
checking whether /usr/bin/make sets $(MAKE)... yes
checking for make 3.81... yes
checking for GNU libtool >= 1.5.26... /usr/local/bin/glibtool
checking for GNU libtoolize >= 1.5.26... /usr/local/bin/glibtoolize
checking for GNU automake >= 1.10... /usr/local/bin/automake
checking for the type used in gperf declarations... unsigned int
checking for xz... xz
checking for cvs... no
checking for svn... svn
checking for inline... inline
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
checking for library containing bindtextdomain... no
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking ncurses/curses.h usability... no
checking ncurses/curses.h presence... no
checking for ncurses/curses.h... no
checking ncursesw/curses.h usability... no
checking ncursesw/curses.h presence... no
checking for ncursesw/curses.h... no
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for library containing initscr... -lncurses
checking for library containing tgetent... none required
configure: creating ./config.status
config.status: creating Makefile
/Applications/Xcode.app/Contents/Developer/usr/bin/make MAKELEVEL=0
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'zconf.lex.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  LD     'conf'
  CC     'lxdialog/checklist.o'
  CC     'lxdialog/inputbox.o'
  CC     'lxdialog/menubox.o'
  CC     'lxdialog/textbox.o'
  CC     'lxdialog/util.o'
  CC     'lxdialog/yesno.o'
  CC     'mconf.o'
  LD     'mconf'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
Undefined symbols for architecture x86_64:
  "_current_item", referenced from:
      _item_data in nconf.o
      _curses_item_index in nconf.o
      _item_tag in nconf.o
      _get_mext_match in nconf.o
      _btn_dialog in nconf.gui.o
  "_free_item", referenced from:
      _clean_items in nconf.o
      _item_add_str in nconf.o
      _btn_dialog in nconf.gui.o
  "_free_menu", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_item_count", referenced from:
      _center_item in nconf.o
  "_item_index", referenced from:
      _curses_item_index in nconf.o
      _get_mext_match in nconf.o
      _btn_dialog in nconf.gui.o
  "_item_userptr", referenced from:
      _item_data in nconf.o
      _item_tag in nconf.o
  "_menu_driver", referenced from:
      _conf in nconf.o
      _conf_choice in nconf.o
      _btn_dialog in nconf.gui.o
  "_menu_opts_off", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_menu_opts_on", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_menu_win", referenced from:
      _conf in nconf.o
      _conf_choice in nconf.o
  "_new_item", referenced from:
      _item_make in nconf.o
      _item_add_str in nconf.o
      _btn_dialog in nconf.gui.o
  "_new_menu", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_post_menu", referenced from:
      _show_menu in nconf.o
      _center_item in nconf.o
      _btn_dialog in nconf.gui.o
  "_scale_menu", referenced from:
      _show_menu in nconf.o
  "_set_current_item", referenced from:
      _center_item in nconf.o
  "_set_item_userptr", referenced from:
      _item_make in nconf.o
      _item_add_str in nconf.o
  "_set_menu_back", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_menu_fore", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_menu_format", referenced from:
      _show_menu in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_menu_grey", referenced from:
      _main in nconf.o
  "_set_menu_items", referenced from:
      _show_menu in nconf.o
  "_set_menu_mark", referenced from:
      _main in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_menu_sub", referenced from:
      _show_menu in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_menu_win", referenced from:
      _show_menu in nconf.o
      _btn_dialog in nconf.gui.o
  "_set_top_row", referenced from:
      _center_item in nconf.o
  "_top_row", referenced from:
      _conf in nconf.o
      _center_item in nconf.o
      _conf_choice in nconf.o
  "_unpost_menu", referenced from:
      _main in nconf.o
      _reset_menu in nconf.o
      _btn_dialog in nconf.gui.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nconf] Error 1
make: *** [build-lib-kconfig] Error 2
make: *** [build] Error 2
make[1]: *** [_ct-ng] Error 2
make: *** [crosstool-NG/ct-ng] Error 2
megagosha commented 6 years ago

I have the same problem. Any ideas how it can be fixed? or what is causing it?

conkerkh commented 6 years ago

This is caused by ncurses which on OSX lacks some functions which are used by nconf. Basically you need to disable compilation of nconf (which is not really necessary).

megagosha commented 6 years ago

Thanks, solved it by using Xcode 9.2

duddie commented 6 years ago

How did you solve it? Care to share?

megagosha commented 6 years ago
  1. Download Xcode v 9.2 from apple developer web site. Maybe higher versions will work too, but I used 9.2

  2. sudo xcode-select --switch /Applications/Xcode-9.2.app/Contents/Developer

oremic commented 6 years ago

hello how did you install xcode 9.2 on 10.14 ??

HrNilsson commented 6 years ago

Same error. Any news on this?

bowerymarc commented 6 years ago

xcode 9.2 did not solve the problem for me

rgnovak commented 5 years ago

Any news how to solve it?

hannes-angst commented 5 years ago

Installing XCode 9.2 from Apple and applying sudo xcode-select --switch /Applications/<where-ever-you-put-it>/Contents/Developer as @megagosha suggested worked on my Mac OS X 10.14.1.

I strongly suggest to switch back to the original xcode location afterwards.

velocityzen commented 5 years ago

This is caused by ncurses which on OSX lacks some functions which are used by nconf. Basically you need to disable compilation of nconf (which is not really necessary).

@conkerkh how to disable nconf compilation?

baaskaas commented 5 years ago

@conkerkh Yeah i also cannot find how to disable nconf. I problably google wrong, and don't know where to find it in documentation.

daviddpd commented 5 years ago

Banging my head on this now ... thanks for the tip on ncurses ... nconf ... not sure I would have gotten that -

brew install ncurses

The version directory to ncurses may vary ...

cd esp-open-sdk/crosstool-NG

The patch -

diff --git a/kconfig/Makefile b/kconfig/Makefile
index ee838aa3..4aec3579 100644
--- a/kconfig/Makefile
+++ b/kconfig/Makefile
@@ -48,8 +48,8 @@ mconf: LDFLAGS += $(NCURSES_LDFLAGS)
 nconf_SRC = nconf.c nconf.gui.c
 nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
 nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
-$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
-nconf: LDFLAGS += -lmenu -lpanel $(LIBS)
+$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/local/Cellar/ncurses/6.1/include
+nconf: LDFLAGS += -lmenu -lpanel $(LIBS) -L/usr/local/Cellar/ncurses/6.1/lib

 # These are generated files:
 ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))

Helpful top level Makefile patch for esp-open-sdk, provided that /usr/local/bin/sed@ -> gsed - adjust as needed.

diff --git a/Makefile b/Makefile
index 1177ee7..835f604 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ TOP = $(PWD)
 SHELL = /bin/bash
 PATCH = patch -b -N
 UNZIP = unzip -q -o
+SED = /usr/local/bin/sed
 VENDOR_SDK_ZIP = $(VENDOR_SDK_ZIP_$(VENDOR_SDK))
 VENDOR_SDK_DIR = $(VENDOR_SDK_DIR_$(VENDOR_SDK))

@@ -98,8 +99,8 @@ ifeq ($(STANDALONE),y)
        @echo "Installing vendor SDK libs into toolchain sysroot"
        @cp -Rf sdk/lib/* $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/
        @echo "Installing vendor SDK linker scripts into toolchain sysroot"
-       @sed -e 's/\r//' sdk/ld/eagle.app.v6.ld | sed -e s@../ld/@@ >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.ld
-       @sed -e 's/\r//' sdk/ld/eagle.rom.addr.v6.ld >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.rom.addr.v6.ld
+       @${SED} -e 's/\r//' sdk/ld/eagle.app.v6.ld | ${SED} -e s@../ld/@@ >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.ld
+       @${SED} -e 's/\r//' sdk/ld/eagle.rom.addr.v6.ld >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.rom.addr.v6.ld
 endif

 clean: clean-sdk
@@ -133,8 +134,8 @@ crosstool-NG/.built: crosstool-NG/ct-ng

 _toolchain:
        ./ct-ng xtensa-lx106-elf
-       sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
-       sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
+       ${SED} -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
+       ${SED} -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
        cat ../crosstool-config-overrides >> .config
        ./ct-ng build

Then ...

make STANDALONE=y

... still compiling but wanted to post this before I forget.

edit - update ... woot !

Xtensa toolchain is built, to use it:

export PATH=/Volumes/esp8266/esp-open-sdk/xtensa-lx106-elf/bin:$PATH

Espressif ESP8266 SDK is installed, its libraries and headers are merged with the toolchain
daviddpd commented 5 years ago

I'm still not able to create code that runs on the ESP8266 from this build ... so I blew it away, and started from scratch - and can't get it work on macOS ... it's crosstools-NG that is having a problem ... and this would explain it :

macOS is no longer supported : http://crosstool-ng.github.io/2018/11/26/macos.html

I'm trying on FreeBSD ... and having similar problems. This repo also looks dead too ... did Expressif stop supporting the 8266 with the ESP32 taking off ?

daviddpd commented 5 years ago

Will fork and make a pull request at sometime later (and thinking about making some binary packages/releases) - but for the frustrated like myself ...

esp-open-sdk patches - MacOS 10.14.x :

diff --git a/Makefile b/Makefile
index 1177ee7..12f7ee3 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ TOP = $(PWD)
 SHELL = /bin/bash
 PATCH = patch -b -N
 UNZIP = unzip -q -o
+SED = /usr/local/bin/sed
 VENDOR_SDK_ZIP = $(VENDOR_SDK_ZIP_$(VENDOR_SDK))
 VENDOR_SDK_DIR = $(VENDOR_SDK_DIR_$(VENDOR_SDK))

@@ -98,8 +99,8 @@ ifeq ($(STANDALONE),y)
        @echo "Installing vendor SDK libs into toolchain sysroot"
        @cp -Rf sdk/lib/* $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/
        @echo "Installing vendor SDK linker scripts into toolchain sysroot"
-       @sed -e 's/\r//' sdk/ld/eagle.app.v6.ld | sed -e s@../ld/@@ >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.ld
-       @sed -e 's/\r//' sdk/ld/eagle.rom.addr.v6.ld >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.rom.addr.v6.ld
+       @${SED} -e 's/\r//' sdk/ld/eagle.app.v6.ld | sed -e s@../ld/@@ >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.app.v6.ld
+       @${SED} -e 's/\r//' sdk/ld/eagle.rom.addr.v6.ld >$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/eagle.rom.addr.v6.ld
 endif

 clean: clean-sdk
@@ -133,8 +134,8 @@ crosstool-NG/.built: crosstool-NG/ct-ng

 _toolchain:
        ./ct-ng xtensa-lx106-elf
-       sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
-       sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
+       ${SED} -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
+       ${SED} -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
        cat ../crosstool-config-overrides >> .config
        ./ct-ng build

diff --git a/crosstool-NG b/crosstool-NG
--- a/crosstool-NG
+++ b/crosstool-NG
@@ -1 +1 @@
-Subproject commit 37b07f6fbea2e5d23434f7e91614528f839db056
+Subproject commit 37b07f6fbea2e5d23434f7e91614528f839db056-dirty

esp-open-sdk/crosstool-NG patches

diff --git a/kconfig/Makefile b/kconfig/Makefile
index ee838aa3..4aec3579 100644
--- a/kconfig/Makefile
+++ b/kconfig/Makefile
@@ -48,8 +48,8 @@ mconf: LDFLAGS += $(NCURSES_LDFLAGS)
 nconf_SRC = nconf.c nconf.gui.c
 nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
 nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
-$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
-nconf: LDFLAGS += -lmenu -lpanel $(LIBS)
+$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/local/Cellar/ncurses/6.1/include
+nconf: LDFLAGS += -lmenu -lpanel $(LIBS) -L/usr/local/Cellar/ncurses/6.1/lib

 # These are generated files:
 ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))

helper script - cd esp-open-sdk and sh ~/helper.sh ... (note the patches above ... specific to map to the GNU and not the BSD versions of sed and patch ... the scripts in crosstool-NG uses non-portable flags to this common unix tools )

#!/bin/sh

OS=`uname`
FREEBSD=0
MACOS=0
case ${OS} in
    FreeBSD)
        FREEBSD=1
    ;;
    Darwin)
        MACOS=1
    ;;
    *)
esac

# install dependent packages

if [ ${FREEBSD} = 1 ]; then
    sudo pkg install git autoconf automake bash bison bzip2 cloog expat flex gawk gcc gerf git gmp gperf gsed gpatch help2man isl libexpat libtool makeinfo mpc mpfr ncurses patch py27-serial sed texinfo textinfo unrar unzip wget
elif [ ${MACOS} = 1 ]; then
    brew install autoconf automake binutils cloog expat gawk gettext gmp gnu-sed gperftools help2man isl libelf libiconv libtool mpc mpfr ncurses ppl unrar wget
fi

# setup PATH

if [ ${FREEBSD} = 1 ]; then
    export PATH="$PATH:/usr/local/bin"
elif [ ${MACOS} = 1 ]; then
    export PATH="$PATH:/usr/local/Cellar/binutils/2.31.1_2/bin:/usr/local/Cellar/ncurses/6.1/bin:/usr/local/Cellar/gpatch/2.7.6/bin"
fi

# call make

if [ ${FREEBSD} = 1 ]; then
    gmake STANDALONE=n
elif [ ${MACOS} = 1 ]; then
    make STANDALONE=n
fi
SConaway commented 5 years ago

@daviddpd Thanks for the patch. Any idea why Mojave causes this?

daviddpd commented 5 years ago

@daviddpd Thanks for the patch. Any idea why Mojave causes this?

No idea why it breaks cross the macOS version ... but I would blame esp-open-sdk more as being extremely GNU/Linux specific - hard coded patches and non-portable flags on *NIX tools - not a portable set of Makefiles.

I've hacked in 2.2.1 support and will try 3.0.0 support as well. If I can stay on my project, I will fork this, and make some binary releases, maybe investigate how to get into home-brew packages - as Espressif et al have seem to given up on the ESP8266 platform.

SConaway commented 5 years ago

@daviddpd Thanks for the patch. Any idea why Mojave causes this?

No idea why it breaks cross the macOS version ... but I would blame esp-open-sdk more as being extremely GNU/Linux specific - hard coded patches and non-portable flags on *NIX tools - not a portable set of Makefiles.

I've hacked in 2.2.1 support and will try 3.0.0 support as well. If I can stay on my project, I will fork this, and make some binary releases, maybe investigate how to get into home-brew packages - as Espressif et al have seem to given up on the ESP8266 platform.

Very true. I can help you test if you need.

nonameplum commented 5 years ago

@daviddpd I tried your solution but I needed to set /usr/bin/sed instead of /usr/local/bin/sed (not found) but then on make using your helper script I'm getting:

/usr/bin/sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf"% .config
/usr/bin/sed: illegal option -- r

As the macOS version of sed doesn't support -r alias but -E. Do you know what I'm doing differently?

I'm running on macOS 10.14.2 (18C54) with Xcode Version 10.1 (10B61).

Edit:

I installed again sed brew install gnu-sed --with-default-names and specified the path to the sed in my case to /usr/local/opt/gnu-sed/libexec/gnubin/sed which fixed my previous issue ↑ But I'm still getting an error:

Now configured for "xtensa-lx106-elf"
/usr/local/opt/gnu-sed/libexec/gnubin/sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf"% .config
/usr/local/opt/gnu-sed/libexec/gnubin/sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
cat ../crosstool-config-overrides >> .config
./ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20190106.172242
[INFO ]  Building environment variables
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[INFO ]  Retrieving needed toolchain components' tarballs: done in 1.00s (at 00:07)
[INFO ]  =================================================================
[INFO ]  Extracting and patching toolchain components
[INFO ]  Extracting and patching toolchain components: done in 138.00s (at 02:25)
[INFO ]  =================================================================
[INFO ]  Installing ncurses for build
[ERROR]    clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR]    make[4]: *** [clear] Error 1
[ERROR]    make[3]: *** [all] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing ncurses for build'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@216]
[ERROR]  >>        called from: do_ncurses_backend[scripts/build/companion_libs/220-ncurses.sh@151]
[ERROR]  >>        called from: do_ncurses_for_build[scripts/build/companion_libs/220-ncurses.sh@35]
[ERROR]  >>        called from: do_companion_libs_for_build[scripts/build/companion_libs.sh@29]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@646]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt'
[ERROR]   
[ERROR]  (elapsed: 3:03.00)
[03:04] / make[2]: *** [build] Error 1
make[1]: *** [_toolchain] Error 2
make: *** [crosstool-NG/.built] Error 2
zmarcoempsol commented 5 years ago

Thanks @daviddpd for your help ... but I'm still blocked by this error ... Can you help me, please? Thanks again

[ALL ] clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument] [ALL ] ld: warning: ignoring file ../lib/libncurses.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libncurses.a [ALL ] Undefined symbols for architecture x86_64: [ALL ] "_cur_term", referenced from: [ALL ] _main in clear.o [ALL ] "_setupterm", referenced from: [ALL ] _main in clear.o [ALL ] "_tigetstr", referenced from: [ALL ] _main in clear.o [ALL ] "_tputs", referenced from: [ALL ] _main in clear.o [ALL ] ld: symbol(s) not found for architecture x86_64 [ERROR] clang: error: linker command failed with exit code 1 (use -v to see invocation) [ERROR] make[4]: [clear] Error 1 [ALL ] make[4]: Waiting for unfinished jobs.... [ERROR] make[3]: *** [all] Error 2 [ERROR]
[ERROR] >> [ERROR] >> Build failed in step 'Installing ncurses for build' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@216] [ERROR] >> called from: do_ncurses_backend[scripts/build/companion_libs/220-ncurses.sh@151] [ERROR] >> called from: do_ncurses_for_build[scripts/build/companion_libs/220-ncurses.sh@35] [ERROR] >> called from: do_companion_libs_for_build[scripts/build/companion_libs.sh@29] [ERROR] >> called from: main[scripts/crosstool-NG.sh@646] [ERROR] >> [ERROR] >> For more info on this error, look at the file: 'build.log' [ERROR] >> There is a list of known issues, some with workarounds, in: [ERROR] >> 'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt' [ERROR]
[ERROR] (elapsed: 0:36.00)

daviddpd commented 5 years ago

Ok - the best way to do this is to fork it ... so I forked and branched it, cleaned up and pushed my patches.

git clone -b macos-10-14-sdk221 git@github.com:daviddpd/esp-open-sdk.git 

I updated the readme as well, and the directions for macOS - but don't have the branch in the readme ...

    << install homebrew / http://brew.sh >>
    << create case-sensetive hfs+ disk image and mount as /Volumes/esp8266 >>
    cd /Volumes/esp8266
    git clone --recursive -b macos-10-14-sdk221 git@github.com:daviddpd/esp-open-sdk.git
    cd esp-open-sdk
    make clean
    ./esp-open-sdk-mac-bsd.sh

If you have issue, please send the last ~50-100 lines of both standard out and of the esp-open-sdk/build.log to my email (listed in my GitHub profile).

zmarcoempsol commented 5 years ago

Thanks David! Same error again ... I'm sending you a mail with some logs ...

jobpassion commented 5 years ago

Thanks David, works for me

ingframin commented 5 years ago

Hello, thanks for the patch! However, I cannot clone the repository with "git clone --recursive -b macos-10-14-sdk221 git@github.com:daviddpd/esp-open-sdk.git". I get an error about my public key:

Cloning into 'esp-open-sdk'... Warning: Permanently added the RSA host key for IP address 'x.x.x.x' to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

daviddpd commented 5 years ago

@ingframin git clone --recursive -b macos-10-14-sdk221 https://github.com/daviddpd/esp-open-sdk.git

Or make sure you have added your ssh-key to your agent and GitHub account - but that is GitHub usage/user issue, not a code/project - see GitHub's help pages - https://help.github.com/articles/connecting-to-github-with-ssh/

daviddpd commented 5 years ago

I've had two people that still get this error (see your build.log) :

[ALL ] ld: warning: ignoring file ../lib/libncurses.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libncurses.a

For some reason ... clang/gcc is outputting the wrong binary code ... or the linker thinks it's wrong. At least one person resolved this with re-installing Xcode and all its command line unix tools/add-ons.

nonameplum commented 5 years ago

I did: sudo rm -rf /Applications/Xcode.app/ sudo rm -rf /Library/Developer/CommandLineTools Installed from the app store fresh Xcode 10.1 and then: xcode-select --install But still after making all of the steps https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-452400514 I have the same issue https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-453448846

whitezo commented 5 years ago

@daviddpd yessss, it finally completed the process with your fork, thanks for all the input! ;)

nonameplum commented 5 years ago

I finally fixed all of the issues and it worked for me :) In my case, I needed for some reason uninstall all of the brew libs used by esp-open-sdk. I also needed to fix the search paths for the ar and ranlib. The same as described here https://stackoverflow.com/questions/22107616/static-library-built-for-archive-which-is-not-the-architecture-being-linked-x86 . After running for the first time ./esp-open-sdk-mac-bsd.sh, I needed to make symbolic link to sed: ln -s /usr/local/opt/gnu-sed/libexec/gnubin/sed /usr/local/bin/sed and then run it again.

jahumes commented 5 years ago

@daviddpd I am still getting issues after following the steps above. Below is my current output from build.log. Any ideas as to what I am doing wrong?


[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tic.c -o ../objects/tic.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/transform.c -o ../objects/transform.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tset.c -o ../objects/tset.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc ../objects/clear.o -L../lib -Wl,-search_paths_first -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -lncurses    -o clear
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    ld: warning: ignoring file ../lib/libncurses.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libncurses.a
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/dump_entry.c -o ../objects/dump_entry.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tput.c -o ../objects/tput.o
[ALL  ]    Undefined symbols for architecture x86_64:
[ALL  ]      "_cur_term", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_setupterm", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_tigetstr", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_tputs", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]    ld: symbol(s) not found for architecture x86_64
[ERROR]    clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR]    make[4]: *** [clear] Error 1
[ALL  ]    make[4]: *** Waiting for unfinished jobs....
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ERROR]    make[3]: *** [all] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing ncurses for build'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@216]
[ERROR]  >>        called from: do_ncurses_backend[scripts/build/companion_libs/220-ncurses.sh@151]
[ERROR]  >>        called from: do_ncurses_for_build[scripts/build/companion_libs/220-ncurses.sh@35]
[ERROR]  >>        called from: do_companion_libs_for_build[scripts/build/companion_libs.sh@29]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@646]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt'```
daviddpd commented 5 years ago

@daviddpd I am still getting issues after following the steps above. Below is my current output from build.log. Any ideas as to what I am doing wrong?

[ ... ] [ALL ] ld: warning: ignoring file ../lib/libncurses.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libncurses.a [ ... ] [ALL ] Undefined symbols for architecture x86_64: [ ... ] [ALL ] ld: symbol(s) not found for architecture x86_64 [ERROR] clang: error: linker command failed with exit code 1 (use -v to see invocation)

I wish I knew why this was happening ... this is the ncurses that is included in crosstools-NG, which is ironically, not needed (because its being handled with home-brew's installed binary package) ... but calls into a bigger issue - I think, for some reason, Xcode and gcc is mis-installed or corrupt. It's emitting bad code or code for the wrong architecture. Attempt to completely remove and re-install Xcode, and reinstall the command line tools. Of course reboot ... do a clean checkout from git hub ... maybe reinstall all the home-brew tools. And re-try.

nonameplum commented 5 years ago

@jahumes Try this https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-453988759 I also had a lot of issues with ncurses but this helped me.

gusost commented 5 years ago

I needed for some reason uninstall all of the brew libs used by esp-open-sdk

How did you do that? Get the list of which libs are used by esp-open-sdk etc.

nonameplum commented 5 years ago

The list is in the readme https://github.com/pfalcon/esp-open-sdk#macos and also you can verify with the @daviddpd script https://github.com/daviddpd/esp-open-sdk/blob/421e0b3e18f28b636a66b6429cdd3c10282c3447/esp-open-sdk-mac-bsd.sh

deacoder commented 5 years ago

@daviddpd I am still getting issues after following the steps above. Below is my current output from build.log. Any ideas as to what I am doing wrong?

[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tic.c -o ../objects/tic.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/transform.c -o ../objects/transform.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tset.c -o ../objects/tset.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc ../objects/clear.o -L../lib -Wl,-search_paths_first -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -lncurses    -o clear
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    ld: warning: ignoring file ../lib/libncurses.a, file was built for archive which is not the architecture being linked (x86_64): ../lib/libncurses.a
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/dump_entry.c -o ../objects/dump_entry.o
[ALL  ]    x86_64-build_apple-darwin18.2.0-gcc -DHAVE_CONFIG_H -I. -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs -I../include -I/Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/../include   -D_DARWIN_C_SOURCE -DNDEBUG -O2 -g  -no-cpp-precomp  --param max-inline-insns-single=1200 -c /Volumes/case-sensitive/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/progs/tput.c -o ../objects/tput.o
[ALL  ]    Undefined symbols for architecture x86_64:
[ALL  ]      "_cur_term", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_setupterm", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_tigetstr", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]      "_tputs", referenced from:
[ALL  ]          _main in clear.o
[ALL  ]    ld: symbol(s) not found for architecture x86_64
[ERROR]    clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR]    make[4]: *** [clear] Error 1
[ALL  ]    make[4]: *** Waiting for unfinished jobs....
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ALL  ]    clang: warning: argument unused during compilation: '--param max-inline-insns-single=1200' [-Wunused-command-line-argument]
[ERROR]    make[3]: *** [all] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing ncurses for build'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@216]
[ERROR]  >>        called from: do_ncurses_backend[scripts/build/companion_libs/220-ncurses.sh@151]
[ERROR]  >>        called from: do_ncurses_for_build[scripts/build/companion_libs/220-ncurses.sh@35]
[ERROR]  >>        called from: do_companion_libs_for_build[scripts/build/companion_libs.sh@29]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@646]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt'```

I also hade the same problem and as indicated by @nonameplum it's related brew installs. Brew will install the tools in /usr/local/opt/binutils/bin and put first in PATH and this will shadow the path to the equivalent Xcode tools in /usr/bin. I installed these dependencies myself before running from @daviddpd fork. To solve it I simply changed my PATH after the build failed, re-run make, and then finally I was able to compile the SDK!

@daviddpd Thanks for your work!

I'm running Xcode 10.1 and macOS 10.14.3

phibo23 commented 5 years ago

Thanks to all of you for your contributions to this thread. After trying for hours I was finally able to successfully build the sdk.

I wrote down all the errors I encountered along the way and which of your hints helped me. I hope this will help the next person to do this in much shorter time and maybe someone can use this to improve the build script. 😉

  1. create case-sensitive volume

    sudo hdiutil create ~/Documents/esp8266.dmg -volname "esp8266" -size 10g -fs "Case-sensitive HFS+"
    sudo hdiutil mount ~/Documents/esp8266.dmg
    cd /Volumes/esp8266

    Note: the -volname argument is wrong in @daviddpd's README

  2. clone @daviddpd's branch

    git clone --recursive -b macos-10-14-sdk221 git@github.com:daviddpd/esp-open-sdk.git
    cd esp-open-sdk

    Note: as he says in this comment https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-452400514, the branch name is not included in the README instruction

  3. run the build script with patches

    make clean
    ./esp-open-sdk-mac-bsd.sh

    Error: This fails with the following error:

    ...
    checking for gobjcopy... no
    checking for objcopy... no
    configure: error: missing required tool: gobjcopy objcopy
    make[1]: *** [_ct-ng] Error 1
    make: *** [crosstool-NG/ct-ng] Error 2

    This occurs, when binutils, installed by brew, is not available in the path. There is an instruction in esp-open-sdk-mac-bsd.sh which is meant to do that, but that does not seem to work. I think it fails, because it references an exact version instead of the symlink and a newer version was installed.

    Solution:

    # brew info will show an instruction to permanently add binutils to the path
    # we just do it temporarily
    brew info binutils
    export PATH="/usr/local/opt/binutils/bin:$PATH"

    Note: this causes the problem mentioned in this comment https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-468391431 for a later stage, that's why I wrote "temporarily"

  4. reset the patches and run the build script again

    rm -rf crosstool-NG/
    git submodule update --init --recursive
    make clean
    ./esp-open-sdk-mac-bsd.sh

    Error: It fails again, with the following error:

    ...
    Now configured for "xtensa-lx106-elf"
    /usr/local/bin/sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="/Volumes/esp8266/esp-open-sdk/xtensa-lx106-elf"% .config
    /bin/bash: /usr/local/bin/sed: No such file or directory
    make[1]: *** [_toolchain] Error 127
    make: *** [crosstool-NG/.built] Error 2

    Solution: create the missing symlink, as explained here https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-453988759

    ln -s /usr/local/opt/gnu-sed/libexec/gnubin/sed /usr/local/bin/sed
  5. reset the patches and run the build script again

    rm -rf crosstool-NG/
    git submodule update --init --recursive
    make clean
    ./esp-open-sdk-mac-bsd.sh

    potential error: This happened to me the first time but not when I repeated all the steps to write this down. The following error may occur:

    [INFO ]  Retrieving needed toolchain components' tarballs
    [INFO ]  Retrieving needed toolchain components' tarballs: done in 98.00s (at 01:40)
    [INFO ]  =================================================================
    [INFO ]  Extracting and patching toolchain components
    [01:42] / gzip: /Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/tarballs/expat-2.1.0.tar.gz: not in gzip format

    Solution: There is another GitHub issue about this problem: https://github.com/pfalcon/esp-open-sdk/issues/307#issuecomment-368207036 Download the expat tarball manually and delete the build files

    cd crosstool-NG/.build/tarballs
    rm expat-2.1.0.tar.gz
    wget https://github.com/libexpat/libexpat/releases/download/R_2_1_0/expat-2.1.0.tar.gz
    cd ../src
    rm .expat-2.1.0.*
    rm -r expat-2.1.0/
    cd ../../..

    Note: If you do not delete those files before continuing, the follwing error will occur:

    [ERROR]    The 'expat-2.1.0' sources were partially extracted.
    [ERROR]    Please remove first:
    [ERROR]     - the source dir for 'expat-2.1.0', in '/Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/src'
    [ERROR]     - the file '/Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/src/.expat-2.1.0.extracting'
    [ERROR]    I'll stop now to avoid any carnage...
  6. This time, do not reset anything, just run the build script again

    ./esp-open-sdk-mac-bsd.sh

    Error: (this was the last one 😉)

    [INFO ]  Installing ncurses for build
    [ERROR]    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    [ERROR]    make[4]: *** [clear] Error 1
    [ERROR]    make[3]: *** [all] Error 2
    [ERROR]   
    [ERROR]  >>
    [ERROR]  >>  Build failed in step 'Installing ncurses for build'
    [ERROR]  >>        called in step '(top-level)'

    Solution: Reset the $PATH so that brew binutils is removed from it, as mentioned in this comment https://github.com/pfalcon/esp-open-sdk/issues/342#issuecomment-468391431

    I think the easiest way to do this is to open a new terminal window/tab (if the path was only modified temporarily)

  7. Again, do not reset anything, just run the build script again

    ./esp-open-sdk-mac-bsd.sh
  8. enjoy and build whatever awesome thing you wanted to build in the first place 😊

Rjayone commented 5 years ago

@phibo23 thank you for this solution! Its work for me)

yahms commented 5 years ago

@phibo23 thanks this worked for me too!

From Australia, bit of an ESP noob, but am creating a localised version of this project to make Homekit compatible Australian-approved smart switches: (if successful, ill fork I guess?)

https://github.com/Gruppio/Sonoff-Homekit

(requires switching of both Active and Neutral, which a Sonoff doesn't)

smart switch is the Bunnings 'Brilliant' Smart Wifi Plug


Edit, it didn't work, errors at installing cross-gdb saying

[ERROR]    configure: error: python is missing or unusable
[ERROR]    make[4]: *** [configure-gdb] Error 1
[ERROR]    make[3]: *** [all] Error 2

edit 2: fixed by removing plain homebrew python, and installing python by using pyenv, then setting version to 2.7.16.. the build.log file in the cross-gdb-something dir had a build.log and it explicitly said it looked for python 2.7

ialidigital commented 3 years ago

Followed the above comment.

Ran into an issue on step after step 4.

clang: error: linker command failed with exit code 1 (use -v to see invocation) make: [nconf] Error 1 make: [build-lib-kconfig] Error 2 make: [build] Error 2 make[1]: [_ct-ng] Error 2 make: *** [crosstool-NG/ct-ng] Error 2

root was: ld: warning: directory not found for option '-L/usr/local/Cellar/ncurses/6.1/lib'

I did this temp workaround (as couldn't get hold of 6.1 via brew): sudo ln -s /usr/local/Cellar/ncurses/6.2/lib /usr/local/Cellar/ncurses/6.1

which solved for that part :)

ialidigital commented 3 years ago

Get a failure now at step 7: [INFO ] Performing some trivial sanity checks [INFO ] Build started 20201211.010207 [INFO ] Building environment variables [INFO ] ================================================================= [INFO ] Retrieving needed toolchain components' tarballs [INFO ] Retrieving needed toolchain components' tarballs: done in 0.00s (at 00:04) [INFO ] ================================================================= [INFO ] Extracting and patching toolchain components [INFO ] Extracting and patching toolchain components: done in 0.00s (at 00:04) [INFO ] ================================================================= [INFO ] Installing ncurses for build [INFO ] Installing ncurses for build: done in 38.00s (at 00:42) [INFO ] ================================================================= [INFO ] Installing GMP for host [ERROR] configure: error: could not find a working compiler, see config.log for details [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Installing GMP for host' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@216] [ERROR] >> called from: do_gmp_backend[scripts/build/companion_libs/100-gmp.sh@92] [ERROR] >> called from: do_gmp_for_host[scripts/build/companion_libs/100-gmp.sh@62] [ERROR] >> called from: do_companion_libs_for_host[scripts/build/companion_libs.sh@36] [ERROR] >> called from: main[scripts/crosstool-NG.sh@646] [ERROR] >> [ERROR] >> For more info on this error, look at the file: 'build.log' [ERROR] >> There is a list of known issues, some with workarounds, in: [ERROR] >> 'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt' [ERROR] [ERROR] (elapsed: 0:58.00) [00:59] / make[2]: [build] Error 1 make[1]: [_toolchain] Error 2 make: *** [crosstool-NG/.built] Error 2

@daviddpd @phibo23 any help would be much appreciated.

ialidigital commented 3 years ago

@daviddpd @phibo23

This is the (tail) excerpt from the crostool-NG/build.log file :

[INFO ] Installing ncurses for build: done in 29.00s (at 00:32) [INFO ] ================================================================= [INFO ] Installing GMP for host [DEBUG] Entering '/Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-gmp-host-x86_64-build_apple-darwin19.6.0' [EXTRA] Configuring GMP [DEBUG] ==> Executing: 'CFLAGS=-O2 -g -pipe -fexceptions' 'LDFLAGS= ' '/Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/src/gmp-6.0.0a/configure' '--build=x86_64-build_apple-darwin19.6.0' '--host=x86_64-build_apple-darwin19.6.0' '--prefix=/Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools' '--enable-fft' '--enable-cxx' '--disable-shared' '--enable-static' '' [CFG ] configure: WARNING: you should use --build, --host, --target [CFG ] checking build system type... x86_64-build_apple-darwin19.6.0 [CFG ] checking host system type... x86_64-build_apple-darwin19.6.0 [CFG ] checking for a BSD-compatible install... /Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/tools/bin/install -c [CFG ] checking whether build environment is sane... yes [CFG ] checking for a thread-safe mkdir -p... /Volumes/esp8266/esp-open-sdk/crosstool-NG/.build/src/gmp-6.0.0a/install-sh -c -d [CFG ] checking for gawk... gawk [CFG ] checking whether make sets $(MAKE)... yes [CFG ] checking whether to enable maintainer-specific portions of Makefiles... no [CFG ] checking ABI=64 [CFG ] checking compiler gcc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [CFG ] checking whether cc is gcc... yes [CFG ] checking compiler cc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [CFG ] checking ABI=x32 [CFG ] checking compiler gcc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [CFG ] checking whether cc is gcc... yes [CFG ] checking compiler cc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [CFG ] checking ABI=32 [CFG ] checking compiler gcc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [CFG ] checking compiler icc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no [CFG ] checking whether cc is gcc... yes [CFG ] checking compiler cc -O2 -g -pipe -fexceptions -I/usr/local/opt/readline/include... no, long long reliability test 1 [ERROR] configure: error: could not find a working compiler, see config.log for details [ERROR]
[ERROR] >> [ERROR] >> Build failed in step 'Installing GMP for host' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@216] [ERROR] >> called from: do_gmp_backend[scripts/build/companion_libs/100-gmp.sh@92] [ERROR] >> called from: do_gmp_for_host[scripts/build/companion_libs/100-gmp.sh@62] [ERROR] >> called from: do_companion_libs_for_host[scripts/build/companion_libs.sh@36] [ERROR] >> called from: main[scripts/crosstool-NG.sh@646] [ERROR] >> [ERROR] >> For more info on this error, look at the file: 'build.log' [ERROR] >> There is a list of known issues, some with workarounds, in: [ERROR] >> 'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt' [ERROR]
[ERROR] (elapsed: 0:48.00)

This is the excerpt from the config.log:

configure:6193: gcc -o conftest -g -O2 -I/usr/local/opt/readline/include -L/usr/local/opt/readline/lib conftest.c -lncursesw >&5 ld: library not found for -lncursesw clang: error: linker command failed with exit code 1 (use -v to see invocation) configure:6193: $? = 1 configure: failed program was: | / confdefs.h / | #define PACKAGE_NAME "crosstool-NG" | #define PACKAGE_TARNAME "crosstool-ng" | #define PACKAGE_VERSION "crosstool-ng-1.22.0-60-g37b07f6f-dirty" | #define PACKAGE_STRING "crosstool-NG crosstool-ng-1.22.0-60-g37b07f6f-dirty" | #define PACKAGE_BUGREPORT "crossgcc@sourceware.org" | #define PACKAGE_URL "" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_MALLOC 1 | #define HAVE_STDLIB_H 1 | #define HAVE_REALLOC 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define HAVE_LIBINTL_H 1 | #define HAVE_NCURSES_H 1 | / end confdefs.h. /

Any ideas?

Thanks.

ialidigital commented 3 years ago

Solved these issues by moving to Docker (Ubuntu) and building/make within that. :)

phibo23 commented 3 years ago

Hi, sorry for not responding. I am in no way an expert in any of the tools involved and my popular post above was just my compilation of solutions I found when I was hacking on a small project over a year ago. 😉 I am happy that you found a new approach to solve your problem 👍

lemonshaker commented 2 years ago

Hey together, I had the same issues like above. I'm running a MAC with M1 core and Monterey (12.3.1). After digging and digging and following your suggestions I finally reached a where I cannot proceed. I need some help. I get now the following error/s:

cp -f 1000-mforce-l32.patch crosstool-NG/local-patches/gcc/4.8.5/ /Library/Developer/CommandLineTools/usr/bin/make -C crosstool-NG -f ../Makefile _toolchain ./ct-ng xtensa-lx106-elf ./ct-ng:26: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/paths.mk: No such file or directory ./ct-ng:114: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/config/config.mk: No such file or directory ./ct-ng:115: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/kconfig/kconfig.mk: No such file or directory ./ct-ng:116: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/steps.mk: No such file or directory ./ct-ng:117: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/samples/samples.mk: No such file or directory ./ct-ng:118: /Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/scripts/scripts.mk: No such file or directory make[2]: *** No rule to make target/Volumes/esp8266/esp-open-sdk/crosstool-NG/lib/crosstool-ng-1.22.0-60-g37b07f6f-dirty/scripts/scripts.mk'. Stop. make[1]: [_toolchain] Error 2 make: [crosstool-NG/.built] Error 2`

I do not understand where the lib directory comes into this compilation. There is none in my cross tool-ng. Maybe one of you has an idea, am I missing something ?

@ialidigital maybe you can give a rough summary how you did it with docker ? This could also be a suitable solution for me.

Thanks a lot for you support.