Problem with build/compile instructions (in Ubuntu)

what if you logout and login again? we write to .profile which is only read when logging in

I believe there are not just ā€œoneā€ and ā€œanotherā€ things. There are three things instead:

  1. Distro. IMHO it should not rely on any special configuration of distro, say additional repos and keys. It needs to be able support installation on a brand new OS.
  2. Toolchain. The toolchain installation script should not just install tools, instead it should take care on all distro/os config changes needed for toolchain installation. Thatā€™s the place to call software-properties-common and add-apt-repository
  3. Build process. It should be just documented and to use tools that are ready to use since Toolchain installation script is done.

IMHO.

@lucasdemarchi EUREKA ! thanks to your last comment (log out&in) , I have suceeded ! Here is the ultimate build/compile instruction list. ā€œSudo apt-get updateā€ is a prerequiste for
"sudo apt-get install software-properties-common" in my case.

BUILD INSTRUCTION LIST :

sudo apt-get update
sudo apt-get install software-properties-common
add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
sudo apt-get -qq -y install git
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule init
git submodule update
Tools/scripts/install-prereqs-ubuntu.sh -y
sudo apt-get install cmake
. ~/.profile
#LOG OUT AND LOG BACK IN
./waf configure --board px4-v2
./waf copter

the final message is :
ā€˜copterā€™ finished successfully (13m54.142s)

but now where does it put the .px4 file ( I feel really silly here) ? lol donā€™t worry I am not new to programming,

It is written there where the files are, but look in the build folder.

May I put a final touch on it? Just few corrections:

  1. donā€™t use -qq for apt-get in case you would like to see what is going on

  2. you have missed git checkout Copter-3.4 before submodules and waf. Also it may affect Tools/scripts/install-prereqs-ubuntu.sh

  3. it is useful to use git submodule sync --recursive

  4. it worth to use git submodule update --init --recursive command instead of two separate commands

  5. IMHO waf should take care by itself on submodules

  6. no logout neede in case of sourcing .profile

    sudo apt-get update
    sudo apt-get -y install software-properties-common
    add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
    sudo apt-get -y install git
    git clone https://github.com/ArduPilot/ardupilot.git
    cd ardupilot
    git checkout Copter-3.4

    I commented out submodule commands below, because waf should perform it for us.

    In case you need to perform them manually I recommend to use a them as following:

    git submodule sync --recursive

    git submodule update --init --recursive

    Tools/scripts/install-prereqs-ubuntu.sh -y
    sudo apt-get install cmake
    source ~/.profile

    Due to sourcing .profile you donā€™t need to re-login

    ./waf configure --board px4-v2
    ./waf copter

This way you can find it:
find . -type f -name '*.px4'

1 Like

@dipspb @fnoop @lucasdemarchi
I just contributed $50 USD to Ardupilot. Was I cheap for such a precious result ?

@dipspb proposes enhancements to @fnoop & @lucasdemarchi contribution.
However, until @fnoop and @lucasdemarchi agree,
their answer compiled into mine will remain this topicā€™s solution, and I will keep @dipspb enhancement for future reference in case I come accross a new problem.

Not at all. Thanks very much for your contribution. I hope next release it goes more smoothly for you.

I agree. The problem is that sometimes we lose some of these dependencies due to developers moving to newer versions of the distro or differences between variants of the distro itself (i.e. Desktop vs cloud/server).
I agree we should fix it, so it works for people.

