DavidAntliff / esp32-ds18b20-example

ESP32-compatible example for Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
MIT License
108 stars 34 forks source link

Project fails to configure with ESP-IDF v4.1 #12

Closed climategadgets closed 4 years ago

climategadgets commented 4 years ago
CMake Error at CMakeLists.txt:9 (target_compile_options):
  Cannot specify compile options for target "main" which is not built by this
  project.
DavidAntliff commented 4 years ago

Thanks for reporting - I've fixed this in https://github.com/DavidAntliff/esp32-ds18b20-example/pull/11 - can you give it a try please?

climategadgets commented 4 years ago

If I get it right -

  1. git checkout integration
  2. git pull
  3. idf.py menuconfig

Still fails, with a different message:

CMake Error at CMakeLists.txt:9 (target_compile_options):
  Cannot specify compile options for target "PRIVATE" which is not built by
  this project.

What diagnostic information do you need to troubleshoot this?

DavidAntliff commented 4 years ago

Don't forget to update submodules after step 1:

$ git submodule update --init

If you're still getting this issue, let me know and I'll look into it again.

DavidAntliff commented 4 years ago

I hadn't tried IDF v4.1-beta1 before, and when I try to do idf.py menuconfig I get:

    Run Build Command(s):/usr/bin/ninja cmTC_d8eb9 && [1/2] Building C object CMakeFiles/cmTC_d8eb9.dir/testCCompiler.c.obj
    [2/2] Linking C executable cmTC_d8eb9
    FAILED: cmTC_d8eb9 
    : && /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/xtensa-esp32-elf-gcc -mlongcalls -Wno-frame-address   CMakeFiles/cmTC_d8eb9.dir/testCCompiler.c.obj  -o cmTC_d8eb9   && :
    /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
    /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: No such file or directory
    /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lsim
    /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhandlers-sim
    /home/david/esp32/xtensa-esp32-elf-1.22.0-80-g6c4433a/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhal
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

So it looks like something is broken in 4.1-beta1, but since this is a beta I'd prefer not to spend time on it, so I'll revisit this when 4.1 is officially released.

DavidAntliff commented 4 years ago

Actually, I've been able to reproduce your issue - I was using the wrong toolchain before (hadn't run esp-idf-v4.1-beta1/install.sh). Now that I'm using the right toolchain, I can see the same issue you reported. I'll look into this further.

DavidAntliff commented 4 years ago

Looks like v4 changed some of the CMake variables in the IDF build system. Please try checking out the branch in the PR mentioned above. If you can confirm that this fixes your issue, I'll close this issue, however I can't merge this just yet as it will break v3.x builds.

climategadgets commented 4 years ago

Please confirm that the branch you're referring to is integration.

Here's the output, and attached is the CMakeOutput.log:

20:17:49 username@host:/tmp/esp$ idf.py --version
ESP-IDF v4.1-dev-2148-g9f024df9e-dirty
20:17:54 username@host:/tmp/esp$ git clone --recursive https://github.com/DavidAntliff/esp32-ds18b20-example.git
20:18:13 username@host:/tmp/esp$ cd esp32-ds18b20-example/
20:18:17 username@host:/tmp/esp/esp32-ds18b20-example$ git checkout integration
20:18:50 username@host:/tmp/esp/esp32-ds18b20-example$ git submodule update --init
20:19:08 username@host:/tmp/esp/esp32-ds18b20-example$ idf.py menuconfig
...
CMake Warning (dev) at CMakeLists.txt:9 (target_compile_options):
  uninitialized variable 'IDF_PROJECT_EXECUTABLE'
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at CMakeLists.txt:9 (target_compile_options):
  Cannot specify compile options for target "PRIVATE" which is not built by
  this project.
DavidAntliff commented 4 years ago

Yes, the integration branch, which I've since merged to master. You should now look at https://github.com/DavidAntliff/esp32-ds18b20-example/tree/esp-idf-v4.1-beta1

and

https://github.com/DavidAntliff/esp32-ds18b20-example/pull/14

climategadgets commented 4 years ago

Confirmed as working in esp-idf-v4.1-beta1 branch.

DavidAntliff commented 4 years ago

@climategadgets great, thank you for confirming that. Once I have worked out a way to differentiate between IDF v3.3 and v4.x in the CMake files, I will merge that to master. Until then I need to keep it separate otherwise v3.x builds will be broken.

DavidAntliff commented 4 years ago

@climategadgets I've now merged that branch to master, as I found a useful variable I could to determine which version of the IDF the user is building against. I've also added some Travis CI support for IDF v4.1-beta1, which I will continue to maintain as v4.x gains popularity.

climategadgets commented 4 years ago

Yep, checked, it's working.