Googleearth panaramio fix

Introduction

Since version 7.x of GoogleEarth the panoramio function has been broken. This is not Funtoo specific, all Linux distributions suffer from it. It is caused by the bundled qt-libs. This can be repaired by forcing GoogleEarth to use the native Funtoo qt-libraries.

Prerequisites

You need the following up to date packages installed on your system:

  • media-libs/freeimage
  • dev-qt/qtcore
  • dev-qt/qtgui
  • dev-qt/qtwebkit

Procedure

1.  If not already installed, install GoogleEarth:


echo "=sci-geosciences/googleearth-7.(current version)">>/etc/portage/package.unmask
echo "=sci-geosciences/googleearth-7.(current version)">>/etc/portage/package.accept_keywords
echo ">=sci-geosciences/googleearth-7.(current version) googleearth">>/etc/portage/package.license
emerge -av sci-geosciences/googleearth


2.  In GoogleEarth's running directory /opt/googleearth, remove the 4 original libQt* libraries and save them in a new directory:


cd /opt/googleearth
mkdir bundled-qtlib
mv libQt* bundled-qtlib/


3.  If you invoke googleearth now, you will get the known error:
    ./googleearth-bin: symbol lookup error: ./libbase.so: undefined symbol: _Z34QBasicAtomicInt_fetchAndAddOrderedPVii
    The missing function can be generated by creating a file in /opt/googleearth (call it baifaao.cpp) with this content:


/* /opt/googleearth/baifaao.cpp */
#include <QtCore/QAtomicInt>
extern "C" {
	int _Z34QBasicAtomicInt_fetchAndAddOrderedPVii(QAtomicInt* a, int b) {
		return a->fetchAndAddOrdered(b);
	}
}


4.  Compile it and create the shim library with the following command line:


gcc -I/usr/include/qt4 -O3 -fPIC --shared baifaao.cpp -o baifaao.so


5.  In the file googleearth (in the directory /opt/googleearth), add the following line, e.g. before the line starting with LD_LIBRARY_PATH:


export LD_PRELOAD=/usr/lib64/libfreeimage.so.3:/opt/googleearth/baifaao.so


x86 32 bit users should use:


export LD_PRELOAD=/usr/lib/libfreeimage.so.3:/opt/googleearth/baifaao.so


6.  If the locale bug in the QT libs is not patched it may cause a major coordinate shift if the locale is not en_US.UTF-8. 
    If it is still present with your locale, add also:


export LC_NUMERIC=en_US.UTF-8


7.  At least at this location, panoramio and much of GoogleEarth works only with qtgraphicssystem=native.  
    There are a few ways to do this.  One is to permanently choose it:


eselect qtgraphicssystem set native


Or if you choose to primarily run another setting with qtgraphicssystem you can use the following approach:


cp /usr/share/applications/google-earth.desktop /home/<username>/.local/share/applications
cd /home/<username>/.local/share/applications
chown <username>: google-earth.desktop


Now edit google-earth.desktop with your favorite editor, changing the line beginning with "Exec" as follows:


# old line:
#Exec=/opt/googleearth/googleearth %f
# new line:
Exec=env QT_GRAPHICSSYSTEM=native /opt/googleearth/googleearth %f


Or I find this works well on nvidia:


Exec=env XLIB_SKIP_ARGB_VISUALS=1 QT_GRAPHICSSYSTEM=native /opt/googleearth/googleearth %f


Whew! Take a breather and enjoy some of those photos from exotic locales :)


   Much of the content of this page is a derivative of comments on a Gentoo bug on this specific subject.
   It can be found at: https://bugs.gentoo.org/show_bug.cgi?id=490066