Sketch compilation hangs on Arduino 1.6.4.

A code was compiling on 1.0.6. but on Arduino 1.6.4., the compilation hangs. Here is the compilation verbose output:

Build options changed, rebuilding all
Using library phi_buttons in folder: C:\Users\Mike\Documents\Arduino\libraries\phi_buttons (legacy)
Using library phi_prompt in folder: C:\Users\Mike\Documents\Arduino\libraries\phi_prompt (legacy)
Using library phi_interfaces in folder: C:\Users\Mike\Documents\Arduino\libraries\phi_interfaces (legacy)
Using library LiquidCrystal in folder: C:\Users\Mike\Documents\Arduino\libraries\LiquidCrystal (legacy)
Using library i2cmaster in folder: C:\Users\Mike\Documents\Arduino\libraries\i2cmaster (legacy)

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Users\Mike\Documents\Arduino\libraries\phi_buttons -IC:\Users\Mike\Documents\Arduino\libraries\phi_prompt -IC:\Users\Mike\Documents\Arduino\libraries\phi_interfaces -IC:\Users\Mike\Documents\Arduino\libraries\LiquidCrystal -IC:\Users\Mike\Documents\Arduino\libraries\i2cmaster C:\Users\Mike\AppData\Local\Temp\build2356348967089628784.tmp\SMBusBattery2_Phi.cpp -o C:\Users\Mike\AppData\Local\Temp\build2356348967089628784.tmp\SMBusBattery2_Phi.cpp.o

and it just sits there, with the green progress bar at about 25%. The sketch and the libraries are attached.

SMBusBattery2_Phi.zip (96.5 KB)

I also have sometimes this problem with 1.6.4.

Sometimes i forgott a ) oder } and somtimes the syntaxchecker dont bring a Error, it still hangs (without any message).

