Fix below warning when make nconfig is run initially
or after make clean.
HOSTCC scripts/kconfig/nconf.o
scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
^
<command-line>:0:0: note: this is the location of the previous definition
Signed-off-by: Cheah Kok Cheong <[email protected]>
---
scripts/kconfig/nconf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index d42d534..a9bc533 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -5,7 +5,9 @@
* Derived from menuconfig.
*
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <string.h>
#include <stdlib.h>
--
2.7.4
Dne 27.11.2016 v 17:28 Cheah Kok Cheong napsal(a):
> Fix below warning when make nconfig is run initially
> or after make clean.
>
> HOSTCC scripts/kconfig/nconf.o
> scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
> #define _GNU_SOURCE
> ^
> <command-line>:0:0: note: this is the location of the previous definition
The Makefile does not specify -D_GNU_SOURCE. Are you adding it manually?
Thanks,
Michal
Did not add anything. I append output of "make nconfig --trace" and "gcc -v"
below. The -D_GNU_SOURCE flag appeared as it goes into scripts/kconfig.
See whether you can spot anything else.
Sorry for the unwrapped output.
Thanks,
CheahKC
$ make nconfig --trace
Makefile:447: target 'scripts_basic' does not exist
make -f ./scripts/Makefile.build obj=scripts/basic
scripts/Makefile.host:107: update target 'scripts/basic/fixdep' due to: FORCE
set -e; echo ' HOSTCC scripts/basic/fixdep'; gcc -Wp,-MD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/basic/fixdep scripts/basic/fixdep.c ; scripts/basic/fixdep scripts/basic/.fixdep.d scripts/basic/fixdep 'gcc -Wp,-MD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -o scripts/basic/fixdep scripts/basic/fixdep.c ' > scripts/basic/.fixdep.tmp; rm -f scripts/basic/.fixdep.d; mv -f scripts/basic/.fixdep.tmp scripts/basic/.fixdep.cmd;
HOSTCC scripts/basic/fixdep
scripts/Makefile.build:98: update target '__build' due to: scripts/basic/fixdep
:
rm -f .tmp_quiet_recordmcount
Makefile:545: update target 'nconfig' due to: scripts_basic outputmakefile FORCE
make -f ./scripts/Makefile.build obj=scripts/kconfig nconfig
scripts/Makefile.host:124: update target 'scripts/kconfig/nconf.o' due to: scripts/kconfig/nconf.c FORCE
set -e; echo ' HOSTCC scripts/kconfig/nconf.o'; gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o scripts/kconfig/nconf.o scripts/kconfig/nconf.c; scripts/basic/fixdep scripts/kconfig/.nconf.o.d scripts/kconfig/nconf.o 'gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o scripts/kconfig/nconf.o scripts/kconfig/nconf.c' > scripts/kconfig/.nconf.o.tmp; rm -f scripts/kconfig/.nconf.o.d; mv -f scripts/kconfig/.nconf.o.tmp scripts/kconfig/.nconf.o.cmd;
HOSTCC scripts/kconfig/nconf.o
scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
^
<command-line>:0:0: note: this is the location of the previous definition
scripts/Makefile.host:124: update target 'scripts/kconfig/zconf.tab.o' due to: scripts/kconfig/zconf.tab.c FORCE scripts/kconfig/zconf.lex.c scripts/kconfig/zconf.hash.c
set -e; echo ' HOSTCC scripts/kconfig/zconf.tab.o'; gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c; scripts/basic/fixdep scripts/kconfig/.zconf.tab.o.d scripts/kconfig/zconf.tab.o 'gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c' > scripts/kconfig/.zconf.tab.o.tmp; rm -f scripts/kconfig/.zconf.tab.o.d; mv -f scripts/kconfig/.zconf.tab.o.tmp scripts/kconfig/.zconf.tab.o.cmd;
HOSTCC scripts/kconfig/zconf.tab.o
scripts/Makefile.host:124: update target 'scripts/kconfig/nconf.gui.o' due to: scripts/kconfig/nconf.gui.c FORCE
set -e; echo ' HOSTCC scripts/kconfig/nconf.gui.o'; gcc -Wp,-MD,scripts/kconfig/.nconf.gui.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o scripts/kconfig/nconf.gui.o scripts/kconfig/nconf.gui.c; scripts/basic/fixdep scripts/kconfig/.nconf.gui.o.d scripts/kconfig/nconf.gui.o 'gcc -Wp,-MD,scripts/kconfig/.nconf.gui.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o scripts/kconfig/nconf.gui.o scripts/kconfig/nconf.gui.c' > scripts/kconfig/.nconf.gui.o.tmp; rm -f scripts/kconfig/.nconf.gui.o.d; mv -f scripts/kconfig/.nconf.gui.o.tmp scripts/kconfig/.nconf.gui.o.cmd;
HOSTCC scripts/kconfig/nconf.gui.o
scripts/Makefile.host:116: update target 'scripts/kconfig/nconf' due to: FORCE scripts/kconfig/nconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/nconf.gui.o
set -e; echo ' HOSTLD scripts/kconfig/nconf'; gcc -o scripts/kconfig/nconf scripts/kconfig/nconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/nconf.gui.o -lmenu -lpanel -lncurses -ltinfo; printf '%s\n' 'cmd_scripts/kconfig/nconf := gcc -o scripts/kconfig/nconf scripts/kconfig/nconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/nconf.gui.o -lmenu -lpanel -lncurses -ltinfo' > scripts/kconfig/.nconf.cmd
HOSTLD scripts/kconfig/nconf
scripts/kconfig/Makefile:34: update target 'nconfig' due to: scripts/kconfig/nconf
scripts/kconfig/nconf Kconfig
$
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
$
On Mon, Nov 28, 2016 at 11:39:01AM +0100, Michal Marek wrote:
> Dne 27.11.2016 v 17:28 Cheah Kok Cheong napsal(a):
> > Fix below warning when make nconfig is run initially
> > or after make clean.
> >
> > HOSTCC scripts/kconfig/nconf.o
> > scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
> > #define _GNU_SOURCE
> > ^
> > <command-line>:0:0: note: this is the location of the previous definition
>
> The Makefile does not specify -D_GNU_SOURCE. Are you adding it manually?
>
> Thanks,
> Michal
[Dropped Yann.]
On Tue, 2016-11-29 at 02:46 +0800, Cheah Kok Cheong wrote:
> On Mon, Nov 28, 2016 at 11:39:01AM +0100, Michal Marek wrote:
> > The Makefile does not specify -D_GNU_SOURCE. Are you adding it manually?
On Fedora 24 I'm able to trigger this too:
$ [...]
make -f ./scripts/Makefile.build obj=scripts/kconfig nconfig
gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.o scripts/kconfig/nconf.c
scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
<command-line>:0:0: note: this is the location of the previous definition
It's probably added by pkg-config:
$ pkg-config --cflags ncursesw
-D_GNU_SOURCE
And apparently we call pkg-config in scripts/kconfig/Makefile. Or in
scripts/kconfig/lxdialog/check-lxdialog.sh. Not sure, I didn't yet dive deeper
into this.
Hope this helps,
Paul Bolle
On Mon, Nov 28, 2016 at 09:29:21PM +0100, Paul Bolle wrote:
> [Dropped Yann.]
>
> On Tue, 2016-11-29 at 02:46 +0800, Cheah Kok Cheong wrote:
> > On Mon, Nov 28, 2016 at 11:39:01AM +0100, Michal Marek wrote:
> > > The Makefile does not specify -D_GNU_SOURCE. Are you adding it manually?
>
> On Fedora 24 I'm able to trigger this too:
> $ [...]
> make -f ./scripts/Makefile.build obj=scripts/kconfig nconfig
> gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -D_GNU_SOURCE -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.o scripts/kconfig/nconf.c
> scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined
> #define _GNU_SOURCE
>
> <command-line>:0:0: note: this is the location of the previous definition
>
> It's probably added by pkg-config:
> $ pkg-config --cflags ncursesw
> -D_GNU_SOURCE
I see. That's not nice of the pkconfig file to set such macro, but oh
well. I applied the patch to kbuild.git#kconfig now, thanks Cheah.
Michal