Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builder crashes on second run #6407

Closed
MicioMax opened this issue Jun 21, 2017 · 8 comments
Closed

Builder crashes on second run #6407

MicioMax opened this issue Jun 21, 2017 · 8 comments
Labels
arduino-builder The tool used to handle the Arduino sketch compilation process Type: Bug Type: Duplicate Another item already exists for this topic

Comments

@MicioMax
Copy link

I've a couple of big sketches (custom board and platform files...) which crashes the builder on second run. I have to close and restart the IDE to rebuild it.
Here the java crash log... please tell me if you need more :

panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x556bc0, 0xc420010140)
/home/jenkins/go/src/runtime/panic.go:500 +0x1a1
arduino.cc/builder.findIncludesUntilDone(0xc420034c00, 0xc4203823f0, 0x556f40, 0xc42039b4a0, 0xc4202840d4, 0x10, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/container_find_includes.go:321 +0x138f
arduino.cc/builder.(*ContainerFindIncludes).Run(0x64d248, 0xc420034c00, 0x41bc3c3c, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/container_find_includes.go:149 +0x5e4
arduino.cc/builder.runCommands(0xc420034c00, 0xc420473ae8, 0x22, 0x22, 0x1, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:191 +0xcd
arduino.cc/builder.(*Builder).Run(0xc420473d38, 0xc420034c00, 0xc420045d88, 0x562240)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:124 +0xb9c
arduino.cc/builder.RunBuilder(0xc420034c00, 0xc420045d88, 0x64d248)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:222 +0x35
main.main()
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/arduino-builder/main.go:338 +0x99c
/home/massimo/Documenti/Elettronica/ARDUINO/arduino-1.8.3/arduino-builder ha restituito 2
Errore durante la compilazione per la scheda Fishino32.

@matthijskooijman
Copy link
Collaborator

matthijskooijman commented Jun 22, 2017

I think this is the same as arduino/arduino-builder#230. What board are you compiling for? Could you see if the arduino-builder from arduino/arduino-builder#236 fixes this?

@MicioMax
Copy link
Author

I guess it's the same issue, I'm using a platform.txt derived from chipkit one.
I'll test your builder, thank you!

@MicioMax
Copy link
Author

Yep... the crash is away.
For the meanwhile, is it possible to modify the platform.txt to make the unpatched IDE work ?
I've got many people using my package, and most of them don't know how to patch it...

@MicioMax
Copy link
Author

MicioMax commented Jun 22, 2017

mhhhh.... it shows no error, but it has problems; here the last part of the output, followed by last part of the output of my own IDE (self coded), which uses same platform data; you can see that sketch size is ONE THIRD in arduino ide, and it doesn't even start on my board :
ARDUINO IDE OUTPUT

Uso la libreria FishinoDebug alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoDebug 
Uso la libreria Wire nella cartella: /home/massimo/.arduino15/packages/fishino/hardware/pic32/6.0.0/libraries/Wire (legacy)
Uso la libreria Timer alla versione 1.0.0 nella cartella: /home/massimo/.arduino15/packages/fishino/hardware/pic32/6.0.0/libraries/Timer 
Uso la libreria SPI nella cartella: /home/massimo/.arduino15/packages/fishino/hardware/pic32/6.0.0/libraries/SPI (legacy)
Uso la libreria I2S alla versione 5.1.0 nella cartella: /home/massimo/.arduino15/packages/fishino/hardware/pic32/6.0.0/libraries/I2S 
Uso la libreria FishinoStream alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoStream 
Uso la libreria FishinoAudioCodec alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoAudioCodec 
Uso la libreria FishinoAudioReader alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoAudioReader 
Uso la libreria FishinoPlayer alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoPlayer 
Uso la libreria FishinoFileStream alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoFileStream 
Uso la libreria FishinoSdFat alla versione 6.0.0 nella cartella: /home/massimo/sketchbook/libraries/FishinoSdFat 
Lo sketch usa 118168 byte (22%) dello spazio disponibile per i programmi. Il massimo è 524288 byte.
Le variabili globali usano 6792 byte (5%) di memoria dinamica, lasciando altri 124280 byte liberi per le variabili locali. Il massimo è 131072 byte.

FISHIDE output :

Creazione archivio '_SKETCH_.ar' : [ FishinoPlayerTest.ino.cpp ]
Linking di FishinoPlayerTest.elf : [ _CORE.ar LIB_FishinoDebug.ar LIB_Wire.ar LIB_Timer.ar LIB_SPI.ar LIB_I2S.ar LIB_FishinoStream.ar LIB_FishinoAudioCodec.ar LIB_FishinoAudioReader.ar LIB_FishinoPlayer.ar LIB_FishinoSdFat.ar LIB_FishinoFileStream.ar _SKETCH_.ar ]
Creazione del file HEX 'FishinoPlayerTest.hex' : [ FishinoPlayerTest.elf ]
Getting size for 'FishinoPlayerTest.hex'
Sketch output sizes:
  CODE   :     316588 bytes
  DATA   :       6768 bytes
  EEPROM :       3948 bytes

@matthijskooijman
Copy link
Collaborator

For an example to fix this in platform.txt, see chipKIT32/chipKIT-core#356
Essentially you're just inlining the compiler.c.flags var into the compiler.cpp.flags var.

As for your other error, I suspect it is a different and unrelated problem. The difference in code size is remarkable, so that would be a good place to start debugging (I have some scripts on github that can help figuring out what's inside and what's the difference). Comparing the full list of gcc commands between both IDEs might also be useful (perhaps different board options or defines are passed on the commandline? Different optimization options?).

@MicioMax
Copy link
Author

Hi matthijskooijman,
yep, I solved the crash adding compiler.preproc.flags without the -MMD and it builds now.
The size problem is still there, I guess it's a problemi with the linker, I'll investigate it.
In my IDE I use a totally different approach, making all the .ar first and then linking them together.
Probably IDE's linker is missing some library code... the weird stuff is that it doesn't complain at all.
Smaller sketches do work indeed.

@MicioMax
Copy link
Author

(options are exactly the same on both IDEs. Mine has provisions for changing the optimizations, but I checked the compiler commands and it's exactly the same, just include's order change. Linker command is quite different)

@per1234
Copy link
Collaborator

per1234 commented Aug 3, 2017

@MicioMax any news on the code size difference? Can this issue be closed now or is there still an outstanding issue with the Arduino IDE?

@per1234 per1234 added arduino-builder The tool used to handle the Arduino sketch compilation process Type: Bug Type: Duplicate Another item already exists for this topic labels Dec 24, 2020
@per1234 per1234 closed this as completed Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arduino-builder The tool used to handle the Arduino sketch compilation process Type: Bug Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

3 participants