a9183756-gh / Arduino-CMake-Toolchain

CMake toolchain for all Arduino compatible boards
MIT License
135 stars 40 forks source link

build.opt not found #64

Closed Terstegge closed 1 year ago

Terstegge commented 1 year ago

Hello, I just tried out to build the examples for ESP8266 generic board:

----------------------------------------- log starts here--------------------------------

andreas@notebook-fh:~/github/Arduino-CMake-Toolchain/Examples/b$ cmake -DCMAKE_TOOLCHAIN_FILE=../../Arduino-toolchain.cmake -DARDUINO_INSTALL_PATH=/usr/local/arduino-1.8.16 -DARDUINO_BOARD="Generic ESP8266 Module [esp8266.generic]" ..
/usr/local/arduino-1.8.16
-- Found Arduino Platform: /usr/local/arduino-1.8.16/hardware/arduino/avr
-- Found Arduino Platform: /home/andreas/.arduino15/packages/esp32/hardware/esp32/2.0.0
-- Found Arduino Platform: /home/andreas/.arduino15/packages/esp8266/hardware/esp8266/3.1.2
-- Found Arduino Platform: /home/andreas/.arduino15/packages/arduino/hardware/avr/1.8.6
-- Found Arduino Platform: /home/andreas/.arduino15/packages/SparkFun/hardware/apollo3/1.2.1
-- Selected Arduino Board: Generic ESP8266 Module [esp8266.generic]
-- Selected board option: "CPU Frequency" = "80 MHz"
-- Selected board option: "VTables" = "Flash"
-- Selected board option: "C++ Exceptions" = "Disabled (new aborts on oom)"
-- Selected board option: "Stack Protection" = "Disabled"
-- Selected board option: "SSL Support" = "All SSL ciphers (most compatible)"
-- Selected board option: "MMU" = "32KB cache + 32KB IRAM (balanced)"
-- Selected board option: "Non-32-Bit Access" = "Use pgm_read macros for IRAM/PROGMEM"
-- Selected board option: "Reset Method" = "dtr (aka nodemcu)"
-- Selected board option: "Crystal Frequency" = "26 MHz"
-- Selected board option: "Flash Frequency" = "40MHz"
-- Selected board option: "Flash Mode" = "DOUT (compatible)"
-- Selected board option: "Flash Size" = "1MB (FS:64KB OTA:~470KB)"
-- Selected board option: "Builtin Led" = "2"
-- Selected board option: "NONOS SDK Version" = "nonos-sdk 2.2.1+100 (190703)"
-- Selected board option: "lwIP Variant" = "v2 Lower Memory"
-- Selected board option: "Debug port" = "Disabled"
-- Selected board option: "Debug Level" = "None"
-- Selected board option: "Erase Flash" = "Only Sketch"
-- Selected board option: "Upload Speed" = "115200"
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Check for working C compiler: /home/andreas/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-gcc
-- Check for working C compiler: /home/andreas/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/home/andreas/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_49ea6/fast && /usr/bin/make -f CMakeFiles/cmTC_49ea6.dir/build.make CMakeFiles/cmTC_49ea6.dir/build
    make[1]: Verzeichnis „/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeTmp“ wird betreten
    Building C object CMakeFiles/cmTC_49ea6.dir/testCCompiler.c.o
    /home/andreas/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-gcc  -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -DESP8266 @/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/core/build.opt -I/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/include -I/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/lwip2/include -I/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/libc/xtensa-lx106-elf/include -I/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/core -c @/home/andreas/.arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/warnings/none-cflags -std=gnu17  -Os -g -free -fipa-pta -Werror=return-type -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections -fno-exceptions  -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000  -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0   -DARDUINO=108016 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" "-DARDUINO_BOARD_ID=\"{_id}\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT   -DARDUINO_ESP8266_GENERIC_MENU_BAUD_115200 -DARDUINO_ESP8266_GENERIC_MENU_CRYSTALFREQ_26 -DARDUINO_ESP8266_GENERIC_MENU_DBG_DISABLED -DARDUINO_ESP8266_GENERIC_MENU_EESZ_1M64 -DARDUINO_ESP8266_GENERIC_MENU_EXCEPTION_DISABLED -DARDUINO_ESP8266_GENERIC_MENU_FLASHFREQ_40 -DARDUINO_ESP8266_GENERIC_MENU_FLASHMODE_DOUT -DARDUINO_ESP8266_GENERIC_MENU_IP_LM2F -DARDUINO_ESP8266_GENERIC_MENU_LED_2 -DARDUINO_ESP8266_GENERIC_MENU_LVL_NONE____ -DARDUINO_ESP8266_GENERIC_MENU_MMU_3232 -DARDUINO_ESP8266_GENERIC_MENU_NON32XFER_FAST -DARDUINO_ESP8266_GENERIC_MENU_RESETMETHOD_NODEMCU -DARDUINO_ESP8266_GENERIC_MENU_SDK_NONOSDK_190703 -DARDUINO_ESP8266_GENERIC_MENU_SSL_ALL -DARDUINO_ESP8266_GENERIC_MENU_STACKSMASH_DISABLED -DARDUINO_ESP8266_GENERIC_MENU_VT_FLASH -DARDUINO_ESP8266_GENERIC_MENU_WIPE_NONE -DARDUINO_ESP8266_GENERIC_MENU_XTAL_80   /home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeTmp/testCCompiler.c -o CMakeFiles/cmTC_49ea6.dir/testCCompiler.c.o
    xtensa-lx106-elf-gcc: error: /home/andreas/github/Arduino-CMake-Toolchain/Examples/b/core/build.opt: No such file or directory
    make[1]: *** [CMakeFiles/cmTC_49ea6.dir/build.make:66: CMakeFiles/cmTC_49ea6.dir/testCCompiler.c.o] Fehler 1
    make[1]: Verzeichnis „/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeTmp“ wird verlassen
    make: *** [Makefile:121: cmTC_49ea6/fast] Fehler 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeOutput.log".
See also "/home/andreas/github/Arduino-CMake-Toolchain/Examples/b/CMakeFiles/CMakeError.log".

------------------------------ log ends here ----------------------------------

I also tried out technyon's fork which stated in the readme that a bug with a missing build.opt was fixed. Sadly this version produces the same error. I also tried out to disable the compiler check by setting some variables in the CMakeLists.txt (just can't remember the details...), but then the same error occured during compiling the first cpp file for the core library. So the problem in both cases (compiler test and regular lib compile) is that .../core/build.opt is missing. Any ideas what could be wrong? I am trying to build the examples for a generic ESP8266 board.

BR, Andreas

Terstegge commented 1 year ago

Just tried out KSDeamons fork (which integrated some more PRs), and now it works, at least with arduino-1.8.16. With the newest arduino version (arduino-2.1.0, obviously with a new electron-based UI), there are still problems. But for me thats okay - I will simply use the older arduino with the latest ESP8266 version.

TobyChaloner commented 1 month ago

For Generic ESP8266

Using the cmake toolchain technyon/Arduino-CMake-Toolchain (24 May 2024)

on ESP8266 build package 3.1.2 Arduino IDE 1.8.29

This top dir CMakeLists.txt works around the Build.opt issue. This has to go before the first 'project(...)'

cmake_minimum_required(VERSION 3.14.0)

#
# For the ESP8266, it needs a build.opt with compilation directive specialisations
# if nothing else, an empty file is required in a subdir called core
#
# create a directory when CMake generates the build system,
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/core)
file(TOUCH ${CMAKE_BINARY_DIR}/core/build.opt)

project(blinker CXX)
...