# buildkernel fails with a 'invalid conversion specifier' compiler error



## lyuts (Sep 17, 2016)

Hi guys,

I've been using instructions for rebuilding from source from the handbook, but recently I've started seeing failures to compile the kernel. World builds fine, but kernel fails to build with:


```
cc  -c -O2 -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-ex
terns -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  
-Wundef -Wno-pointer-sign   -Wmissing-include-dirs -fdiagnostics-show-option  -Wno-err
or-tautological-compare -Wno-error-empty-body  -Wno-error-parentheses-equality -Wno-er
ror-unused-function   -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -I/usr
/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel
 -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffree$
tanding -fstack-protector -gdwarf-2 -Werror  /usr/src/sys/cam/cam_xpt.c
/usr/src/sys/cam/cam_xpt.c:1060:27: error:
      invalid conversion specifier 'b'
      [-Werror,-Wformat-invalid-specifier]
  ...printf("%s%d: quirks=0x%b\n", perip...
                            ~^
/usr/src/sys/cam/cam_xpt.c:1061:36: error:
      data argument not used by format
      string [-Werror,-Wformat-extra-args]
  ...periph->unit_number, quirks, bit_st...
                                  ^
2 errors generated.
*** Error code 1
```

My /etc/make.conf looks like this:

```
WITH_PKGNG=yes
SSP_CFLAGS=-fstack-protector-all
WITH_SSP_PORTS=yes
WITHOUT="DOCS"
```

SVN info:

```
# svn info
Path: .
Working Copy Root Path: /usr/src
URL: svn://svn.freebsd.org/base/stable/10
Relative URL: ^/stable/10
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 305760
Node Kind: directory
Schedule: normal
Last Changed Author: lwhsu
Last Changed Rev: 305759
Last Changed Date: 2016-09-12 22:22:08 -0700 (Mon, 12 Sep 2016)
```

I assume the problem is not with the source, but with the setup. But can't seem to find anything that could cause this issue. Has anyone seen these errors? Any hints for what to try?

Thank you.


----------



## SirDice (Sep 19, 2016)

I'd start by removing /etc/make.conf and/or /etc/src.conf. Nine times out of ten they're the ones causing build errors. Also try updating the source again. It has happened to me too from time to time, apparently I have a habit of updating my sources right in the middle of a big commit.


----------



## Remington (Sep 19, 2016)

I wouldn't use hardening flags such as `SSP_CFLAGS` as it will affect compiling. Your make.conf should be targeted for specific builds or ports or at least remove it.  If you use general declarations in make.conf then builds or ports you compiled will break something so best to leave things as default for stability.


----------



## lyuts (Sep 20, 2016)

SirDice said:


> I'd start by removing /etc/make.conf and/or /etc/src.conf. Nine times out of ten they're the ones causing build errors. Also try updating the source again. It has happened to me too from time to time, apparently I have a habit of updating my sources right in the middle of a big commit.



I didn't have /etc/src.conf at the time of building and have been frequently updating from svn to see if the issue goes away. I've started seeing this error around Aug 6th according to my build logs so I excluded the problem of being in the middle of a big change commit. And I haven't changed the setup or build procedure. I've been able to workaround this by setting WITHOUT_FORMAT_EXTENSIONS=1 in /etc/src.conf. Thanks to dim@ on freebsd-stable mailing list for the hint.


----------



## lyuts (Sep 20, 2016)

Remington said:


> I wouldn't use hardening flags such as `SSP_CFLAGS` as it will affect compiling. Your make.conf should be targeted for specific builds or ports or at least remove it.  If you use general declarations in make.conf then builds or ports you compiled will break something so best to leave things as default for stability.



This got pulled into my /etc/make.conf as suggested in UPDATING. Do you know how to make this option for ports only?


----------

