Sim_vehicle.py wont compile first time launching


#1

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 sim_vehicle.py for the first time and it fails to build. I am in the ardupilot/ArduCopter directory, and it also fails if I run “sim_vehicle.py -v Arducopter” in the Tools/autotest directory where sim_vehicle.py is.

when does this occur

running the sim_vehicle.py script fails to build the first time it gets called

pictures of the error



#2

You might want to take a look at [https://stackoverflow.com/questions/40678423/final-link-failed-nonrepresentable-section-on-output-collect2-error-ld-return]. Good luck.


#3

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 https://github.com/ArduPilot/ardupilot
  3. Now just cd into the ardupilot directory and run “git submodule update --init --recursive”
  4. Then run “Tools/environment_install/install-prereqs-ubuntu.sh -y” from the ardupilot directory.
  5. Now cd to ardupilot/ArduCopter and run “…/Tools/autoset/sim_vehicle.py -f gazebo-iris”

Hopefully this should work.

Thanks.

Jash


#4

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?


#5

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.

FYI:

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
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.


#6

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


#7

10 points @dsetin19


closed #8