As far as I know does Andreas want to use system db for openoffice in future. He told me to report this. Now if one compiles sys-libs/db-4.x with gcc-4.x it miscompiles cni/jni code of sys-libs/db. What happens if the optimization level is higher than -O1 is that HelpLinker (Java) in helpcontent2 module segfaults because of that. The only thing to get around that is to place 'replace-flags "-O2" "-O1"' and 'replace-flags "-O3" "-O1"' before configure in src_compile. I tried to get a good backtrace but gdb did not print useful information this time but still segfaults.
(In reply to comment #0) > As far as I know does Andreas want to use system db for openoffice in future. > He told me to report this. Yep that's true, using system-db should solve some problems for us, so I'm quite interested in getting a solution for this.
Do you have any idea which of the flags enabled by -O2 causes it? Or a small testcase? Which openoffice source file fails? (Could you give me the specific gcc command?) I prefer to fix the sourcecode. Otherwise I could try to fix it.
Well, I just found these links: http://www.gatago.com/comp/databases/berkeley-db/18675477.html http://dev.sleepycat.com/resources/faq_show.html?id=113&back=%3Factio They say to replace it by -O. I can say that -O1 does just fine, too. So I prefer -O1. ;) @ Paul If you want to dig into gcc and/or db hacking you may contact sleepycat. They know about it. Sorry, I cannot be of more help here.
Created attachment 92037 [details] A testcase? From the first link. - create new Database It does not segfault here but runs forever.
Any news here, Paul? Could be cool to have a check for gcc4.x to reset the optimization level in the ebuild.
Here, after switching GCC from 3.4.6 to 4.1.1 I cannot compile db-4.3.29-r2. I get this: -- [...] /bin/sh ./libtool --mode=compile x86_64-pc-linux-gnu-g++ -c -I. -I../dist/.. -D_GNU_SOURCE -D_REENTRANT -O1 -march=opteron -pipe ../dist/../cxx/cxx_db.cpp x86_64-pc-linux-gnu-g++ -c -I. -I../dist/.. -D_GNU_SOURCE -D_REENTRANT -O1 -march=opteron -pipe ../dist/../cxx/cxx_db.cpp -fPIC -DPIC -o .libs/cxx_db.o In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/backward/iostream.h:31, from ./db_cxx.h:60, from ../dist/../cxx/cxx_db.cpp:15: /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. In file included from ../dist/../cxx/cxx_db.cpp:15: ./db_cxx.h:61:23: error: exception.h: No such file or directory -- I tried setting the optimisation level down, thus: -- $ cat /etc/portage/env/sys-libs/db CFLAGS="-O1 -march=opteron -pipe" CXXFLAGS="${CFLAGS}" -- ... but I still get the same error. Not sure what else to try.
Created attachment 99945 [details] emerge --info
Created attachment 104309 [details] db_java_wrap.c with -O2 opt. segfaults ... db_java_wrap.c with -O1 is fine. It segfaults in: Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1errcall This is the assembly code diff.bz2 between -O1 and -O2 opt. I hope it helps.
Created attachment 104321 [details, diff] -fstrict-aliasing miscompiles db_java_wrap.c
Created attachment 104352 [details] proper testcase
May be it is also good to inform upstream to update their FAQ. See: http://www.oracle.com/technology/products/berkeley-db/faq/db_faq.html#13
the fix is not necessary anymore to build OOo with system-db, still would be good to get it in /me thinks
I sent my patch upstream and Oracle included it. So upcoming releases will be fine hopefully.
berkeley db 4.6.19 has the fix → closing.