These are chat archives for esp8266/Arduino

30th
Jan 2018
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:33
since some time I get a linker error undefined reference to `Serial' when building for ESP8266 (instead of ESP32, which is my main target platform). I have the feeling hitting some compiler/linker edgecase here, because that is code that used to work since ages. any ideas?
Me No Dev
@me-no-dev
Jan 30 2018 19:33
@everslick what do you use to build?
I have no issues with ArduinoIDE and sloeber
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:34
makeEspArduino
Me No Dev
@me-no-dev
Jan 30 2018 19:35
that calls Arduino builder right?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:35
hmm
Me No Dev
@me-no-dev
Jan 30 2018 19:35
you building the same exact sketch on both platforms?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:36
yes, with some #ifdef ESP32 and #ifdef ESP8266
where the API is different
Me No Dev
@me-no-dev
Jan 30 2018 19:37
maybe it caches the build in the same folder
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:37
it does not use the Arduino builder as far as i can see,
Me No Dev
@me-no-dev
Jan 30 2018 19:37
does it tell you where it builds?
can you link me to the script please? :)
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:38
no, the binaryies are in different places
Me No Dev
@me-no-dev
Jan 30 2018 19:38
binaries maybe, but there are other build "artifacts" usually
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:39
i control the whole build process pretty tightly. hang on...
../build/ESP8266/3.0.4/alpha/eng/console.cpp.o: In function `console_fini()': /home/clemens/Devel/ESP/emonio/src/console.cpp:96: undefined reference to `Serial' collect2: error: ld returned 1 exit status ../../makeEspArduino/makeEspArduino.mk:239: recipe for target '../build/ESP8266/3.0.4/alpha/eng/emonio.bin' failed make: *** [../build/ESP8266/3.0.4/alpha/eng/emonio.bin] Error 1
this is the faild linking on esp8266
and now the final output for esp32:
python "../../Arduino-ESP32/tools/gen_esp32part.py" -q "../../Arduino-ESP32/tools/partitions/default.csv" "../build/ESP32/3.0.4/alpha/eng/emonio.partitions.bin"
python "../../Arduino-ESP32/tools/esptool.py" --chip esp32 elf2image --flash_mode "dio" --flash_freq "40m" --flash_size "4MB" -o "../build/ESP32/3.0.4/alpha/eng/emonio.bin" "../build/ESP32/3.0.4/alpha/eng/emonio.elf"
esptool.py v2.1
"../../Arduino-ESP32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size" -A "../build/ESP32/3.0.4/alpha/eng/emonio.elf" | perl -e "$MEM_USAGE" "^(?:\.iram0\.text|\.dram0\.text|\.flash\.text|\.dram0\.data|\.flash\.rodata|)\s+([0-9]+).*" "^(?:\.dram0\.data|\.dram0\.bss)\s+([0-9]+).*"

Memory usage
  Ram:    44548 bytes
  Flash: 1143202 bytes
Me No Dev
@me-no-dev
Jan 30 2018 19:42
does this thing have make clean or make distclean?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:43
yes, done that
my binary is pretty big
maybe the linker chokes on it already
Me No Dev
@me-no-dev
Jan 30 2018 19:43
I bet you it caches stuff for the build somewhere... I can not come up with any other reason. It errors on Serial which is in the core
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:43
exactly
Me No Dev
@me-no-dev
Jan 30 2018 19:44
nope ;) size would not matter here
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:44
this is puzzling
Me No Dev
@me-no-dev
Jan 30 2018 19:44
where can I have a look at that makeEspArduino.mk
Me No Dev
@me-no-dev
Jan 30 2018 19:45
/tmp/mkESP ?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:45
../build/ESP8266/3.0.4/alpha/eng/
i change the path according to which version i build
it is multilingual and such
it's a private repo, but if you are serious, i will give you access. :-D
Me No Dev
@me-no-dev
Jan 30 2018 19:50
if you have not changed much, what I already looked at seems fine
can you print out the LD command that it trys to execute?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:53
be warned, its gonna be big...
Me No Dev
@me-no-dev
Jan 30 2018 19:54
:D I'm not scared of linker commands :D
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:54
hehe, have to splitt it up, gitter is scared of it
Me No Dev
@me-no-dev
Jan 30 2018 19:55
sure :)
maybe pastebin it?
Clemens Kirchgatterer
@everslick
Jan 30 2018 19:55
"../../Arduino-ESP8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -g -w -Os -nostdlib -Wl,--no-check-sections -u call_user_start -u _printf_float -u _scanf_float -Wl,-static "-L../../Arduino-ESP8266/tools/sdk/lib" "-L../../Arduino-ESP8266/tools/sdk/ld" "-L../../Arduino-ESP8266/tools/sdk/libc/xtensa-lx106-elf/lib" "-Teagle.flash.1m0.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read  -o "../build/ESP8266/3.0.4/alpha/eng/emonio.elf" -Wl,--start-group ../build/ESP8266/3.0.4/alpha/eng/arduino.ar ../build/ESP8266/3.0.4/alpha/eng/emonio_.cpp.o ../build/ESP8266/3.0.4/alpha/eng/dht.cpp.o ../build/ESP8266/3.0.4/alpha/eng/connection.cpp.o ../build/ESP8266/3.0.4/alpha/eng/emonio.cpp.o ../build/ESP8266/3.0.4/alpha/eng/edit.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ds3231.cpp.o ../build/ESP8266/3.0.4/alpha/eng/icon.cpp.o ../build/ESP8266/3.0.4/alpha/eng/telnet.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ade.cpp.o ../build/ESP8266/3.0.4/alpha/eng/lined.cpp.o ../build/ESP8266/3.0.4/alpha/eng/system.cpp.o ../build/ESP8266/3.0.4/alpha/eng/console.cpp.o ../build/ESP8266/3.0.4/alpha/eng/log.cpp.o ../build/ESP8266/3.0.4/alpha/eng/module.cpp.o ../build/ESP8266/3.0.4/alpha/eng/websocket.cpp.o ../build/ESP8266/3.0.4/alpha/eng/logger.cpp.o ../build/ESP8266/3.0.4/alpha/eng/led.cpp.o ../build/ESP8266/3.0.4/alpha/eng/datetime.cpp.o ../build/ESP8266/3.0.4/alpha/eng/hwpin.cpp.o ../build/ESP8266/3.0.4/alpha/eng/rtc.cpp.o ../build/ESP8266/3.0.4/alpha/eng/i2c.cpp.o ../build/ESP8266/3.0.4/alpha/eng/filesystem.cpp.o ../build/ESP8266/3.0.4/alpha/eng/html.cpp.o ../build/ESP8266/3.0.4/alpha/eng/watchdog.cpp.o ../build/ESP8266/3.0.4/alpha/eng/terminal.cpp.o ../build/ESP8266/3.0.4/alpha/eng/shell.cpp.o ../build/ESP8266/3.0.4/alpha/eng/net.cpp.o ../build/ESP8266/3.0.4/alpha/eng/config.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ntp.cpp.o ../build/ESP8266/3.0.4/alpha/eng/wrapper.cpp.o ../build/ESP8266/3.0.4/alpha/eng/mqtt.cpp.o ../build/ESP8266/3.0.4/alpha/eng/bme.cpp.o ../build/ESP8266/3.0.4/alpha/eng/clock.cpp.o ../build/ESP8266/3.0.4/alpha/eng/at24c32.cpp.o ../build/ESP8266/3.0.4/alpha/eng/util.cpp.o ../build/ESP8266/3.0.4/alpha/eng/error.cpp.o ../build/ESP8266/3.0.4/alpha/eng/webserver.cpp.o ../build/ESP8266/3.0.4/alpha/eng/storage.cpp.o ../build/ESP8266/3.0.4/alpha/eng/root_ca_cert.c.o ../build/ESP8266/3.0.4/alpha/eng/cli.cpp.o ../build/ESP8266/3.0.4/alpha/eng/update.cpp.o ../build/ESP8266/3.0.4/alpha/eng/xxtea.cpp.o ../build/ESP8266/3.0.4/alpha/eng/telemetry.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFiAP.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WiFiServer.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFiScan.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WiFiClient.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFiMulti.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFiSTA.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WiFiClientSecure.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WiFiUdp.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFi.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266WiFiGeneric.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266mDNS.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESP8266HTTPClient.cpp.o ../build/ESP8266/3.0.4/alpha/eng/Ticker.cpp.o ../build/ESP8266/3.0.4/alpha/eng/sha1.c.o ../build/ESP8266/3.0.4/alpha/eng/Hash.cpp.o ../build/ESP8266/3.0.4/alpha/eng/Parsing.cpp.o ../build/ESP8266/3.0.4/alpha/eng/ESPWebServer.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WebSocketsClient.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WebSockets.cpp.o ../build/ESP8266/3.0.4/alpha/eng/libsha1.c.o ../build/ESP8266/3.0.4/alpha/eng/cdecode.c.o ../build/ESP8266/3.0.4/alpha/eng/cencode.c.o ../build/ESP8266/3.0.4/alpha/eng/WebSocketsServer.cpp.o ../build/ESP8266/3.0.4/alpha/eng/WebUpdate.cpp.o ../build/ESP8266/3.0.4/alpha/eng/DNSServer.cpp.o ../build/ESP8266/3.0.4/alpha/eng/EEPROMFlash.cpp.o ../build/ESP8266/3.0.4/alpha/eng/bme680.cpp.o ../build/ESP8266/3.0.4/alpha/eng/bme680_drv.c.o ../build/ESP8266/3.0.4/alpha/eng/buildinfo.c++.o "../build/ESP8266/3.0.4/alpha/eng/arduino.ar" -lhal -lphy -lpp -lnet80211 -llwip_gcc -lwpa -lcrypto -lmain -lwps -laxtls -lespnow -lsmar
ok, gitter does not work, will pastebin it
first it compiles buildinfo.c++ which is a generated file to add version numbers and build time and such into the binary and the it links the final elf which fails.
Me No Dev
@me-no-dev
Jan 30 2018 20:00
commands look good
you have included "Arduino.h" in /console.cpp right?
not in some ifdef switch
Clemens Kirchgatterer
@everslick
Jan 30 2018 20:01
in console.h which is included in console.cpp
no #ifdef in sight :-D
Me No Dev
@me-no-dev
Jan 30 2018 20:02
hmmm.... no clue. everything seems fine... it's the friggin Serial that should work anywhere
Clemens Kirchgatterer
@everslick
Jan 30 2018 20:03
it is used in dozens of other places
i will now remove Serial from console to see if it fails in a different file then.
Me No Dev
@me-no-dev
Jan 30 2018 20:04
any extern "C" in those files?
Clemens Kirchgatterer
@everslick
Jan 30 2018 20:06
Memory usage
Ram: 41312 bytes
Flash: 556107 bytes
now it links fine
no extern "C" there
already calling Serial.begin(115200); will break the build. :-(
and it reports the wrong line number and function name for the undefined reference
Me No Dev
@me-no-dev
Jan 30 2018 20:16
I'm clueless at this point