Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix --with-babeltrace with gcc-4.9.1
Date: Mon, 04 Aug 2014 20:38:00 -0000	[thread overview]
Message-ID: <20140804202907.GA2608@host2.jankratochvil.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

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

[-- Attachment #2: gdb-babeltrace-configure.patch --]
[-- Type: text/plain, Size: 1084 bytes --]

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"));

             reply	other threads:[~2014-08-04 20:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 20:38 Jan Kratochvil [this message]
2014-08-04 23:37 ` Doug Evans
2014-08-06  1:04 ` Yao Qi
2014-08-12 19:22   ` [patch+7.8?] " Jan Kratochvil
2014-08-12 20:33     ` Doug Evans
2014-08-12 20:38       ` Jan Kratochvil
2014-08-12 21:28         ` Doug Evans
2014-08-13  1:54       ` Yao Qi
2014-08-13  3:05         ` Doug Evans
2014-08-13  9:52           ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140804202907.GA2608@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox