creachadair / imath

Arbitrary precision integer and rational arithmetic library
Other
129 stars 20 forks source link

Compilation error: -Wno-error=unused-command-line-argument #11

Closed cviebig closed 5 years ago

cviebig commented 8 years ago

On my system the build fails on commit 23b2b1f51c3b0299a2d8f73b04c33c86c9746bb0 and gcc version 5.3.0 with:

➜ make
gcc -ansi -pedantic -Wall -Werror -Wno-error=unused-command-line-argument -I. -O3 -funroll-loops -finline-functions -std=c99 -DUSE_64BIT_WORDS -c imtimer.c
cc1: error: -Werror=unused-command-line-argument: no option -Wunused-command-line-argument
Makefile:69: recipe for target 'imtimer.o' failed
make: *** [imtimer.o] Error 1

Are you aware of any changes in gcc on that option since June 2015? If I remember correctly I was able to build imath back then.

After removing that option the build continues to fail with missing <getopt.h>. This can be resolved according to an answer on StackOverfow [1].

I've attached the diff informally below.

Best regards Christoph

[1] StackOverflow: Getopt not included? implicit declaration of function ‘getopt’

Changes:

diff --git a/Makefile b/Makefile
index a919a1e..94f5e06 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@
 ## If building under MacOS 10.1.x, use CC=cc instead.
 ##
 CC=gcc
-CFLAGS+=-ansi -pedantic -Wall -Werror -Wno-error=unused-command-line-argument \
+CFLAGS+=-ansi -pedantic -Wall -Werror \
        -I. $(DFLAGS$(DEBUG)) $(SIZEFLAGS$(USELLONG))
 LIBFLAGS=-dynamiclib
 LIBS=$(DLIBS$(DEBUG))
@@ -46,8 +46,8 @@ DFLAGSY=-g -DDEBUG=1
 ## If USELONG=N, disable the use of the "long long" data type; it is
 ## enabled by default even though it is non-standard.  Define
 ## USELONG=Y to explicitly enable the use of "long long"
-SIZEFLAGS = -std=c99 -DUSE_64BIT_WORDS
-SIZEFLAGSN = -std=c99
+SIZEFLAGS = -std=gnu99 -DUSE_64BIT_WORDS
+SIZEFLAGSN = -std=gnu99
 SIZEFLAGSY = $(SIZEFLAGS)

 # --- end of configuration section ---
(END)
creachadair commented 5 years ago

I'm sorry to say I can't reproduce this at the moment, though I imagine it might depend on what system you were building on. Given the error message, I suppose this flag isn't (wasn't?) supported by that version of gcc. If you still find this happening, feel free to re-open it, ideally with some more details on your setup.