Compilation error 'panic: runtime error: index out of range'

biomurph
Posts: 5
Joined: Fri Oct 25, 2013 7:59 pm

Compilation error 'panic: runtime error: index out of range'

Post by biomurph » Tue Dec 13, 2016 6:50 pm

Hi,

I'm having the same problem that was posted on the Digilent forum here https://forum.digilentinc.com/topic/312 ... ment-11567

I can compile my code once, but then when I try to compile the exact same code again, I get the following error with verbose output:

Code: Select all

Arduino: 1.6.13 (Mac OS X), Board: "OpenBCI 32"

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Applications/Arduino.app/Contents/Java/portable/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Applications/Arduino.app/Contents/Java/portable/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/biomurph/Documents/Arduino/libraries -fqbn=chipKIT:pic32:openbci -ide-version=10613 -build-path /var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc -prefs=runtime.tools.pic32prog.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library/examples/DefaultBoard/DefaultBoard.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Applications/Arduino.app/Contents/Java/portable/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Applications/Arduino.app/Contents/Java/portable/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/biomurph/Documents/Arduino/libraries -fqbn=chipKIT:pic32:openbci -ide-version=10613 -build-path /var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.drivers-windows.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/drivers-windows/v2 -prefs=runtime.tools.pic32-tools.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc -prefs=runtime.tools.pic32prog.path=/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32prog/v2.1.24 -verbose /Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library/examples/DefaultBoard/DefaultBoard.ino
Using board 'openbci' from platform in folder: /Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1
Using core 'pic32' from platform in folder: /Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1
Detecting libraries used...
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "-I/Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/tools/pic32-tools/1.42-pic32gcc/bin/pic32-g++" -c -g -O2 -w  -DARDUINO_ARCH_PIC32 -mno-smart-io -ffunction-sections -fdata-sections  -mdebugger -Wcast-align -fno-short-double -ftoplevel-reorder -MMD -fno-exceptions -w -x c++ -E -CC -mprocessor=32MX250F128B -DF_CPU=40000000L -DARDUINO=10613 -D_BOARD_DP32_ -DARDUINO_ARCH_PIC32 -DMPIDEVER=16777998 -DMPIDE=150 -DIDE=Arduino -G1024 -D_USE_USB_FOR_SERIAL_ -I/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/cores/pic32" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/variants/OpenBCI" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/DSPI" "-I/Users/biomurph/Documents/Arduino/libraries/OBCI32_SD" "-I/Applications/Arduino.app/Contents/Java/portable/packages/chipKIT/hardware/pic32/1.3.1/libraries/EEPROM" "-I/Users/biomurph/Documents/Arduino/libraries/OpenBCI_32bit_Library" "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/sketch/DefaultBoard.ino.cpp" -o "/var/folders/t3/l33f2l513k95rr5c2r8m16h40000gn/T/arduino_build_605801/preproc/ctags_target_for_gcc_minus_e.cpp"
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x1519c0, 0xc4200100a0)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
arduino.cc/builder.findIncludesUntilDone(0xc42006f500, 0xc4203aacc0, 0x151ce0, 0xc42035d680, 0xc4202d01b6, 0x8, 0x0, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/container_find_includes.go:321 +0x138f
arduino.cc/builder.(*ContainerFindIncludes).Run(0x244c58, 0xc42006f500, 0x41bc3c3c, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/container_find_includes.go:149 +0x5e4
arduino.cc/builder.runCommands(0xc42006f500, 0xc4201a9af8, 0x22, 0x22, 0x1, 0x0, 0x0)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:189 +0xcd
arduino.cc/builder.(*Builder).Run(0xc4201a9d48, 0xc42006f500, 0xc42003bda8, 0x15cc60)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:124 +0xb90
arduino.cc/builder.RunBuilder(0xc42006f500, 0xc42003bda8, 0x244c58)
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/builder/builder.go:220 +0x35
main.main()
	/Users/jenkins/jenkins/workspace/arduino-builder-macosx/src/arduino.cc/arduino-builder/main.go:316 +0x912
/Applications/Arduino.app/Contents/Java/arduino-builder returned 2
Error compiling for board OpenBCI 32.
I'm using Arduino 1.6.13 with ChipKIT 1.3.1 installed.
I can't post the verbose output when compilation is successful, because it is too many characters.

If I close the programming window (not quit out of the IDE, just close the window) and then reopen the program, I can compile again OK, but only once. The code that I'm using is from this repo https://github.com/OpenBCI/OpenBCI_32bit_Library and I'm trying to deploy the DefaultBoard.ino from the examples folder. Can you see if you can reproduce the problem? Or perhaps the verbose output will help figure out where the error is happening.

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Tue Dec 13, 2016 10:24 pm

It looks like this is actually a bug in Arduino-Builder, part of the IDE.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

jasonk
Posts: 100
Joined: Mon May 23, 2011 6:38 am
Location: Chandler, Arizona
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by jasonk » Tue Dec 13, 2016 10:32 pm

/usr/local/go/src/runtime/panic.go:500 +0x1a1
arduino.cc/builder.findIncludesUntilDone
Maybe something funky with the include files?
Jason Kajita
Microchip Technology
Follow me on Twitter

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Tue Dec 13, 2016 11:28 pm

I have just submitted a PR to OpenBCI to fix the use of plib.h in one of their libraries (OBCI32_SD.h) which was causing it to break on the more recent compilers. This library is used in the DefaultBoard.ino example. You can manually remove plib.h from your copy (OBCI32_SD/utility/Sd2Card.cpp) by just removing the "#include <plib.h>" line.

See if that helps it to compile.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

biomurph
Posts: 5
Joined: Fri Oct 25, 2013 7:59 pm

Re: Compilation error 'panic: runtime error: index out of range'

Post by biomurph » Tue Dec 13, 2016 11:35 pm

Merged your pull request. Thanks majenko!

This does not fix the problem of compile success happening only once, and then failing after.
Were you able to replicate the error? Paul Stoffregen links to his code repo that has the same problem in the Digilent forum post I linked to above.

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Tue Dec 13, 2016 11:50 pm

Compilation works fine in UECIDE with all the latest chipKIT core and compiler (now plib is removed), which leads me to suspect the IDE is to blame. I don't have it installed at the moment so I can't try it.

By the way, there's at least one place in the examples where there is a capitalization problem in the include filenames. It breaks compiling on operating systems with case sensitive filesystems (32Bit vs 32bit is the one I found).
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Wed Dec 14, 2016 12:01 am

I can't get it to even start to compile in the Arduino IDE in Linux due to (again) a b0rk with capitalization (damned windows users!!!!!)
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Wed Dec 14, 2016 12:06 am

PR to chipKIT-core submitted to fix that gripe.

In Linux on 1.6.9 I can compile DefaultBoard.ino over and over and over again.

Same on 1.6.11. I need to download a newer one...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Compilation error 'panic: runtime error: index out of range'

Post by majenko » Wed Dec 14, 2016 12:15 am

Bingo. 1.6.13: panic: runtime error: index out of range

Same in 1.6.12

So something broke in the IDE between 1.6.11 and 1.6.12
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

biomurph
Posts: 5
Joined: Fri Oct 25, 2013 7:59 pm

Re: Compilation error 'panic: runtime error: index out of range'

Post by biomurph » Wed Dec 14, 2016 12:23 am

Ok, well I guess I'm forum hopping!
Thanks, majenko for helping to chase down this problem.

Post Reply