(Somertimes :wink:

i can verify that it is indeed the case that for a very peculiar and hard to repeat source code condition, setting preference COMPILER WARNINGS = ALL definitely, repeatedly, causes 1.6.4 to hang. setting COMPILER WARNINGS = DEFAULT and compilation completes (obviously with dozens of errors).

the code fragment below is from a large-ish program with many source file tabs that i pruned down to the smallest file i could make that still exhibits the problem. the program is reduced to nonsense but on my system -- win10, i7, 1.6.4 IDE -- hangs or not as above.

commenting out any one line prevents the hang.

i am not fully convinced that this is the only thing that causes this hang problem -- i turned COMPILER WARNINGS = ALL on trying to find the source of the compilation hang! i suspect it's a more general problem in the way the IDE forms the command tail it passes to gcc. been there done that, problems escaping quotes and all that rot in system() or fork(). ugh.

#include <EEPROM.h>


void setup () {

   playerDisk();

  T.begin (NUMTIMERS);
  T.setTimer (LIGHTTIMER, 13003);
  T.setTimer (PBSWTIMER, 50);                 // switch debouncer
  digitalWrite (PBSW, 1);                     // turn on switch pullup
  button(); button();                         // init the state machine
  
  PRNG.begin();

  log (F("setup power"));
  pinMode (AMP_SD, OUTPUT);                   // 
  digitalWrite (AMP_SD, 0);                   // disable amp
  analogReference (INTERNAL);                 // internal 1.1V ref
  
  power_setup();
  
  // setup the message dispatchers so that we can run
  // EEPROM data through it.
  //
  log ("setup message parsers");
  M.begin();                                  // command parsers
  M.addDispatcher (&priorityMessages, 3);     // EEPROM config messages, top slot
  M.addDispatcher (&birdMessages);            // bird/sound messages, normal priority
  M.addDispatcher (&radioMessages);           // then Flock/radio messages

  peep_setup();

  log (F("setup EEPROM settings"));
  if (! loadSettings()) {                     // un-set, malformed, wrong mark, etc
    log (F("setup load EEPROM error, using defaults"));
    red.seq (BLINKSERROR);
    M.rxString ((char *)defaultSettings, 3);
    Flock.setIdentity (identity= 'Y');        // set up functional default
  }
  log (F("setup we are bird"), identity); 

  player_setup();                             // start the player
  log (F("setup heap size"), freeRam());
  log (F("setup begin loop()"));  
  SRL.begin (60);                             // measure/report loop()
}

// run all the tasks. LED-blink decisions are made mostly in
// player(), since it is the main task and uses the LED to 
// say what's happening. the Flock radio sets 'connected' flag
// so that idle player() knows what the default blinking state is.
//
void loop() {

  playerDisk();                               // watch for USB disk mounting
  ambientLight();                             // measure ambient light
  red.LED();                                  // LED state machine
  M.rxUSB();                                  // commands from USB/Serial Monitor
  if (button()) playCtl (true);               // jumps the playing state machine
  player_loop();                              // make sounds
  battery_loop();                             // monitor battery
  solar_loop();                               // monitor solar and daytime
  report_loop();                              // issue reports
  peep_loop();
  SRL.tally();                                // loop() statistics
}

and here is my preferences.txt (long!)

board=pro boardsmanager.additional.urls= build.verbose=true
build.warn_data_percentage=75 compiler.warning_level=all console=true
console.auto_clear=true console.error.file=stderr.txt console.length=500
console.lines=4 console.output.file=stdout.txt custom_cpu=pro_8MHzatmega328

export.applet.separate_jar_files=false export.application.fullscreen=false
export.application.platform=true export.application.stop=true
export.delete_target_folder=true last.ide.1.5.3.daterun=1389402553
last.ide.1.5.3.hardwarepath=D:\Users\Public\Documents\arduino-1.5.3\hardware
last.ide.1.5.7.daterun=1425281790
last.ide.1.5.7.hardwarepath=D:\Users\Public\Documents\arduino-1.5.7\hardware
last.ide.1.6.0.daterun=1426034426 last.ide.1.6.0.hardwarepath=C:\Program Files
(x86)\Arduino\hardware last.ide.1.6.1.daterun=1430101258
last.ide.1.6.1.hardwarepath=C:\Program Files (x86)\Arduino\hardware
last.ide.1.6.3.daterun=1432334723 last.ide.1.6.3.hardwarepath=C:\Program Files
(x86)\Arduino\hardware last.ide.1.6.4.daterun=1440795499
last.ide.1.6.4.hardwarepath=C:\Program Files (x86)\Arduino\hardware
last.ide.1.6.5.daterun=1438070295 last.ide.1.6.5.hardwarepath=C:\Program Files
(x86)\Arduino\hardware last.screen.height=1080 last.screen.width=1920
last.serial.location=590,24,561,759 last.sketch.count=2
last.sketch0.location=1086,14,825,933,601
last.sketch0.path=D:\Users\tomic\Documents\Arduino\Stroll_sound_box\Stroll_sound_box.ino
last.sketch1.location=526,50,1050,921,719
last.sketch1.path=D:\Users\tomic\Documents\arduino\deleteme\deleteme.ino
last.sketch2.location=503,109,734,817,549
last.sketch2.path=C:\Users\tomic\Documents\arduino\RoadsterPanel\RoadsterPanel.ino
last.sketch3.location=455,121,856,895,581
last.sketch3.path=C:\Users\tomic\Documents\arduino\RoadsterPanel\RoadsterPanel.ino
platform.auto_file_type_associations=false preproc.color_datatype=true
preproc.enhanced_casting=true
preproc.imports.list=java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*
preproc.output_parse_tree=false preproc.save_build_files=false
preproc.substitute_floats=true preproc.substitute_unicode=true
preproc.web_colors=true programmer=arduino:avrispmkii proxy.http.port=8080
proxy.http.server= proxy.https.port=8443 proxy.https.server= proxy.password=
proxy.user=
INACTIVE\galileo_bit_set_reset\galileo_bit_set_reset.ino run.display=1
run.options= run.options.memory=false run.options.memory.initial=64
run.options.memory.maximum=256 run.present.bgcolor=#666666
run.present.exclusive=false run.present.stop.color=#cccccc
run.window.bgcolor=#F0F0F0 serial.databits=8 serial.debug_rate=9600
serial.line_ending=2 serial.parity=N serial.port=COM4 serial.port.file=COM4
serial.stopbits=1 sketchbook.path=D:\Users\tomic\Documents\Arduino
software=ARDUINO target_package=arduino target_platform=avr update.check=true
update.id=-719787273543341124 update.last=1435014363601
upload.using=bootloader upload.verbose=false upload.verify=false

Upgrade to 1.6.5 r5

Pete