Cannot compile empty teensy35 project using arduino-builder

Status
Not open for further replies.

mmassi

New member
I am trying to compile an empty sketch from the command line (explanation on why I want to do this at the bottom).

I am on Linux, the installation is a clean arduino IDE 1.8.7, patched by teensyduino 1.44.

The command I run is this:

Code:
../arduino-1.8.7/arduino-builder -verbose -build-path /home/massi/teensy/build -build-cache /home/massi/teensy/cache -hardware ~massi/arduino-1.8.7/hardware -tools ~massi/arduino-1.8.7/tools -fqbn=teensy:avr:teensy35:speed=120 empty.ino/empty.ino.ino
I am not sure about the fqbn I should use (BTW, where is this documented?).
And my guess is that the problem is likely a wrong or incomplete fqbn.

The error I get is
Code:
<command-line>:0:1: error: macro names must be identifiers
, because at some point the build system runs this command:

Code:
/home/massi/arduino-1.8.7/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK64FX512__ -DTEENSYDUINO=144 -DARDUINO=10600 -DF_CPU=120000000 -D -DLAYOUT_ -I/home/massi/arduino-1.8.7/hardware/teensy/avr/cores/teensy3 /home/massi/teensy/build/sketch/empty.ino.ino.cpp -o /home/massi/teensy/build/preproc/ctags_target_for_gcc_minus_e.cpp

If you look carefully, you'l see a standalone "-D" option in that command.
There's some sort of "empty define", likely something that should have been in the build arguments.
Running that command without the standalone "-D" works.

How do I fix this?
Thanks!


Now the reason why I am doing this.
What I actually plan to do is to use Rust (the programming language) to write the sketch, but reusing (linking) the existing C core library.
To do so I need to run the build on the command line, produce the core library, and see the link command as performed by arduino-builder.
I can modify the link command, then replacing the sketch object file with one I generated with Rust.
I already did this with other arduino platforms and it works :)
It is a very simple way of using Rust to write my code while keeping the core library to initialize the board and perform low level functions.
 
Thanks for the quick reply!

However, it did not work.

This is the full log of what happens on the terminal (both my command and the output):

Code:
[massi@matrix teensy]$ ../arduino-1.8.7/arduino-builder -verbose -build-path /home/massi/teensy/build -build-cache /home/massi/teensy/cache -hardware ~massi/arduino-1.8.7/hardware -tools ~massi/arduino-1.8.7/tools -fqbn=teensy:avr:teensy35:speed=120:usb=serial:opt=o2std:keys=en-us empty.ino/empty.ino.ino 
Using board 'teensy35' from platform in folder: /home/massi/arduino-1.8.7/hardware/teensy/avr
Using core 'teensy3' from platform in folder: /home/massi/arduino-1.8.7/hardware/teensy/avr
Detecting libraries used...
/home/massi/arduino-1.8.7/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK64FX512__ -DTEENSYDUINO=144 -DARDUINO=10600 -DF_CPU=120000000 -D -DLAYOUT_ -I/home/massi/arduino-1.8.7/hardware/teensy/avr/cores/teensy3 /home/massi/teensy/build/sketch/empty.ino.ino.cpp -o /dev/null
Error while detecting libraries included by /home/massi/teensy/build/sketch/empty.ino.ino.cpp
Generating function prototypes...
/home/massi/arduino-1.8.7/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -D__MK64FX512__ -DTEENSYDUINO=144 -DARDUINO=10600 -DF_CPU=120000000 -D -DLAYOUT_ -I/home/massi/arduino-1.8.7/hardware/teensy/avr/cores/teensy3 /home/massi/teensy/build/sketch/empty.ino.ino.cpp -o /home/massi/teensy/build/preproc/ctags_target_for_gcc_minus_e.cpp
<command-line>:0:1: error: macro names must be identifiers
exit status 1

The error is always the same, that lonely "-D" option, in both commands run by the builder (library detection and prototype generation).

For what is worth, the empty sketch file is this:

Code:
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Can you reproduce it in your environment?
It should not take much, just create an empty sketch and run arduino-builder on it.
 
It should not take much, just create an empty sketch and run arduino-builder on it.

Hm. Yes. Why don't you do it :) Just open arduino, press upload. Mine shows this in the black window:

Code:
C:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Arduino\hardware -hardware C:\Users\Frank\AppData\Local\Arduino15\packages -tools C:\Arduino\tools-builder -tools C:\Arduino\hardware\tools\avr -tools C:\Users\Frank\AppData\Local\Arduino15\packages -built-in-libraries C:\Arduino\libraries -libraries C:\Users\Frank\Documents\Arduino\libraries -fqbn=teensy:avr:teensy35:usb=serial,speed=120,opt=o2std,keys=en-us -ide-version=10807 -build-path c:\temp\arduino_build_935264 -warnings=all -build-cache c:\temp\arduino_cache_857759 -verbose c:\temp\untitled1486180498.tmp\sketch_oct05a\sketch_oct05a.ino
C:\Arduino\arduino-builder -compile -logger=machine -hardware C:\Arduino\hardware -hardware C:\Users\Frank\AppData\Local\Arduino15\packages -tools C:\Arduino\tools-builder -tools C:\Arduino\hardware\tools\avr -tools C:\Users\Frank\AppData\Local\Arduino15\packages -built-in-libraries C:\Arduino\libraries -libraries C:\Users\Frank\Documents\Arduino\libraries -fqbn=teensy:avr:teensy35:usb=serial,speed=120,opt=o2std,keys=en-us -ide-version=10807 -build-path c:\temp\arduino_build_935264 -warnings=all -build-cache c:\temp\arduino_cache_857759 -verbose c:\temp\untitled1486180498.tmp\sketch_oct05a\sketch_oct05a.ino

hope it helps..
 
If you don't see those messages in Arduino, click File > Preferences and turn on verbose info while compiling.

Well... *sorry* for the noise, and thanks to everybody.
Obviously it worked, and now I am able to build from the command line.

Thanks again!
Massimiliano
 
Status
Not open for further replies.
Back
Top