& Linux: use Arduino compiler/linker/etc. vs separately installed avr-gcc?

I noticed that when building ardupilot-mega, there are some differences in what AVR tools (compiler, linker, etc.) are used depending on which platform you're on:

Under OS X and Windows, it uses the tools that are packaged with the Ardunio software.  In Linux, it looks for separately installed avr-gcc, avr-g++, avr-gdb etc.

Since even in Linux you need to have Arduino installed anyway, and since the other platforms use the Arduino versions of the tools, is there any reason to do something different in Linux?  It seems that doing the same thing in Linux that ardupilot-mega does on other platforms would mean one less step is required before building the software--you no longer have to install avr-gcc, etc.  And removing unnecessary steps in build processes is always good.

Can any devs comment?  it looks like Amilcar Lucas and DrZipLok were the last people to change this section of the makefile, most recently in October 2010.  The diff is small:

[wiseman@wiseman-vbox ArduCopter (use_arduino_tools_on_linux)]$ git diff
diff --git a/libraries/AP_Common/ b/libraries/AP_Common/
index 381125f..8b0e136 100644
--- a/libraries/AP_Common/
+++ b/libraries/AP_Common/
@@ -194,8 +194,8 @@ ifeq ($(SYSTYPE),Darwin)
AWK = awk
ifeq ($(SYSTYPE),Linux)
- # expect that tools are on the path
- TOOLPATH := $(subst :, ,$(PATH))
+ # use the tools that come with Arduino
+ TOOLPATH := $(ARDUINO)/hardware/tools/avr/bin
ifeq ($(findstring CYGWIN, $(SYSTYPE)),CYGWIN)
TOOLPATH := $(ARDUINO)/hardware/tools/avr/bin
@@ -216,7 +216,7 @@ AVRDUDE := $(call FIND_TOOL,avrdude)
AVARICE := $(call FIND_TOOL,avarice)
OBJCOPY := $(call FIND_TOOL,avr-objcopy)
ifeq ($(CXX),)
-$(error ERROR: cannot find the compiler tools anywhere on the path $(TOOLPATH))
+$(error ERROR: cannot find the Arduino compiler tools, please set ARDUINO=<path to arduino installation>)

# Find awk

Views: 507

Reply to This

Replies to This Discussion

Here's a link to the modified file in my fork (repository: jjwiseman-ardupilot-mega-fork, branch: use_arduino_tools_on_linux):

Reply to Discussion


© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service