queezythegreat / arduino-cmake

Arduino CMake Build system
645 stars 216 forks source link

Fails to build if loop or setup are defined in a library #72

Open mdaffin opened 10 years ago

mdaffin commented 10 years ago

See this project for an example of this issue.

Arduino-cmake is unable to build projects with either setup or loop defined in a library, when building with cmake the following error occurs:

Linking CXX executable blink.elf
libuno_CORE.a(main.cpp.obj): In function `main':
/usr/share/arduino/hardware/arduino/cores/arduino/main.cpp:11: undefined reference to `setup'
 /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp:14: undefined reference to `loop'
collect2: error: ld returned 1 exit status
make[3]: *** [blink.elf] Error 1
make[2]: *** [CMakeFiles/blink.dir/all] Error 2
make[1]: *** [CMakeFiles/blink-upload.dir/rule] Error 2
make: *** [blink-upload] Error 2

However, the same library compiles and uploads fine using the arduino ide. The compile output from the ide can be found here

queezythegreat commented 10 years ago

Hi, I think the problem is with the order the libraries that are linked. Could you run the build with:

VERBOSE=1 make
mdaffin commented 10 years ago

Verbose output available here