Problem Compiling on Raspberry Pi 2

So I followed the directions in the README and the instructions at link but I cannot get APM PLanner 2 to complete the build. It always fails. What could I be doing incorrectly? I know it is a Noob issue… just need some guidance.

THanks!

Can you post the output of the compiler? Much easier to help then.

WIll try to do tonight. THanks

Try:
qmake “CONFIG+=RaspberryPiBuild” qgroundcontrol.pro

So here are the final outputs of compiling with the above command:

 glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
                                                                                          ^

src/ui/CameraView.cc: In member function ‘virtual void CameraView::resizeGL(int, int)’:
src/ui/CameraView.cc:246:18: error: ‘GL_PROJECTION’ was not declared in this scope
glMatrixMode(GL_PROJECTION);
^
src/ui/CameraView.cc:246:31: error: ‘glMatrixMode’ was not declared in this scope
glMatrixMode(GL_PROJECTION);
^
src/ui/CameraView.cc:247:20: error: ‘glLoadIdentity’ was not declared in this scope
glLoadIdentity();
^
src/ui/CameraView.cc:248:30: error: ‘glOrtho’ was not declared in this scope
glOrtho(0, w, 0, h, -1, 1);
^
src/ui/CameraView.cc:249:18: error: ‘GL_MODELVIEW’ was not declared in this scope
glMatrixMode(GL_MODELVIEW);
^
Makefile:31349: recipe for target ‘build-release/obj/CameraView.o’ failed
make: *** [build-release/obj/CameraView.o] Error 1

Ok, try:
qmake “CONFIG-=CAMERAVIEW” qgroundcontrol.pro

If that doesn’t work, then remove the following 6 lines from qgroundcontrol.pro:
#ifdef CAMERAVIEW
src/ui/CameraView.h
#endif
#ifdef CAMERAVIEW
src/ui/CameraView.cc
#endif

Dave

After removing the 6 lines you specified and re-compiling I got A LOT Farther before it finally failed with the following output:

/usr/lib/libGLESv2.so: undefined reference to khrn_pointer_map_delete' /usr/lib/libGLESv2.so: undefined reference torpc_send_ctrl_write’
/usr/lib/libGLESv2.so: undefined reference to rpc_recv' /usr/lib/libGLESv2.so: undefined reference tokhrn_platform_malloc’
/usr/lib/libGLESv2.so: undefined reference to rpc_flush' /usr/lib/libGLESv2.so: undefined reference torpc_begin’
/usr/lib/libGLESv2.so: undefined reference to platform_memcpy' /usr/lib/libGLESv2.so: undefined reference torpc_send_bulk’
/usr/lib/libGLESv2.so: undefined reference to khrn_error_assist' /usr/lib/libGLESv2.so: undefined reference torpc_send_ctrl_end’
/usr/lib/libGLESv2.so: undefined reference to client_tls' /usr/lib/libGLESv2.so: undefined reference toplatform_tls_get’
/usr/lib/libGLESv2.so: undefined reference to khrn_pointer_map_iterate' /usr/lib/libGLESv2.so: undefined reference torpc_end’
/usr/lib/libGLESv2.so: undefined reference to khrn_get_type_size' /usr/lib/libGLESv2.so: undefined reference torpc_send_ctrl_begin’
/usr/lib/libGLESv2.so: undefined reference to khrn_platform_free' /usr/lib/libGLESv2.so: undefined reference tokhrn_pointer_map_insert’
/usr/lib/libGLESv2.so: undefined reference to khrn_pointer_map_lookup' /usr/lib/libGLESv2.so: undefined reference tokhrn_pointer_map_term’
/usr/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_init’
collect2: error: ld returned 1 exit status
Makefile:1737: recipe for target ‘release/apmplanner2’ failed
make: *** [release/apmplanner2] Error 1
root@jf-RPi2:/home/jf/apm_planner#

You forgot to do this:
sudo mv /usr/lib/libGLESv2.so /usr/lib/libGLESv2.so.bak

Dave

COMPLETED!!! Launched it successfully. Said current user does not have permissions and to run a command… do you know what that command is?

It depends, I’m guessing your user does not have dialout access:
sudo adduser dave dialout
for example.

Dave

sweet! Thanks and thank you for your patience in helping me through this… I am VERY rusty with all things linux. Really appreciate it.

And sudo apt-get remove modemmanager

Hi all,

I successfully compiled the software after disabling the CAMERAVIEW feature and moving the libGLESv2.so on a Raspberry Pi 2 with Ubuntu Mate 15.04.
But when I try to run the software by ./apmplanner2 it seems to crash with an openGL related error message.

