__builtin_avr_delay_cycles on OSX/Linux

code at SimpleNeoPixelDemo/SimpleNeopixelDemo.ino at master · bigjosh/SimpleNeoPixelDemo · GitHub

Arduino 1.05 on OSX throws following error

/Applications/Arduino_1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/Applications/Arduino_1.0.5.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino_1.0.5.app/Contents/Resources/Java/hardware/arduino/variants/standard /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp -o /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp.o 
SimpleNeopixelDemo.ino:50: warning: 'optimize' attribute directive ignored
SimpleNeopixelDemo.ino: In function 'void sendBit(bool)':
SimpleNeopixelDemo:58: error: '__builtin_avr_delay_cycles' was not declared in this scope
SimpleNeopixelDemo:68: error: '__builtin_avr_delay_cycles' was not declared in this scope
SimpleNeopixelDemo.ino: In function 'void show()':
SimpleNeopixelDemo:131: error: '__builtin_avr_delay_cycles' was not declared in this scope
SimpleNeopixelDemo.ino: In function 'void theaterChase(unsigned char, unsigned char, unsigned char, unsigned char)':
SimpleNeopixelDemo.ino:205: warning: comparison between signed and unsigned integer expressions
SimpleNeopixelDemo.ino: In function 'void loop()':
SimpleNeopixelDemo.ino:340: warning: large integer implicitly truncated to unsigned type

if i add
#include <avr/builtins.h>

it throws

/var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp.elf /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp.o /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/core.a -L/var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp -lm 
SimpleNeopixelDemo.cpp.o: In function `show()':
/Applications/SimpleNeopixelDemo.ino:132: undefined reference to `__builtin_avr_delay_cycles'
SimpleNeopixelDemo.cpp.o: In function `sendBit(bool)':
/Applications/SimpleNeopixelDemo.ino:59: undefined reference to `__builtin_avr_delay_cycles'
/Applications/SimpleNeopixelDemo.ino:69: undefined reference to `__builtin_avr_delay_cycles'
/Applications/SimpleNeopixelDemo.ino:75: undefined reference to `__builtin_avr_delay_cycles'

the code compiles on linux. but doesn't work, it obviously hasn't got the tyming right.

only working version on Windows

any suggestionas are welcome

sorry last error looks like

/Applications/Arduino_1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp.elf /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/SimpleNeopixelDemo.cpp.o /var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp/core.a -L/var/folders/14/xkmxrqxn1wb66r_cv759rdym0000gn/T/build4898317401471903580.tmp -lm 
SimpleNeopixelDemo.cpp.o: In function `show()':
/Applications/SimpleNeopixelDemo.ino:132: undefined reference to `__builtin_avr_delay_cycles'
SimpleNeopixelDemo.cpp.o: In function `sendBit(bool)':
/Applications/SimpleNeopixelDemo.ino:59: undefined reference to `__builtin_avr_delay_cycles'
/Applications/SimpleNeopixelDemo.ino:69: undefined reference to `__builtin_avr_delay_cycles'
/Applications/SimpleNeopixelDemo.ino:75: undefined reference to `__builtin_avr_delay_cycles'

Arduino has a pretty old (2010, version 4.3.2) version of the avr-gcc; perhaps that was before __builtin_avr_delay_cycles() existed.
(Arduino SHOULD include the same version on all OSes these days; are you sure your windows system isn't using WINAVR or something instead of the arduino-provided compiler?)