warning DEBUG redefined when building kernel with option DEBUG

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

warning DEBUG redefined when building kernel with option DEBUG

mujo
Using OpenBSD 6.5-current (GENERIC.MP) #158: Tue Aug  6 16:46:13 MDT
2019

Following directions here: https://www.openbsd.org/faq/faq5.html#Custom

$ cd /sys/arch/arm64/conf
$ cp GENERIC CUSTOM
$ vi CUSTOM # added option DEBUG
$ config CUSTOM
$ cd ../compile/CUSTOM
$ make

I get the following error:

cc -g -Werror -Wall -Wimplicit-function-declaration  -Wno-uninitialized
-Wno-pointer-sign  -Wno-constant-conversion
-Wno-address-of-packed-member  -Wframe-larger-than=2047
-march=armv8-a+nofp+nosimd  -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer  -ffixed-x18 -ffreestanding -fno-pie -O2
-pipe -nostdinc -I/usr/src/sys
-I/usr/src/sys/arch/arm64/compile/CUSTOM/obj -I/usr/src/sys/arch
-I/usr/src/sys/dev/pci/drm/include
-I/usr/src/sys/dev/pci/drm/include/uapi -DDDB -DDIAGNOSTIC -DKTRACE
-DACCOUNTING -DKMEMSTATS -DPTRACE -DPOOL_DEBUG -DCRYPTO -DSYSVMSG
-DSYSVSEM -DSYSVSHM -DUVM_SWAP_ENCRYPT -DFFS -DFFS2 -DFFS_SOFTUPDATES
-DUFS_DIRHASH -DQUOTA -DEXT2FS -DMFS -DNFSCLIENT -DNFSSERVER -DCD9660
-DUDF -DMSDOSFS -DFIFO -DFUSE -DSOCKET_SPLICE -DTCP_ECN -DTCP_SIGNATURE
-DINET6 -DIPSEC -DPPP_BSDCOMP -DPPP_DEFLATE -DPIPEX -DMROUTING -DMPLS
-DBOOT_CONFIG -DTIMEZONE="0" -DDST="0" -DPCIVERBOSE -DUSER_PCICONF
-DUSBVERBOSE -DDEBUG -DWSDISPLAY_COMPAT_USL -DWSDISPLAY_COMPAT_RAWKBD
-DWSDISPLAY_DEFAULTSCREENS="6" -DONEWIREVERBOSE -DMAXUSERS=80 -D_KERNEL
-D__arm64__ -MD -MP  -c /usr/src/sys/dev/pci/drm/drm_print.c
/usr/src/sys/dev/pci/drm/drm_print.c:26:9: error: 'DEBUG' macro
redefined
      [-Werror,-Wmacro-redefined]
#define DEBUG /* for pr_debug() */
        ^
<command line>:43:9: note: previous definition is here
#define DEBUG 1
        ^
1 error generated.
*** Error 1 in /usr/src/sys/arch/arm64/compile/CUSTOM (Makefile:860
'drm_print.o')

Looking at /usr/src/sys/dev/pci/drm/include/linux/printk.h where
pr_debug() is defined:

#ifdef DRMDEBUG
#define pr_info(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#define pr_info_once(fmt, arg...) printk_once(pr_fmt(fmt), ## arg)
#define pr_debug(fmt, arg...) printf(pr_fmt(fmt), ## arg)
#else

Therefore I prepose the following patch:

? sys/arch/arm64/compile/CUSTOM
? sys/arch/arm64/conf/CUSTOM
Index: sys/dev/pci/drm/drm_print.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_print.c,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 drm_print.c
--- sys/dev/pci/drm/drm_print.c 14 Apr 2019 10:14:51 -0000 1.1
+++ sys/dev/pci/drm/drm_print.c 9 Aug 2019 06:28:50 -0000
@@ -23,7 +23,7 @@
  * Rob Clark <[hidden email]>
  */
 
-#define DEBUG /* for pr_debug() */
+#define DRMDEBUG /* for pr_debug() */
 
 #include <sys/stdarg.h>
 #include <linux/seq_file.h>

Thanks.

--
ioh

Reply | Threaded
Open this post in threaded view
|

Re: warning DEBUG redefined when building kernel with option DEBUG

Jonathan Gray-11
On Fri, Aug 09, 2019 at 06:58:10AM +0000, mujo wrote:

> Using OpenBSD 6.5-current (GENERIC.MP) #158: Tue Aug  6 16:46:13 MDT
> 2019
>
> Following directions here: https://www.openbsd.org/faq/faq5.html#Custom
>
> $ cd /sys/arch/arm64/conf
> $ cp GENERIC CUSTOM
> $ vi CUSTOM # added option DEBUG
> $ config CUSTOM
> $ cd ../compile/CUSTOM
> $ make
>
> I get the following error:
>
> cc -g -Werror -Wall -Wimplicit-function-declaration  -Wno-uninitialized
> -Wno-pointer-sign  -Wno-constant-conversion
> -Wno-address-of-packed-member  -Wframe-larger-than=2047
> -march=armv8-a+nofp+nosimd  -fno-omit-frame-pointer
> -mno-omit-leaf-frame-pointer  -ffixed-x18 -ffreestanding -fno-pie -O2
> -pipe -nostdinc -I/usr/src/sys
> -I/usr/src/sys/arch/arm64/compile/CUSTOM/obj -I/usr/src/sys/arch
> -I/usr/src/sys/dev/pci/drm/include
> -I/usr/src/sys/dev/pci/drm/include/uapi -DDDB -DDIAGNOSTIC -DKTRACE
> -DACCOUNTING -DKMEMSTATS -DPTRACE -DPOOL_DEBUG -DCRYPTO -DSYSVMSG
> -DSYSVSEM -DSYSVSHM -DUVM_SWAP_ENCRYPT -DFFS -DFFS2 -DFFS_SOFTUPDATES
> -DUFS_DIRHASH -DQUOTA -DEXT2FS -DMFS -DNFSCLIENT -DNFSSERVER -DCD9660
> -DUDF -DMSDOSFS -DFIFO -DFUSE -DSOCKET_SPLICE -DTCP_ECN -DTCP_SIGNATURE
> -DINET6 -DIPSEC -DPPP_BSDCOMP -DPPP_DEFLATE -DPIPEX -DMROUTING -DMPLS
> -DBOOT_CONFIG -DTIMEZONE="0" -DDST="0" -DPCIVERBOSE -DUSER_PCICONF
> -DUSBVERBOSE -DDEBUG -DWSDISPLAY_COMPAT_USL -DWSDISPLAY_COMPAT_RAWKBD
> -DWSDISPLAY_DEFAULTSCREENS="6" -DONEWIREVERBOSE -DMAXUSERS=80 -D_KERNEL
> -D__arm64__ -MD -MP  -c /usr/src/sys/dev/pci/drm/drm_print.c
> /usr/src/sys/dev/pci/drm/drm_print.c:26:9: error: 'DEBUG' macro
> redefined
>       [-Werror,-Wmacro-redefined]
> #define DEBUG /* for pr_debug() */
>         ^
> <command line>:43:9: note: previous definition is here
> #define DEBUG 1
>         ^
> 1 error generated.
> *** Error 1 in /usr/src/sys/arch/arm64/compile/CUSTOM (Makefile:860
> 'drm_print.o')
>
> Looking at /usr/src/sys/dev/pci/drm/include/linux/printk.h where
> pr_debug() is defined:
>
> #ifdef DRMDEBUG
> #define pr_info(fmt, arg...) printf(pr_fmt(fmt), ## arg)
> #define pr_info_once(fmt, arg...) printk_once(pr_fmt(fmt), ## arg)
> #define pr_debug(fmt, arg...) printf(pr_fmt(fmt), ## arg)
> #else
>
> Therefore I prepose the following patch:

Thanks for the report.  I don't see a reason to define anything here
so I've committed this:

Index: drm_print.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_print.c,v
retrieving revision 1.1
diff -u -p -r1.1 drm_print.c
--- drm_print.c 14 Apr 2019 10:14:51 -0000 1.1
+++ drm_print.c 9 Aug 2019 09:12:00 -0000
@@ -23,7 +23,9 @@
  * Rob Clark <[hidden email]>
  */
 
+#ifdef __linux__
 #define DEBUG /* for pr_debug() */
+#endif
 
 #include <sys/stdarg.h>
 #include <linux/seq_file.h>

>
> ? sys/arch/arm64/compile/CUSTOM
> ? sys/arch/arm64/conf/CUSTOM
> Index: sys/dev/pci/drm/drm_print.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/drm_print.c,v
> retrieving revision 1.1
> diff -u -p -u -p -r1.1 drm_print.c
> --- sys/dev/pci/drm/drm_print.c 14 Apr 2019 10:14:51 -0000 1.1
> +++ sys/dev/pci/drm/drm_print.c 9 Aug 2019 06:28:50 -0000
> @@ -23,7 +23,7 @@
>   * Rob Clark <[hidden email]>
>   */
>  
> -#define DEBUG /* for pr_debug() */
> +#define DRMDEBUG /* for pr_debug() */
>  
>  #include <sys/stdarg.h>
>  #include <linux/seq_file.h>
>
> Thanks.
>
> --
> ioh
>