tags 565801 patch
thanks

Hello,

On sekmadienis 21 Kovas 2010 13:34:43 Petr Salinger wrote:
> > I found that changing -O level is sufficient to build this package.
> > The next step should be find somehow, which ".o" file built with -O1
> > causes the trouble.
> 
>   dpkg-buildpackage -b -uc
>   wait for segfault (or hang) during
>         ../gen/firebird/bin/gbak_static -MODE read_only -R
> ../builds/misc/help.gbak ../gen/firebird/help/help.f$ make clean
>   make -C gen -f ../gen/Makefile.boot.gpre gpre_boot
>   make -C gen -f ../gen/Makefile.libfbstatic libfbstatic
> 
>   alter gen/make.platform to "-O0"
>   rm gen/firebird/lib/libfbstatic.a
>   rm temp/boot/dsql/*
>   make -C gen -f ../gen/Makefile.libfbstatic libfbstatic
>   alter gen/make.platform to "-O1" or "-O2"
> 
>   make
> 
> The problem seems be in (compilation of)
> some file from the rebuilt ones.
> 
> As this bug is going to block transitions,
> it might be usefull to use
> 
>   CFLAGS=-O0 CXXFLAGS=-O0 ./configure $(confflags) --enable-superserver
> 
> when DEB_HOST_ARCH is kfreebsd-amd64 to workaround it in mean time.

Thanks to very helpful hints from Petr, I was able to track down what atomic 
g++ flag and which object file is the problem. It appears that current 
(4.4.3-2) g++ miscompiles src/dsql/parse.cpp when -fipa-reference optimization 
flag (implied by -O1 or higher) is enabled. Therefore, my solution is to avoid 
the problem by building src/dsql/parse.cpp ( $(OBJ)/dsql/parse.o ) with -fno-
ipa-reference:

$ cat debian/patches/fix_kfreebsd_amd64_miscompile.patch 
Author: Modestas Vainius <mo...@debian.org>
Description: workaround FBTFS on kfreebsd-amd64
 The FTBFS is due to g++ (confirmed on version 4.4.3-2) miscompilation of the
 src/dsql/parse.cpp file when -fipa-reference optimization is enabled (-O1 or
 higher enables it). The patch workarounds the issue by disabling ipa-
reference
 for temp/boot/dsql/parse.o on kfreebsd-amd64.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565801
Forwarded: not-needed
Last-Update: 2010-03-27

--- a/builds/posix/prefix.freebsd_amd64
+++ b/builds/posix/prefix.freebsd_amd64
@@ -28,3 +28,6 @@ CLIENT_UTIL_TARGETS=gstat gsec fbguard f
 Physical_IO_Module=os/posix/unix.cpp
 # This is needed due to broken port of gcc
 STATIC_CXXSUPPORT_LIB = -lstdc++ -lgcc_s
+
+# Workaround g++ miscompilation bug with -fipa-reference (-O1 or higher)
+$(OBJ)/dsql/parse.o: WCXXFLAGS += -fno-ipa-reference

In addition, a couple other changes are needed in order to successfully build 
firebird2.5 on kfreebsd-amd64. My debian/changelog is below:

firebird2.5 (2.5.0.25920~ReleaseCandidate2.ds2-3.1) unstable; urgency=low
 .
   * Non-maintainer upload.
   * Workaround gcc miscompilation of src/dsql/parse.cpp on kfreebsd-amd64.
     Fixes FTBFS (Closes: #565801).
   * Mirror file builds/posix/prefix.freebsd changes in the patches
     "no-rpath.patch" and "freebsd_targets.patch" to the
     builds/posix/prefix.freebsd_amd64 file. This enables firebird to build
     successfully on kfreebsd-amd64.

firebird2.5 is a dependency of Qt 4 on kfreebsd-amd64. Since Qt 4.6.2 
transition is very likely to start sometime next week, it is very important to 
get fixed firebird2.5 to archive before Qt 4.6.2 is ready to migrate to 
testing. A full diff with all my changes is attached. If maintainer upload is 
not made in time, I will NMU firebird2.5 with these changes. I will send 
another ping to this bug a couple of days before NMUing.

-- 
Modestas Vainius <modes...@vainius.eu>
diff -Nru firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/changelog firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/changelog
--- firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/changelog	2010-03-27 00:27:52.000000000 +0000
+++ firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/changelog	2010-03-27 00:27:55.000000000 +0000
@@ -1,3 +1,15 @@
+firebird2.5 (2.5.0.25920~ReleaseCandidate2.ds2-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Workaround gcc miscompilation of src/dsql/parse.cpp on kfreebsd-amd64.
+    Fixes FTBFS (Closes: #565801).
+  * Mirror file builds/posix/prefix.freebsd changes in the patches
+    "no-rpath.patch" and "freebsd_targets.patch" to the
+    builds/posix/prefix.freebsd_amd64 file. This enables firebird to build
+    successfully on kfreebsd-amd64.
+
+ -- Modestas Vainius <mo...@asdfasdf.debian.net>  Sat, 27 Mar 2010 00:58:35 +0100
+
 firebird2.5 (2.5.0.25920~ReleaseCandidate2.ds2-3) unstable; urgency=high
 
   * *.postrm: protect db_input calls with || true as we don't want to fail when
diff -Nru firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/fix_kfreebsd_amd64_miscompile.patch firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/fix_kfreebsd_amd64_miscompile.patch
--- firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/fix_kfreebsd_amd64_miscompile.patch	1970-01-01 00:00:00.000000000 +0000
+++ firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/fix_kfreebsd_amd64_miscompile.patch	2010-03-27 00:27:55.000000000 +0000
@@ -0,0 +1,19 @@
+Author: Modestas Vainius <mo...@debian.org>
+Description: workaround FBTFS on kfreebsd-amd64
+ The FTBFS is due to g++ (confirmed on version 4.4.3-2) miscompilation of the
+ src/dsql/parse.cpp file when -fipa-reference optimization is enabled (-O1 or
+ higher enables it). The patch workarounds the issue by disabling ipa-reference
+ for temp/boot/dsql/parse.o on kfreebsd-amd64.
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565801
+Forwarded: not-needed
+Last-Update: 2010-03-27
+
+--- a/builds/posix/prefix.freebsd_amd64
++++ b/builds/posix/prefix.freebsd_amd64
+@@ -28,3 +28,6 @@ CLIENT_UTIL_TARGETS=gstat gsec fbguard f
+ Physical_IO_Module=os/posix/unix.cpp
+ # This is needed due to broken port of gcc
+ STATIC_CXXSUPPORT_LIB = -lstdc++ -lgcc_s
++
++# Workaround g++ miscompilation bug with -fipa-reference (-O1 or higher)
++$(OBJ)/dsql/parse.o: WCXXFLAGS += -fno-ipa-reference
diff -Nru firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/freebsd_targets.patch firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/freebsd_targets.patch
--- firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/freebsd_targets.patch	2010-03-27 00:27:52.000000000 +0000
+++ firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/freebsd_targets.patch	2010-03-27 00:27:55.000000000 +0000
@@ -13,3 +13,16 @@
 +CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr fbtracemgr
  
  Physical_IO_Module=os/posix/unix.cpp
+--- a/builds/posix/prefix.freebsd_amd64
++++ b/builds/posix/prefix.freebsd_amd64
+@@ -22,8 +22,8 @@ OS_ServerFiles=inet_server.cpp
+ 
+ PROD_FLAGS=-O -fno-builtin -DFREEBSD -DAMD64 -pipe -MMD -fPIC
+ DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor
+-EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print
+-CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
++EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print fbsvcmgr fbtracemgr
++CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print fbsvcmgr fbtracemgr
+ 
+ Physical_IO_Module=os/posix/unix.cpp
+ # This is needed due to broken port of gcc
diff -Nru firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/no-rpath.patch firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/no-rpath.patch
--- firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/no-rpath.patch	2010-03-27 00:27:52.000000000 +0000
+++ firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/no-rpath.patch	2010-03-27 00:27:55.000000000 +0000
@@ -24,3 +24,14 @@
  PROD_FLAGS=-O -fno-builtin -DNDEBUG -DFREEBSD -pipe -MMD -fPIC
  DEV_FLAGS=-ggdb -DFREEBSD -pipe -MMD -p -fPIC -Wall
  EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print
+--- a/builds/posix/prefix.freebsd_amd64
++++ b/builds/posix/prefix.freebsd_amd64
+@@ -20,8 +20,6 @@
+ 
+ OS_ServerFiles=inet_server.cpp
+ 
+-LINK_OPTS+=-Wl,-rpath,../gen/firebird/lib
+-
+ PROD_FLAGS=-O -fno-builtin -DFREEBSD -DAMD64 -pipe -MMD -fPIC
+ DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor
+ EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print
diff -Nru firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/series firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/series
--- firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/series	2010-03-27 00:27:52.000000000 +0000
+++ firebird2.5-2.5.0.25920~ReleaseCandidate2.ds2/debian/patches/series	2010-03-27 00:27:55.000000000 +0000
@@ -17,3 +17,4 @@
 freebsd_targets.patch
 atomic_ops_require_cas.patch
 link_atomic_ops.patch
+fix_kfreebsd_amd64_miscompile.patch

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to