Comments (9)
I just hit this issue, and after some digging I figured out the fix:
ustisha/CMake@master...Julusian:patch-1
from arduino-cmake-ng.
Hello @ustisha, please attach your CMakeLists.txt file as well.
from arduino-cmake-ng.
Sorry i thought example project will be enough
Here is two files
CMakeLists.txt
CMakeLists.txt
Project structure you can check in https://github.com/ustisha/CMake
from arduino-cmake-ng.
@ustisha Actually you're right, my bad.
Usually people embed it in the comment like a code snippet, so I'm used to that pattern.
Regarding your files, I can see 2 problems:
- You've set the toolchain file path inside the CMakeLists - It's not recommended and not the way to do it in this framework. Please refer to this wiki page for more info.
- It appears from your attached error message that your libraries are located in a non-standard location, that the framework has no way of finding by its own. For that, please refer to the libraries wiki section.
from arduino-cmake-ng.
@MrPointer Thank you for quick answers.
- You are right, removed it.
- Maybe i missunderstood wiki, but as I see libraries (or dependencies) directory must be lokated in
PROJECT_SOURCE_DIR
(for example in my case it isC:/Arduino/CMake/test1
) and library directory has name as .cpp and .h files. Include<OneWire.h>
and<DallasTemperature.h>
in main.cpp works great. Eg
- CMakeLists.txt
- test1/CMakeLists.txt
- test1/main.cpp
- test1/libraries/DallasTemperature/DallasTemperature.h
- test1/libraries/OneWire/OneWire.h
message(${ARDUINO_SDK_LIBRARIES_PATH})
message(${PROJECT_SOURCE_DIR})
C:/Program Files (x86)/Arduino/libraries
C:/Arduino/CMake/test1
CMake output
C:\JetBrains\apps\CLion\ch-0\183.4886.39\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE= -DCMAKE_TOOLCHAIN_FILE=arduino-cmake-ng/cmake/Arduino-Toolchain.cmake -G "CodeBlocks - MinGW Makefiles" C:\Arduino\CMake
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
-- Check for working C compiler: C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-gcc.exe
-- Check for working C compiler: C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
-- Check for working CXX compiler: C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-g++.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
C:/Program Files (x86)/Arduino/libraries
C:/Arduino/CMake/test1
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Arduino/CMake/cmake-build-default-mingw
[Finished]
Build output
====================[ Build | test1 | Default-MinGW ]===========================
C:\JetBrains\apps\CLion\ch-0\183.4886.39\bin\cmake\win\bin\cmake.exe --build C:\Arduino\CMake\cmake-build-default-mingw --target test1 -- -j 2
[ 80%] Built target mini_atmega328_core_lib
[ 83%] Building CXX object test1/CMakeFiles/DallasTemperature.dir/C_/Program_Files_(x86)/Arduino/libraries/DallasTemperature/DallasTemperature.cpp.obj
[ 90%] Built target OneWire
In file included from C:\Program Files (x86)\Arduino\libraries\DallasTemperature\DallasTemperature.cpp:6:0:
C:\Program Files (x86)\Arduino\libraries\DallasTemperature\DallasTemperature.h:25:21: fatal error: OneWire.h: No such file or directory
compilation terminated.
test1\CMakeFiles\DallasTemperature.dir\build.make:61: recipe for target 'test1/CMakeFiles/DallasTemperature.dir/C_/Program_Files_(x86)/Arduino/libraries/DallasTemperature/DallasTemperature.cpp.obj' failed
mingw32-make.exe[3]: *** [test1/CMakeFiles/DallasTemperature.dir/C_/Program_Files_(x86)/Arduino/libraries/DallasTemperature/DallasTemperature.cpp.obj] Error 1
mingw32-make.exe[2]: *** [test1/CMakeFiles/DallasTemperature.dir/all] Error 2
CMakeFiles\Makefile2:208: recipe for target 'test1/CMakeFiles/DallasTemperature.dir/all' failed
CMakeFiles\Makefile2:109: recipe for target 'test1/CMakeFiles/test1.dir/rule' failed
mingw32-make.exe[1]: *** [test1/CMakeFiles/test1.dir/rule] Error 2
mingw32-make.exe: *** [test1] Error 2
Makefile:117: recipe for target 'test1' failed
from arduino-cmake-ng.
@ustisha Sorry again for the long delay, was sure I was the last one commented here 😆
Anyways, could you somehow share your entire project? I need to take a look at your structure, thanks.
Update:
It's been a while, but I've just realized that I haven't been entirely focused last time I looked at this issue, so I missed @ustisha your link to an example project, describing everything I need.
So I ran through your CMakeLists.txt again, and noticed you're not treating your included libraries as 3rd party libraries, which is how Arduino-CMake expects you to treat them.
I'm not sure if it's going to solve your issue, but that's a general tip you could apply.
Besides, it might be that Arduino-CMake does not recognize your relative directory structure, but to assure that, I'll need your help reporting.
from arduino-cmake-ng.
Hello back @MrPointer ! I'm do some research as much as I can. For now still do not understand few things.
- I updated my example project
- Adding libs works as I described in CMakeLists.txt I added some debug message and i see adding is succesfull
C:\JetBrains\apps\CLion\ch-0\191.6707.69\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=arduino-cmake-ng/cmake/Arduino-Toolchain.cmake -G "CodeBlocks - MinGW Makefiles" C:\Arduino\CMake
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
-- Arduino SDK version 1.8.8: C:/Program Files (x86)/Arduino
-- Determined Platform Header: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h
add_arduino_library OneWire_Lib - mini.atmega328 - C:/Arduino/CMake/libraries/Onewire/OneWire.h;C:/Arduino/CMake/libraries/Onewire/OneWire.cpp
add_arduino_library DallasTemperature_Lib - mini.atmega328 - C:/Arduino/CMake/libraries/Dallastemperature/DallasTemperature.h;C:/Arduino/CMake/libraries/Dallastemperature/DallasTemperature.cpp
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Arduino/CMake/cmake-build-debug
[Finished]
But build still failed
====================[ Build | test1 | Debug ]===================================
C:\JetBrains\apps\CLion\ch-0\191.6707.69\bin\cmake\win\bin\cmake.exe --build C:\Arduino\CMake\cmake-build-debug --target test1 -- -j 4
[ 80%] Built target mini_atmega328_core_lib
Scanning dependencies of target DallasTemperature_Lib
[ 90%] Building CXX object test1/CMakeFiles/DallasTemperature_Lib.dir/__/libraries/DallasTemperature/DallasTemperature.cpp.obj
[ 90%] Built target OneWire_Lib
In file included from C:\Arduino\CMake\libraries\DallasTemperature\DallasTemperature.cpp:6:0:
C:\Arduino\CMake\libraries\DallasTemperature\DallasTemperature.h:25:21: fatal error: OneWire.h: No such file or directory
compilation terminated.
mingw32-make.exe[3]: *** [test1/CMakeFiles/DallasTemperature_Lib.dir/__/libraries/DallasTemperature/DallasTemperature.cpp.obj] Error 1
test1\CMakeFiles\DallasTemperature_Lib.dir\build.make:61: recipe for target 'test1/CMakeFiles/DallasTemperature_Lib.dir/__/libraries/DallasTemperature/DallasTemperature.cpp.obj' failed
mingw32-make.exe[2]: *** [test1/CMakeFiles/DallasTemperature_Lib.dir/all] Error 2
CMakeFiles\Makefile2:95: recipe for target 'test1/CMakeFiles/DallasTemperature_Lib.dir/all' failed
mingw32-make.exe[1]: *** [test1/CMakeFiles/test1.dir/rule] Error 2
CMakeFiles\Makefile2:146: recipe for target 'test1/CMakeFiles/test1.dir/rule' failed
mingw32-make.exe: *** [test1] Error 2
Makefile:130: recipe for target 'test1' failed
3rd party libraries
not helped. When I paste 3RD_PARTY nothing changed.
from arduino-cmake-ng.
I just hit this issue, and after some digging I figured out the fix:
ustisha/[email protected]:patch-1
Good Job!
Dependencies should be linked manually, this is main problem.
link_arduino_library(DallasTemperature_Lib OneWire_Lib ${board_id})
I will try this fix on my project with much libs, but if each lib will be need linked manually it can be problem (( Also i already make some fix in old https://github.com/queezythegreat/arduino-cmake and use it.
from arduino-cmake-ng.
@ustisha Oh, I'm not really familiar with any Arduino libraries so I didn't know DallasTemperature depends on OneWire 😆
Yes, that explains it all.
As for the annoyance it might cause, unfortunately there's not much we can do about it, as there's no way for the framework (at least currently or in the near future) to resolve dependencies on its' own.
Moreover, I believe this feature couldn't be implemented in plain CMake, and would require a 3rd-party tool such as python.
from arduino-cmake-ng.
Related Issues (20)
- Project is dead HOT 1
- upload_arduino_target does not work (avrdude problem?) HOT 4
- Problem when with determining link language. HOT 3
- Undefined reference error when linking 3rd party libraries. HOT 4
- Refactor upload API
- Undefined reference to countPulseASM when using pulseIn function HOT 8
- Newbie: need some hand holding. HOT 2
- RegisterHardwarePlatform doesn't work HOT 3
- Install for library depending on platform HOT 6
- FastLED library linker errors HOT 1
- vidor 4000 HOT 1
- SDK not found on Debian 9 with official Arduino binary HOT 2
- Provide means to override `avrdude`
- find_arduino_library simply doesn't work HOT 6
- ARDUINO_SDK_PATH variable is forgotten during compiler check (v0.6.1) HOT 2
- Support for Third-Party Boards - Game plan HOT 4
- Reduce search-paths for version.txt file
- Board 'nano33ble' not working, unrecorgnized command -mcpu=cortex-m4 HOT 1
- SD card library is not being found. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-cmake-ng.