Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Cannot compile empty teensy35 project using arduino-builder

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    3

    Cannot compile empty teensy35 project using arduino-builder

    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.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,367
    Try using

    Code:
    -fqbn=teensy:avr:teensy35:speed=120:usb=serial:opt=o2std:keys=en-us

  3. #3
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    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.

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,546
    Quote Originally Posted by mmassi View Post
    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..

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,367
    If you don't see those messages in Arduino, click File > Preferences and turn on verbose info while compiling.

  6. #6
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •