Message ID | 20140804202907.GA2608@host2.jankratochvil.net |
---|---|
State | New, archived |
Headers |
Received: (qmail 12108 invoked by alias); 4 Aug 2014 20:38:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12099 invoked by uid 89); 4 Aug 2014 20:38:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Aug 2014 20:38:43 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s74KcgDU016606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <gdb-patches@sourceware.org>; Mon, 4 Aug 2014 16:38:42 -0400 Received: from host2.jankratochvil.net (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s74KT7xP022890 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for <gdb-patches@sourceware.org>; Mon, 4 Aug 2014 16:29:09 -0400 Date: Mon, 4 Aug 2014 22:29:07 +0200 From: Jan Kratochvil <jan.kratochvil@redhat.com> To: gdb-patches@sourceware.org Subject: [patch] Fix --with-babeltrace with gcc-4.9.1 Message-ID: <20140804202907.GA2608@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qMm9M+Fa2AknHoGS" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes |
Commit Message
Jan Kratochvil
Aug. 4, 2014, 8:29 p.m. UTC
Hi, when I tried to use --with-babeltrace on Fedora Rawhide x86_64 using gcc-4.9.1-3.fc22.x86_64 I got: checking for libbabeltrace... no configure: error: babeltrace is missing or unusable Makefile:7973: recipe for target 'configure-gdb' failed configure:15890: checking for libbabeltrace configure:15918: gcc -o conftest -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Werror -static-libstdc++ -static-libgcc -Wl,-z,relro conftest.c -lselinux -lncurses -lz -lm -ldl /usr/lib64/libbabeltrace.so /usr/lib64/libbabeltrace-ctf.so >&5 conftest.c: In function 'main': conftest.c:198:21: error: unused variable 'pos' [-Werror=unused-variable] struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); ^ cc1: all warnings being treated as errors configure:15918: $? = 1 configure: failed program was: The patch below fixes it for me. In configure.ac there is above this check: # Append -Werror to CFLAGS so that configure can catch the warning # "assignment from incompatible pointer type", which is related to # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works # in GDB, while babeltrace 1.0.3 is broken. # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be # safe to save and restore CFLAGS here. saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror" Maybe it would be easier to use there: CFLAGS="$CFLAGS -Werror -Wno-unused-variable" But maybe -Werror is cross-compiler compatible while -Wno-unused-variable is not, I have no idea. Jan gdb/ 2014-08-04 Jan Kratochvil <jan.kratochvil@redhat.com> * configure.ac (--with-babeltrace): Use 'pos'. * configure: Regenerate.
Comments
On Mon, Aug 4, 2014 at 1:29 PM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote: > Hi, > > when I tried to use --with-babeltrace on Fedora Rawhide x86_64 > using gcc-4.9.1-3.fc22.x86_64 I got: > > checking for libbabeltrace... no > configure: error: babeltrace is missing or unusable > Makefile:7973: recipe for target 'configure-gdb' failed > > configure:15890: checking for libbabeltrace > configure:15918: gcc -o conftest -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Werror -static-libstdc++ -static-libgcc -Wl,-z,relro conftest.c -lselinux -lncurses -lz -lm -ldl /usr/lib64/libbabeltrace.so /usr/lib64/libbabeltrace-ctf.so >&5 > conftest.c: In function 'main': > conftest.c:198:21: error: unused variable 'pos' [-Werror=unused-variable] > struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); > ^ > cc1: all warnings being treated as errors > configure:15918: $? = 1 > configure: failed program was: > > The patch below fixes it for me. > > In configure.ac there is above this check: > # Append -Werror to CFLAGS so that configure can catch the warning > # "assignment from incompatible pointer type", which is related to > # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works > # in GDB, while babeltrace 1.0.3 is broken. > # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be > # safe to save and restore CFLAGS here. > saved_CFLAGS=$CFLAGS > CFLAGS="$CFLAGS -Werror" > > Maybe it would be easier to use there: > CFLAGS="$CFLAGS -Werror -Wno-unused-variable" > > But maybe -Werror is cross-compiler compatible while -Wno-unused-variable is > not, I have no idea. > > > Jan > > gdb/ > 2014-08-04 Jan Kratochvil <jan.kratochvil@redhat.com> > > * configure.ac (--with-babeltrace): Use 'pos'. > * configure: Regenerate. > > diff --git a/gdb/configure.ac b/gdb/configure.ac > index 70d0964..07d2f00 100644 > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -2437,6 +2437,7 @@ else > struct bt_ctf_event *event = NULL; > const struct bt_definition *scope; > > + (void) pos; /* Prevent -Werror=unused-variable. */ > scope = bt_ctf_get_top_level_scope (event, > BT_STREAM_EVENT_HEADER); > bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); > diff --git a/gdb/configure b/gdb/configure > index 809326a..b983d16 100755 > --- a/gdb/configure > +++ b/gdb/configure > @@ -15344,6 +15344,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); > struct bt_ctf_event *event = NULL; > const struct bt_definition *scope; > > + (void) pos; /* Prevent -Werror=unused-variable. */ > scope = bt_ctf_get_top_level_scope (event, > BT_STREAM_EVENT_HEADER); > bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); > I don't know enough about babeltrace to say whether we can just remove pos altogether. I'm happy with the patch as is though.
On 08/05/2014 04:29 AM, Jan Kratochvil wrote: > gdb/ > 2014-08-04 Jan Kratochvil <jan.kratochvil@redhat.com> > > * configure.ac (--with-babeltrace): Use 'pos'. > * configure: Regenerate. > > diff --git a/gdb/configure.ac b/gdb/configure.ac > index 70d0964..07d2f00 100644 > --- a/gdb/configure.ac > +++ b/gdb/configure.ac > @@ -2437,6 +2437,7 @@ else > struct bt_ctf_event *event = NULL; > const struct bt_definition *scope; > > + (void) pos; /* Prevent -Werror=unused-variable. */ This patch fixes https://sourceware.org/bugzilla/show_bug.cgi?id=17104 Please mention it in ChangeLog entry. I had a patch to this PR, but didn't follow it up. Yours is fine.
diff --git a/gdb/configure.ac b/gdb/configure.ac index 70d0964..07d2f00 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -2437,6 +2437,7 @@ else struct bt_ctf_event *event = NULL; const struct bt_definition *scope; + (void) pos; /* Prevent -Werror=unused-variable. */ scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER); bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); diff --git a/gdb/configure b/gdb/configure index 809326a..b983d16 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15344,6 +15344,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); struct bt_ctf_event *event = NULL; const struct bt_definition *scope; + (void) pos; /* Prevent -Werror=unused-variable. */ scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER); bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));