Apache OpenOffice (AOO) Bugzilla – Issue 125475
Build error while compiling the component svx
Last modified: 2015-09-05 05:57:19 UTC
while compiling svx, i got an error like this /media/amali/source/aoo-trunk/main/solver/420/unxlngx6.pro/workdir/CxxObject/svx/source/fmcomp/fmgridif.o: In function `FmXGridControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&)': fmgridif.cxx:(.text+0x68b2): undefined reference to `non-virtual thunk to WindowListenerMultiplexer::acquire()' /usr/bin/ld: /media/amali/source/aoo-trunk/main/solver/420/unxlngx6.pro/workdir/CxxObject/svx/source/fmcomp/fmgridif.o: relocation R_X86_64_PC32 against undefined symbol `_ZThn48_N25WindowListenerMultiplexer7acquireEv' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Though g++ compiles with -fPIC, i'm getting this error. I searched the web and found out this is a problem for LibreOffice product, too. I couldn't find where this WindowListenerMultiplexer class is implemented and so i can find the definition of this function. I think it is some kind of old code??
I get this error because of buggy g++4.9. I built using g++4.8 and didn't get any error again.
Built the source using g++4.8 and didn't get this error after that; so for now, I'm going to use g++4.8 to make the build in Ubuntu Linux14.04.
Yes, this seems to be caused by the GCC4.9 bug "devirtualization too trigger happy" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678), so this not an AOO problem. Setting the status to NOT_AN_AOO_ISSUE:
Closing the resolved issue.
Created attachment 84310 [details] Hack to work around The attached patch allows to build on latest Fedora 21 with g++ (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
Ariel, do you believe it makes sense to include this patch/workaround in 4.1.2? In general we want that it is possible to build OpenOffice both on our (old) baseline and on the most recent versions of major distributions.
*** Issue 126257 has been marked as a duplicate of this issue. ***
Created attachment 84898 [details] another workaround that works by disabling optimization of the two affected files I ran into this problem when working on the FreeBSD port. I did some searching for a solution and saw that the LibreOffice folks were proposing a solution similar to the patch in attachment 84310 [details]. I tried it, but didn't have good luck. I think it fixed the problem on x86_64, but not intel. There are two files that trigger the bug when compiled with gcc 4.9 and -Os optimization. On FreeBSD (and I believe Linux as well), only one of them is compiled with -Os on x86_64, and both are compiled with -Os on intel. Trying to force the compiler to export these symbols also seems to be the wrong approach since these symbols are for inline class methods, so they should be private to the object file. My initial fix in the FreeBSD port was to patch solenv/inc/unxfbsdi.mk and solenv/gbuild/platform/freebsd.mk on the fly when gcc 4.9 was detected, replacing "-Os" with "-O0". I also filed this gcc bug report: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009>. More recently, I modified the FreeBSD port to re-enable most optimization by replacing "-Os" with "-Os -fno-devirtualize -fno-devirtualize-speculatively". Another possibility is to disable optimization only on the two files that are affected by this gcc bug, which I implemented in the attached patch. With it I was able to get clean builds with gcc 4.9 on both intel and x86_64. The last time I tried, the bug was still present in the latest gcc 4.9, but a comment in gcc bug report says that it is fixed in the trunk version of gcc (5?).
This problem is not caused by the GCC4.9 bug "devirtualization too trigger happy" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678). A fix for that bug was committed to the gcc 4.9 branch on September 11, 2014. I submitted a copy of the OpenOffice code that triggers the gcc bug as an attachment to <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009>. A gcc developer confirmed that it still failed on the gcc 4.9 on February 11, 2015 (before the release of gcc 4.9.3). I am able to still reproduce this build failure with this recent snapshot of gcc 4.9.4: % gcc49 --version gcc49 (FreeBSD Ports Collection) 4.9.4 20150819 (prerelease)