This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

I'm building an old version of wireshark (1.5.0) and I got in the compilation time 255 errors. Most if not all of them seem to be "set but not used [-Wunused-but-set-variable]". I'm using gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1).

I want to just ignore them instead of working on fixing them for now! One of the ways to accomplish this is descried in here. It uses Wno-unused-function which is one of the gcc flags. I want to try that solution but I'm not sure where can I implement it in my case (which files I need to modify and how?). There are more than one Makefile and when I searched the word gcc in my current build directory I found it occurs 18,643 times.

Thanks in advance!

asked 02 Jul '14, 15:35

flora's gravatar image

flora
156313338
accept rate: 100%


(1.5.0 was a development release; you should probably be working on either 1.4.x or 1.6.x.)

-W flags generate warnings; they're only errors if -Werror is being used. You should be able to specify --disable-warnings-as-errors to the configure script to cause -Werror not to be used. That will cause the build to succeed; however:

  • you'll still get the warnings printed, so you'll still get a lot of noise from the build;
  • other warnings won't be treated as errors;

so if you do care about other warnings, removing -Werror won't help.

The SourceForge answer is, I suspect, wrong; the user complained about messages such as 'prefix_LineNumber' defined but not used from code such as CASSERT(isTrue) or CASSERT2(isTrue, prefix_), which sounds as if it's warning about unused variables, not unused functions. As the error message indicates, the -W flag causing the warnings you're seeing is -Wunused-but-set-variable, so you would either want to remove -Wunused-but-set-variable from the set of options or arrange that -Wno-unused-but-set-variable be in the set of options.

So, if you still want warnings to be treated as errors, but don't want particular warnings to be issued at all, then, if adding it to the options is sufficient, running the configure script as

CFLAGS=-Wno-unused-but-set-variable ./configure

would work. However, doing that might put -Wno-unused-but-set-variable into the options before -Wunused-but-set-variable, and the last of the options might rule. If that's the case, you might need to edit the configure script source file (probably called configure.in in that older release), remove the line that adds -Wunused-but-set-variable, re-run ./autogen.sh to generate the configure script, and reconfigure. You would also remove whatever other warning options are causing issues.

But --disable-warnings-as-errors is the easiest way, so if you're willing to have a lot of warnings printed, but not have any warnings treated as errors, just do that.

permanent link

answered 02 Jul '14, 15:59

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Thanks your answer! It helps a lot. Wireshark is working perfect now after using in the configuration part

CFLAGS="-Wno-unused-but-set-variable" ./configure --disable-warnings-as-errors

(08 Jul '14, 14:36) flora
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×193
×41
×5
×3

question asked: 02 Jul '14, 15:35

question was seen: 34,016 times

last updated: 08 Jul '14, 14:36

p​o​w​e​r​e​d by O​S​Q​A