arduino/arduino-builder

Hardcoded /bin/avr-g++ path

ChrisCummins opened this issue · 4 comments

On macOS, using the arduino-1.8.8-macosx.zip arduino release, compilation of files using arduino-builder fails:

$ /Applications/Arduino.app/Contents/Java/arduino-builder \
  -debug-level 10 \
  -hardware='/Applications/Arduino.app/Contents/Java/hardware' \
  -tools '/Applications/Arduino.app/Contents/Java/tools/' \
  -fqbn 'arduino:avr:uno' \
  /Applications/Arduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino
Ts: 1547421414 - Running: GenerateBuildPathIfMissing
Setting build path to /var/folders/dc/_qx355px3dl1gqs1crp5nrjw0000gp/T/arduino-sketch-D5AE82E677127AC286F51DE66781D807
Ts: 1547421414 - Running: EnsureBuildPathExists
Ts: 1547421414 - Running: ContainerSetupHardwareToolsLibsSketchAndProps
Ts: 1547421414 - Running: AddAdditionalEntriesToContext
Ts: 1547421414 - Running: FailIfBuildPathEqualsSketchPath
Ts: 1547421414 - Running: HardwareLoader
Ts: 1547421414 - Running: PlatformKeysRewriteLoader
Ts: 1547421414 - Running: RewriteHardwareKeys
Ts: 1547421414 - Running: ToolsLoader
Ts: 1547421414 - Running: TargetBoardResolver
Ts: 1547421414 - Running: AddBuildBoardPropertyIfMissing
Ts: 1547421414 - Running: LibrariesLoader
Ts: 1547421414 - Running: SketchLoader
Ts: 1547421414 - Running: SetupBuildProperties
Ts: 1547421414 - Running: LoadVIDPIDSpecificProperties
Ts: 1547421414 - Running: SetCustomBuildProperties
Ts: 1547421414 - Running: AddMissingBuildPropertiesFromParentPlatformTxtFiles
Ts: 1547421414 - Running: ContainerBuildOptions
Ts: 1547421414 - Running: CreateBuildOptionsMap
Ts: 1547421414 - Running: LoadPreviousBuildOptionsMap
Ts: 1547421414 - Running: WipeoutBuildPathIfBuildOptionsChanged
Ts: 1547421414 - Running: StoreBuildOptionsMap
Ts: 1547421414 - Running: WarnAboutPlatformRewrites
Ts: 1547421414 - Running: RecipeByPrefixSuffixRunner
Looking for recipes like recipe.hooks.prebuild*.pattern
Ts: 1547421414 - Running: ContainerMergeCopySketchFiles
Ts: 1547421414 - Running: SketchSourceMerger
Ts: 1547421414 - Running: SketchSaver
Ts: 1547421414 - Running: AdditionalSketchFilesCopier
Ts: 1547421414 - Running: loggerAction
Ts: 1547421414 - Running: ContainerFindIncludes
Ts: 1547421414 - Running: PrintUsedAndNotUsedLibraries
Ts: 1547421414 - Running: PrintUsedLibrariesIfVerbose
Ts: 1547421414 - Running: ExportProjectCMake
Ts: 1547421414 - Running: Sizer
fork/exec /bin/avr-g++: no such file or directory
*os.PathError fork/exec /bin/avr-g++: no such file or directory
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/i18n/errors.go:19 (0x1146359)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/utils/utils.go:310 (0x1166e37)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/gcc_preproc_runner.go:63 (0x1183e90)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/container_find_includes.go:333 (0x117ec3b)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/container_find_includes.go:152 (0x117c79d)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:207 (0x117b585)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:125 (0x117aae7)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:223 (0x117b935)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/arduino-builder/main.go:406 (0x143b8e8)
/home/jenkins/go1.10.2-patched/src/runtime/proc.go:198 (0x102abb2)
/home/jenkins/go1.10.2-patched/src/runtime/asm_amd64.s:2361 (0x1056c11)

System Integrity Protection prevents creating the required symlink:

$ sudo ln -s /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ /bin/avr-g++
ln: failed to create symbolic link '/bin/avr-g++': Operation not permitted

Version:

$ /Applications/Arduino.app/Contents/Java/arduino-builder -version
Arduino Builder 1.4.1
Copyright (C) 2015 Arduino LLC and contributors
See https://www.arduino.cc/ and https://github.com/arduino/arduino-builder/graphs/contributors
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks for reporting it, Chris. I can indeed reproduce it.

We shall probably create AND use /usr/local/bin, @facchinm as it is already in the default PATH.

@ChrisCummins wow, we are not even trying to symlink avr-g++ to /bin (this would be madness 🙂 ).
Let me coordinate with @gvarisco to reproduce it and understand what is going on.
In the meantime, could you test the latest hourly version on the IDE and try to reproduce there? Thanks for reporting!

Hi guys, running the same command using the January 2019 16:29:17 GMT hourly build from here produces the same error:

$ ~/Downloads/Arduino.app/Contents/Java/arduino-builder -debug-level 10 -hardware ~/Downloads/Arduino.app/Contents/Java/hardware -tools ~/Downloads/Arduino.app/Contents/Java/tools/ -fqbn 'arduino:avr:uno' ~/Downloads/Arduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino

Ts: 1547461917 - Running: GenerateBuildPathIfMissing
Setting build path to /var/folders/dc/_qx355px3dl1gqs1crp5nrjw0000gp/T/arduino-sketch-B685043F11A95C3BD7E78945DC5DF53F
Ts: 1547461917 - Running: EnsureBuildPathExists
Ts: 1547461917 - Running: ContainerSetupHardwareToolsLibsSketchAndProps
Ts: 1547461917 - Running: AddAdditionalEntriesToContext
Ts: 1547461917 - Running: FailIfBuildPathEqualsSketchPath
Ts: 1547461917 - Running: HardwareLoader
Ts: 1547461917 - Running: PlatformKeysRewriteLoader
Ts: 1547461917 - Running: RewriteHardwareKeys
Ts: 1547461917 - Running: ToolsLoader
Ts: 1547461917 - Running: TargetBoardResolver
Ts: 1547461917 - Running: AddBuildBoardPropertyIfMissing
Ts: 1547461917 - Running: LibrariesLoader
Ts: 1547461917 - Running: SketchLoader
Ts: 1547461917 - Running: SetupBuildProperties
Ts: 1547461917 - Running: LoadVIDPIDSpecificProperties
Ts: 1547461917 - Running: SetCustomBuildProperties
Ts: 1547461917 - Running: AddMissingBuildPropertiesFromParentPlatformTxtFiles
Ts: 1547461917 - Running: ContainerBuildOptions
Ts: 1547461917 - Running: CreateBuildOptionsMap
Ts: 1547461917 - Running: LoadPreviousBuildOptionsMap
Ts: 1547461917 - Running: WipeoutBuildPathIfBuildOptionsChanged
Ts: 1547461917 - Running: StoreBuildOptionsMap
Ts: 1547461917 - Running: WarnAboutPlatformRewrites
Ts: 1547461917 - Running: RecipeByPrefixSuffixRunner
Looking for recipes like recipe.hooks.prebuild*.pattern
Ts: 1547461917 - Running: ContainerMergeCopySketchFiles
Ts: 1547461917 - Running: SketchSourceMerger
Ts: 1547461917 - Running: SketchSaver
Ts: 1547461917 - Running: AdditionalSketchFilesCopier
Ts: 1547461917 - Running: loggerAction
Ts: 1547461917 - Running: ContainerFindIncludes
Ts: 1547461917 - Running: PrintUsedAndNotUsedLibraries
Ts: 1547461917 - Running: PrintUsedLibrariesIfVerbose
Ts: 1547461917 - Running: ExportProjectCMake
Ts: 1547461917 - Running: Sizer
fork/exec /bin/avr-g++: no such file or directory
*os.PathError fork/exec /bin/avr-g++: no such file or directory
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/i18n/errors.go:19 (0x1146359)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/utils/utils.go:310 (0x1166e57)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/gcc_preproc_runner.go:63 (0x11842f0)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/container_find_includes.go:333 (0x117ed1b)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/container_find_includes.go:152 (0x117c87d)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:207 (0x117b665)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:125 (0x117abc7)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/builder.go:223 (0x117ba15)
/home/jenkins/workspace/arduino-builder-all-cross/src/github.com/arduino/arduino-builder/arduino-builder/main.go:396 (0x143bc0d)
/home/jenkins/go1.10.2-patched/src/runtime/proc.go:198 (0x102abb2)
/home/jenkins/go1.10.2-patched/src/runtime/asm_amd64.s:2361 (0x1056c11)

I'm new to this tool. Perhaps there's some additional PATH arg that I could be setting?

Cheers,
Chris