gnucash master: Multiple changes pushed

John Ralls jralls at ceridwen.us
Wed Jul 9 03:21:50 EDT 2014


On Jul 9, 2014, at 3:05 AM, Tim Janssen <tjanssen at gmail.com> wrote:

> Hello gnucash-devel,
> 
> I've been following this thread and trying to compile GnuCash myself and have been getting the same error about unrecognised command line option but have gotten different results through experimenting.
> 
> First of all, I'm running Arch Linux 64bit. And gcc/g++ version 4.9.0. I'm trying to compile the latest source from git as of July 8, around 14:00 EDT.
> 
> $ gcc --version
> gcc (GCC) 4.9.0 20140604 (prerelease)
> Copyright (C) 2014 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> I ran ./configure with the --disable--error-on-warning option just so one warning won't halt the whole compile.
> 
> When compiling, sometimes there are two warnings: a warning about FORTIFY_SOURCE and a warning about the unrecognised command line option -Wno-non-literal-null-conversion:
> 
> In file included from /usr/include/string.h:25:0,
>                  from swig-core-utils-guile.c:300:
> /usr/include/features.h:341:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
>  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     ^
> cc1: warning: unrecognized command line option "-Wno-non-literal-null-conversion"
> 
> 
> These two warnings always appear together. Like Sumit, I tried compiling some trivial C and C++ programs with that compiler option to see what would happen. Neither gcc nor g++ issued warnings or erros about using that argument when I tried it on my sample code.
> 
> $ make
> gcc -c -Wall -Wno-non-literal-null-conversion -Werror -o main.o main.c 
> gcc -c -Wall -Wno-non-literal-null-conversion -Werror -o foo.o foo.c
> gcc -o main main.o foo.o
> $ 
> 
> 
> $ make
> g++ -c -Wall -Wno-non-literal-null-conversion -Werror -std=c++11 -o main.o main.cpp
> g++ -c -Wall -Wno-non-literal-null-conversion -Werror -std=c++11 -o foo.o foo.cpp
> g++ -c -Wall -Wno-non-literal-null-conversion -Werror -std=c++11 -o bar.o bar.cpp
> g++ -o main main.o foo.o bar.o
> $ 
> 
> 
> The wierd part: I changed configure.ac around line 1318 to add the -O2 option to CFLAGS and CXXFLAGS. (I doubt this is the right way to do it, but I'm not too familliar with the GNU build system, and I'm doing it just to see what would happen). 
> 
> # This has to come after AC_PROG_CC _AND_ GNOME_COMPILE_WARNINGS
> AC_LANG([C++])
> AX_CHECK_COMPILE_FLAG([-Wno-deprecated-register],
>     [AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-unused -Wno-deprecated-register -O2"],
>     [AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-unused"], [-Werror])
> AC_LANG([C])
> AX_CHECK_COMPILE_FLAG([-Wno-non-literal-null-conversion],
>     [AM_CFLAGS="${AM_CFLAGS} -Wno-non-literal-null-conversion -O2"],
>     [], [-Werror])
> 
> 
> After making this change and running autogen.sh, configure, and make, the warning about FORTIFY_SOURCE still appears about 4 times. But, the warning about -Wno-non-literal-null-conversion has disappeared.
> 
> gcc -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../lib/libc -I../../../../src -I../../../../src/core-utils -I../../../../src/gnc-module -I../../../../src/test-core -I../../../../src/engine -I../../../../src/engine/test-core -I../../../../src/backend/sql -I../../../../src/libqof/qof -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -D_FORTIFY_SOURCE=2 -pthread  -DG_LOG_DOMAIN=\"gnc.backend.sql\"  -DTESTPROG=test_sqlbe -I. -I../../../.. -I../../../../src/backend/sql/ -I../../../../src/backend/dbi/ -I../../../../src/libqof/qof/ -I../../../../src/test-core/ -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -g  -g  -MT test_sqlbe-utest-gnc-backend-sql.o -MD -MP -MF .deps/test_sqlbe-utest-gnc-backend-sql.Tpo -c -o test_sqlbe-utest-gnc-backend-sql.o `test -f 'utest-gnc-backend-sql.c' || echo './'`utest-gnc-backend-sql.c
> In file included from /usr/include/string.h:25:0,
>                  from utest-gnc-backend-sql.c:24:
> /usr/include/features.h:341:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
>  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     ^
> mv -f .deps/test_sqlbe-utest-gnc-backend-sql.Tpo .deps/test_sqlbe-utest-gnc-backend-sql.Po
> 
> I noticed that, for the files that still emit the FORTIFY_SOURCE warning when compiled, the CFLAGS in the configure.ac file are not being used. My -O2 and the -Wno-non-literal-null-conversion don't show up in the terminal.
> 
> 
> So, it seems trying to eliminate one compiler warning not only doesn't work but somehow eliminates another completely unrelated compiler warning.
> 
> I post this in the hopes that it might help someone much smarter than me figure out what's actually going on.

That's interesting. 

I don't see  -DFORTIFY_SOURCE, -Wno-non-literal-null-conversion in that last compile. I'll also note that Sumit's compillation of gfec.c which failed also has -O2 in the command line.

Regards,
John Ralls




More information about the gnucash-devel mailing list