wont compile first time launching


Description of the problem

Not using the virtual machine with the preinstalled environment, but running ubuntu 18. I followed the course tutorial up to the point of running for the first time and it fails to build. I am in the ardupilot/ArduCopter directory, and it also fails if I run “ -v Arducopter” in the Tools/autotest directory where is.

when does this occur

running the script fails to build the first time it gets called

pictures of the error


You might want to take a look at []. Good luck.


Hi, I use Ubuntu 18 and all you need to do is:

  1. Uninstall Ardupilot once (delete the repo)
  2. Go to the directory you want to install (on your terminal) and “git clone
  3. Now just cd into the ardupilot directory and run “git submodule update --init --recursive”
  4. Then run “Tools/environment_install/ -y” from the ardupilot directory.
  5. Now cd to ardupilot/ArduCopter and run “…/Tools/autoset/ -f gazebo-iris”

Hopefully this should work.




Thanks for the help! I am not sure what I am looking at in the link, though. Is the issue I am using g++ 4.8.5 and should be using g++ 4.9.2?


I referenced this link because it addresses the same error you are getting:

  final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status

I don’t know if your problem is due to the g++ version you are using, but there have been cases where installing a different version of some software has, for some reason, resolved the issue. The post “Cannot set mode in MAVProxy”, while lengthy, may illustrate what I am talking about.


From my desktop:

    david@hp-office:~$ g++ --version
    g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO

Here is a snippet from my System Information report:

    System:    Host: hp-office Kernel: 5.4.0-74-generic x86_64 bits: 64 compiler: gcc v: 7.5.0 
               Desktop: Cinnamon 4.4.8 wm: muffin dm: LightDM Distro: Linux Mint 19.3 Tricia 
               base: Ubuntu 18.04 bionic 

The latest version of g++ is 11.

I realize that “try this, try that, etc.” to resolve a problem is not very satisfying. However, often problems are caused by version incommpatabilites.

Hope that this is of some help.


The compiler was the issue. I had to remove gcc and g++ and reinstall them and it worked with g++ 7


10 points @dsetin19

closed #8