Yep, I think itā€™s very similar to the suggestions on the issue in our wiki (Update build instructions Ā· Issue #565 Ā· ArduPilot/ardupilot_wiki Ā· GitHub), right?

@maxmay - itā€™s not necessary to pay anything - the community is very happy to help you get started for free. But such a generous donation will be really appreciated by the developers, and therefore the community. Thanks :slight_smile:

@dipspb - you have some great points and improvements, hope you get involved and submit a PR.

Hi,lucasdemarchi
I am trying to build apm for pxhawk on ubuntu 14.04 ,and i met the same problem as maxmay . and i follow his BUILD INSTRUCTION LIST below:

   sudo apt-get update
   sudo apt-get install software-properties-common
   add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
   sudo apt-get -qq -y install git
   git clone https://github.com/ArduPilot/ardupilot.git
   cd ardupilot
   git submodule init
   git submodule update
   Tools/scripts/install-prereqs-ubuntu.sh -y
   sudo apt-get install cmake
   . ~/.profile

   LOG OUT AND LOG BACK IN

   ./waf configure --board px4-v2
   ./waf copte

still i got stuck here:

wei@wei:~/ardupilot$ ./waf copter
Waf: Entering directory `/home/wei/ardupilot/build/px4-v2'
[ 7/14] Processing modules/mavlink/message_definitions/v1.0/ardupilotmega.xml
Traceback (most recent call last):
  File "/home/wei/ardupilot/modules/mavlink/pymavlink/tools/mavgen.py", line 16, in <module>
    from pymavlink.generator import mavgen
  File "/home/wei/ardupilot/modules/mavlink/pymavlink/generator/mavgen.py", line 12, in <module>
    from future import standard_library
ImportError: No module named future

mavgen returned 1 error code
Waf: Leaving directory `/home/wei/ardupilot/build/px4-v2'
Build failed
 -> task in 'mavlink' failed (exit status 1): 
	{task 3067203788L: mavgen ardupilotmega.xml -> }
''

I am completely newer with ubuntu and ardupilot , these quesion has puzzled me a long time . Is there any solution for this ?

sudo pip install -U future lxml
sudo pip install -U pymavlink

And done !
(The error is marked ! ā€œImportError: No module named futureā€ )

okay ļ¼Œ i try it right now

OK ! I see the error in install script, I will correct it ! Thanks for reporting this !

when i tried ,it stucked

wei@wei:~/ardupilot$ sudo pip install -U future lxml
[sudo] password for wei: 
Sorry, try again.
[sudo] password for wei: 
Sorry, try again.
[sudo] password for wei: 
sudo: pip: command not found
wei@wei:~/ardupilot$ sudo pip install -U future lxml
sudo: pip: command not found
wei@wei:~/ardupilot$

i tried both your command ,and get

sudo: pip: command not found

whatā€™s the problem?

you donā€™t have pip installedā€¦
Wait a little I looking at install scriptā€¦ It should have install everything.

any error when using Tools/scripts/install-prereqs-ubuntu.sh ?

YES,there is always an error ,iā€™d like to show you right now:

wei@wei:~/ardupilot$ Tools/scripts/install-prereqs-ubuntu.sh -y
+ OPT=/opt
+ BASE_PKGS='build-essential ccache g++ gawk git make wget'
+ PYTHON_PKGS='future lxml pymavlink MAVProxy'
+ PX4_PKGS='python-argparse openocd flex bison libncurses5-dev           autoconf texinfo libftdi-dev zlib1g-dev           zip genromfs python-empy libc6-i386 cmake cmake-data'
+ ARM_LINUX_PKGS='g++-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf'
+ SITL_PKGS='libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing realpath'
+ ASSUME_YES=false
+ UBUNTU_YEAR=15
+ UBUNTU_MONTH=10
++ lsb_release -r -s
+ version=14.04
++ echo 14.04
++ cut -d. -f1
+ yrelease=14
++ echo 14.04
++ cut -d. -f2
+ mrelease=04
+ '[' 14 -ge 15 ']'
+ ARM_ROOT=gcc-arm-none-eabi-4_9-2015q3
+ ARM_TARBALL=gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
+ ARM_TARBALL_URL=http://firmware.ardupilot.org/Tools/PX4-tools/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
+ ARDUPILOT_TOOLS=Tools/autotest
+ OPTIND=1
+ getopts y opt
+ case "$opt" in
+ ASSUME_YES=true
+ getopts y opt
+ true
+ APT_GET='sudo apt-get -qq --assume-yes'
+ read -r UBUNTU_CODENAME
++ lsb_release -c -s
+ '[' trusty = precise ']'
+ '[' trusty = trusty ']'
+ sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
gpg: keyring `/tmp/tmpcqvvw4rf/secring.gpg' created
gpg: keyring `/tmp/tmpcqvvw4rf/pubring.gpg' created
gpg: requesting key 828AB726 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpcqvvw4rf/trustdb.gpg: trustdb created
gpg: key 828AB726: public key "Launchpad George Edison's PPA" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
+ sudo usermod -a -G dialout wei
+ sudo apt-get -qq --assume-yes remove modemmanager
+ sudo apt-get -qq --assume-yes update
+ sudo apt-get -qq --assume-yes install build-essential ccache g++ gawk git make wget libtool libxml2-dev libxslt1-dev python-dev python-pip python-setuptools python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing realpath python-argparse openocd flex bison libncurses5-dev autoconf texinfo libftdi-dev zlib1g-dev zip genromfs python-empy libc6-i386 cmake cmake-data g++-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf
E: Package 'libc6-i386' has no installation candidate

and i think the error of ā€œE: Package ā€˜libc6-i386ā€™ has no installation candidateā€ cause the script end itself ,and the rest script are not going to run. the first time i met the message ,I tried to ignore it ,but when i do the rest instuctions. I find more problem came out and thus i canā€™t go any further.
I also have tried to reinstall my ubuntu ,and do the INSTRUCTIONS again ,and still canā€™t solve the probem. This compile instructions have totally cost five days.