[code]. bashrc : running gcs
bash: gcs: No such file or directory
benny@benny-raspi:~$ cd Schreibtisch/apm_planner/release/
benny@benny-raspi:~/Schreibtisch/apm_planner/release$ ./apmplanner2
libEGL warning: DRI2: failed to create any config
QXcbConnection: Failed to initialize XRandr
Qt: XKEYBOARD extension not present on the X server.
/usr/share/themes/Yuyo-Dark/gtk-2.0/Apps/libreoffice.rc:40: Unable to locate image file in pixmap_path: “Entry/entry-border-bg-solid.png”
/usr/share/themes/Yuyo-Dark/gtk-2.0/Apps/libreoffice.rc:43: Background image options specified without filename
/usr/share/themes/Yuyo-Dark/gtk-2.0/Apps/libreoffice.rc:49: Unable to locate image file in pixmap_path: “Entry/entry-border-active-bg-solid.png”
/usr/share/themes/Yuyo-Dark/gtk-2.0/Apps/libreoffice.rc:52: Background image options specified without filename
INFO 2015-07-27T11:06:55.541 QGCCore::initialize()
INFO 2015-07-27T11:06:55.544 Current Build Info
INFO 2015-07-27T11:06:55.545 Git Hash: 51b6aa9218a0042744c31a7ea6f03752e5c9baa9
INFO 2015-07-27T11:06:55.546 Git Commit: 2.0.18
INFO 2015-07-27T11:06:55.546 APPLICATION_NAME: "APM Planner"
INFO 2015-07-27T11:06:55.547 APPLICATION_VERSION: "v2.0.18"
INFO 2015-07-27T11:06:55.548 APP_PLATFORM: ubuntu32
INFO 2015-07-27T11:06:55.548 APP_TYPE: stable
Unsupported screen format: depth: 24, red_mask: ff, blue_mask: ff0000
Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.
Unsupported screen format: depth: 24, red_mask: ff, blue_mask: ff0000
Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Unsupported screen format: depth: 24, red_mask: ff, blue_mask: ff0000
Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.
INFO 2015-07-27T11:06:56.305 Start Link Manager
DEBUG 2015-07-27T11:06:56.332 Create MAVLinkDecoder: MAVLinkDecoder(0x6fcef008)
INFO 2015-07-27T11:06:56.372 Start UAS Manager
DEBUG 2015-07-27T11:06:56.780 Creating MainWindow
INFO 2015-07-27T11:06:57.656 Creating SubMainWindow: SubMainWindow(0x26fe1a8)
INFO 2015-07-27T11:06:57.657 setting objectName: "VIEW_MISSION"
INFO 2015-07-27T11:06:58.040 Creating SubMainWindow: SubMainWindow(0x275b718)
INFO 2015-07-27T11:06:58.041 setting objectName: "VIEW_FLIGHT"
INFO 2015-07-27T11:06:58.303 Creating SubMainWindow: SubMainWindow(0x2796c68)
INFO 2015-07-27T11:06:58.304 setting objectName: "VIEW_HARDWARE_CONFIG"
DEBUG 2015-07-27T11:07:00.823 fillPortsInfo
INFO 2015-07-27T11:07:00.855 Inserting "ttyAMA0"
INFO 2015-07-27T11:07:00.856 Changed Link to: "ttyAMA0"
INFO 2015-07-27T11:07:03.450 Creating SubMainWindow: SubMainWindow(0x28a1a60)
INFO 2015-07-27T11:07:03.451 setting objectName: "VIEW_SOFTWARE_CONFIG"
DEBUG 2015-07-27T11:07:03.679 Disable Controls
INFO 2015-07-27T11:07:05.339 Creating SubMainWindow: SubMainWindow(0x310a3b0)
INFO 2015-07-27T11:07:05.340 setting objectName: "VIEW_ENGINEER"
QObject::connect: No such signal QTableView::currentCellChanged(int,int,int,int)
QObject::connect: (sender name: ‘tableWidget’)
QObject::connect: (receiver name: ‘AP2DataPlot2D’)
INFO 2015-07-27T11:07:05.745 Creating SubMainWindow: SubMainWindow(0x3298be0)
INFO 2015-07-27T11:07:05.753 setting objectName: "VIEW_SIMULATOR"
DEBUG 2015-07-27T11:07:06.156 MODE: 0
DEBUG 2015-07-27T11:07:06.162 "D|PREFLIGHT"
DEBUG 2015-07-27T11:07:06.165 MODE: 80
DEBUG 2015-07-27T11:07:06.168 "D|STABILIZED"
DEBUG 2015-07-27T11:07:06.173 MODE: 64
DEBUG 2015-07-27T11:07:06.176 "D|MANUAL"
DEBUG 2015-07-27T11:07:06.179 MODE: 88
DEBUG 2015-07-27T11:07:06.181 "D|VECTOR|STABILIZED"
DEBUG 2015-07-27T11:07:06.184 MODE: 92
DEBUG 2015-07-27T11:07:06.187 "D|AUTO|STABILIZED"
DEBUG 2015-07-27T11:07:06.191 MODE: 66
DEBUG 2015-07-27T11:07:06.193 "D|TEST"
DEBUG 2015-07-27T11:07:07.026 QUrl( “file:///home/benny/Schreibtisch/apm_planner/release/qml/PrimaryFlightDisplayQML.qml” )
DEBUG 2015-07-27T11:07:08.576 QML Status: 1
DEBUG 2015-07-27T11:07:08.597 QUrl( “file:///home/benny/Schreibtisch/apm_planner/release/qml/PrimaryFlightDisplayQML.qml” )
DEBUG 2015-07-27T11:07:09.095 QML Status: 1
INFO 2015-07-27T11:07:09.170 UASActionsWidget creating UASActionsWidget(0x368e298)
DEBUG 2015-07-27T11:07:09.216 QuickView: load settings
DEBUG 2015-07-27T11:07:09.221 QuickView: loading key: “GCS Status.Altitude (GPS) (m)” type: "text"
DEBUG 2015-07-27T11:07:09.307 QuickView: loading key: “GCS Status.Altitude (REL) (m)” type: "text"
DEBUG 2015-07-27T11:07:09.328 QuickView: loading key: “GCS Status.Battery (%)” type: "text"
DEBUG 2015-07-27T11:07:09.353 QuickView: loading key: “GCS Status.Climb (m/s)” type: "text"
DEBUG 2015-07-27T11:07:09.381 QuickView: loading key: “GCS Status.Current (A)” type: "text"
DEBUG 2015-07-27T11:07:09.414 QuickView: loading key: “GCS Status.GPS Fix ()” type: "text"
DEBUG 2015-07-27T11:07:09.444 QuickView: loading key: “GCS Status.GPS HDOP (m)” type: "text"
DEBUG 2015-07-27T11:07:09.483 QuickView: loading key: “GCS Status.GPS Sats ()” type: "text"
DEBUG 2015-07-27T11:07:09.527 QuickView: loading key: “GCS Status.Pitch (deg)” type: "text"
DEBUG 2015-07-27T11:07:09.568 QuickView: loading key: “GCS Status.Roll (deg)” type: "text"
DEBUG 2015-07-27T11:07:09.608 QuickView: loading key: “GCS Status.Voltage (V)” type: "text"
DEBUG 2015-07-27T11:07:09.665 QuickView: loading key: “GCS Status.Yaw (deg)” type: "text"
DEBUG 2015-07-27T11:07:09.767 QuickView: load settings END
INFO 2015-07-27T11:07:10.423 Using Alsa Audio driver
WARN 2015-07-27T11:07:10.427 Dir directory tmp_audio exists
DEBUG 2015-07-27T11:07:10.537 qmlBaseDir "/home/benny/Schreibtisch/apm_planner/release"
DEBUG 2015-07-27T11:07:10.543 QUrl( “file:///home/benny/Schreibtisch/apm_planner/release/qml/ApmToolBar.qml” )
qml: APMToolBar: button label SELECTED
DEBUG 2015-07-27T11:07:10.914 QML Status: 1
INFO 2015-07-27T11:07:10.987 Screen Size is QRect(0,0 1364x768)
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Unsupported screen format: depth: 24, red_mask: ff, blue_mask: ff0000
Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL
Aborted (core dumped)
benny@benny-raspi:~/Schreibtisch/apm_planner/release$

[/code]

Does anyone have an idea what the reason might be?

Thanks,
Ben

I’m guessing moving the libglesv2 lib is not the fix, as the Qt libs maybe dependent upon it. The camera view was removed as it was OpenGL code which is not OpenGLES compatible. The ‘fix’ here was to probably force a ‘downgrade’ to get Qt library to use OpenGLES1.0.

Anyway 15.04 Qt version you are using needs the OpenGLES2.0 lib so removing it will cause it to fail. I’m not sure what the fix is. What Qt version are you building against?

benny@benny-raspi:~$ qmake -v
QMake version 3.0
Using Qt version 5.4.1 in /usr/lib/arm-linux-gnueabihf

Thought I would use the most recent version at best?!

Hmm…interesting.

Try adding “framebuffer_depth=32” to /boot/config.txt.

It is working now!! :smiley:

I’m a bit confused though what did the trick. I had the framebuffer_depth=32 already set from some previous tutorial. Tried to disable it, same error. Then I enabled it again, same error. Tried to start the planner as root just to give it a try and -tadaa- it works. Now it even starts when I run it without root privileges.

Thank you two for your help!!

I put an unofficial Linux build on sourceforge for those that cannot/do not want to build APM Planner 2 themselves. It can be found here, sourceforge.net/projects/apmplanner2. I’m working with Bill to get an official build for ARMv7 devices (like the Pi 2)–the ball is in my court.

I’ll post the binary up in the location with the others. We can work on the real time builds in the meantime

Excellent! Thank you sir.