Solved Error "misleading indentation" compiling the kernel

Hi!
Im trying to compile my custom kernel but shows me this error:
Code:
--- mrsas_cam.o ---
cc -target x86_64-unknown-freebsd12.1 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe -fno-strict-aliasing -march=native -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -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 -MD  -MF.depend.mrsas_cam.o -MTmrsas_cam.o -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -Werror  /usr/src/sys/dev/mrsas/mrsas_cam.c
/usr/src/sys/dev/mrsas/mrsas_cam.c:1919:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (mpt_cmd->ccb_ptr->cpi.bus_id == bus_id &&
                        ^
/usr/src/sys/dev/mrsas/mrsas_cam.c:1916:3: note: previous statement is here
                if (bus_id == 1)
                ^
1 error generated.
*** [mrsas_cam.o] Error code 1

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GLATS
--- mmc.o ---
ctfconvert -L VERSION -g mmc.o
--- modules-all ---
ctfconvert -L VERSION -g arcmsr.o
A failure has been detected in another branch of the parallel make

make[4]: stopped in /usr/src/sys/modules/arcmsr
*** [all_subdir_arcmsr] Error code 2

make[3]: stopped in /usr/src/sys/modules
1 error

make[3]: stopped in /usr/src/sys/modules
*** [modules-all] Error code 2

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GLATS
--- mrsas.o ---
ctfconvert -L VERSION -g mrsas.o
2 errors

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GLATS
*** [buildkernel] Error code 2

make[1]: stopped in /usr/src
1 error

make[1]: stopped in /usr/src
*** [buildkernel] Error code 2

make: stopped in /usr/src
1 error

make: stopped in /usr/src

here is my /etc/make.conf
Code:
CPUTYPE?=native
CFLAGS=-O2 -pipe -fno-strict-aliasing
COPTFLAGS=-O2 -pipe -fno-strict-aliasing
MALLOC_PRODUCTION="YES"
and my /etc/src.conf
Code:
WITHOUT_ASSERT_DEBUG="ON"

I don't think the configuration kernel is important. But if it is, please let me know to post it.

Thanks!
 
Remove the CFLAGS and COPTFLAGS. Actually, remove the whole /etc/make.conf.
 
here:
Code:
glats@freebsd-x240:/usr/src % svn info | grep 'Repository Root' | awk '{print $NF}'
https://svn.freebsd.org/base
glats@freebsd-x240:/usr/src % svn info 
Path: .
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 362958
Node Kind: directory
Schedule: normal
Last Changed Author: gordon
Last Changed Rev: 361973
Last Changed Date: 2020-06-09 12:15:07 -0400 (Tue, 09 Jun 2020)
 
Here it is:
(I didn't want to put it all here so as not to deform the forum)
To me the problem is that the code indentation is wrong. Judging the compiler message error, of course.
 
Your kernel config file builds fine here.
Code:
--------------------------------------------------------------
>>> Kernel build for GLATS completed on Tue Jul  7 10:38:03 +02 2020
--------------------------------------------------------------

In /etc/make.conf and /etc/src.conf I have WITH_CCACHE_BUILD, CCACHE_DIR
Code:
svnlite info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 362987
Node Kind: directory
Schedule: normal
Last Changed Author: gordon
Last Changed Rev: 361973
Last Changed Date: 2020-06-09 18:15:07 +0200 (Tue, 09 Jun 2020)

My copies Revision (362987) differs from yours (362958).

I followed the instructions from the handbook:

Updated source tree,
cp GLATS /root/kernel
cd /usr/src/sys/amd64/conf
ln -s /root/kernel/GLATS

/usr/src:# make cleanworld
/usr/src:# make buildkernel KERNELCONF=GLATS # no jobs

Maybe the source tree is to blame. Delete old, try a fresh copy.
 
The path in your /usr/obj let me assume you're using some experimental build method in /etc/src-env.conf or from the command line/environment, e.g. WITH_DIRDEPS_xxx or WITH_META_MODE? Try without. Last time I tried the DIRDEPS stuff it did not work.
 
Your kernel config file builds fine here.
Code:
--------------------------------------------------------------
>>> Kernel build for GLATS completed on Tue Jul  7 10:38:03 +02 2020
--------------------------------------------------------------

In /etc/make.conf and /etc/src.conf I have WITH_CCACHE_BUILD, CCACHE_DIR
Code:
svnlite info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 362987
Node Kind: directory
Schedule: normal
Last Changed Author: gordon
Last Changed Rev: 361973
Last Changed Date: 2020-06-09 18:15:07 +0200 (Tue, 09 Jun 2020)

My copies Revision (362987) differs from yours (362958).

I followed the instructions from the handbook:

Updated source tree,
cp GLATS /root/kernel
cd /usr/src/sys/amd64/conf
ln -s /root/kernel/GLATS

/usr/src:# make cleanworld
/usr/src:# make buildkernel KERNELCONF=GLATS # no jobs

Maybe the source tree is to blame. Delete old, try a fresh copy.
revision 360
Your kernel config file builds fine here.
Code:
--------------------------------------------------------------
>>> Kernel build for GLATS completed on Tue Jul  7 10:38:03 +02 2020
--------------------------------------------------------------

In /etc/make.conf and /etc/src.conf I have WITH_CCACHE_BUILD, CCACHE_DIR
Code:
svnlite info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/releng/12.1
Relative URL: ^/releng/12.1
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 362987
Node Kind: directory
Schedule: normal
Last Changed Author: gordon
Last Changed Rev: 361973
Last Changed Date: 2020-06-09 18:15:07 +0200 (Tue, 09 Jun 2020)

My copies Revision (362987) differs from yours (362958).

I followed the instructions from the handbook:

Updated source tree,
cp GLATS /root/kernel
cd /usr/src/sys/amd64/conf
ln -s /root/kernel/GLATS

/usr/src:# make cleanworld
/usr/src:# make buildkernel KERNELCONF=GLATS # no jobs

Maybe the source tree is to blame. Delete old, try a fresh copy.

Ok. I removed everything and I ran doas svn co https://svn.freebsd.org/base/releng/12.1 /usr/src
I added WITH_CCACHE_BUILD and CCACHE_DIR to /etc/make.conf and /etc/src.conf
I changed the revision running doas svn update -r 362987
for every change above i made i executed doas make -j`sysctl -n hw.ncpu` buildkernel KERNCONF=GLATS and doas make buildkernel KERNCONF=GLATS
And nothing work :(

The path in your /usr/obj let me assume you're using some experimental build method in /etc/src-env.conf or from the command line/environment, e.g. WITH_DIRDEPS_xxx or WITH_META_MODE? Try without. Last time I tried the DIRDEPS stuff it did not work.
Nope. I don't have that.
 
Ok. I removed everything and I ran
How did you remove it? In /usr/src is a .svn sub-directory, which harbors a copy of the source (in the pristine sub-directory). svn looks first to those files before updating/checking out the source and downloads only those files which have changed. To make sure to remove all source files remove the whole src directory, rm -r /usr/src, create a new one. Double check path before executing command.

I added WITH_CCACHE_BUILD and CCACHE_DIR to /etc/make.conf and /etc/src.conf
Is devel/ccache acctually installed? You haven't set it before, it could be an indication it isn't. Without installed devel/ccache those entries have no effect (ccache(1)).

I changed the revision running doas svn update -r 362987

I believe a certain revision is not responsible for the build failure. releng/12.1 (12.1-RELEASE) is quite stable. The source code is not known to have frequent build failures. Check-out to latest revision, at the time of this writing: 363003.

To force a clean rebuild run make cleanworld. That will clean /usr/obj from previous compiled code.

And nothing work
Do you mean the build failure is at the same place? If it is at a different place, please post error.

I believe the /usr/src/.svn directory hasn't been deleted, your svn co hasn't fetched a complete fresh copy of the source.
 
I was able to reproduce the error in a different part of the 12.1-RELEASE GENERIC kernel configuration using make buildworld with the 12-STABLE source (r363047) in /usr/src-stable, moving /usr/obj/usr/src-stable to /usr/obj/usr/src, and subsequently executing make buildkernel with the 12.1-RELEASE source (r363061) in /usr/src:
Code:
/usr/local/bin/ccache cc -target x86_64-unknown-freebsd12.1 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -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 -MD  -MF.depend.ips.o -MTips.o -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -mretpoline -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -Werror  /usr/src/sys/dev/ips/ips.c -Wno-error-sometimes-uninitialized
/usr/src/sys/dev/ips/ips.c:288:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if(error)
                        ^
/usr/src/sys/dev/ips/ips.c:286:3: note: previous statement is here
                if(sc->diskdev[i])
                ^
1 error generated.
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GENERIC
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src
I think this is related to the issue I had awhile back while building the 12.1-RELEASE kernel on a 12-STABLE installation since the same error occurred: I didn't execute make buildworld for the 12.1-RELEASE source. 12-STABLE uses a newer version of clang (10.0) than 12.1-RELEASE (8.0.1), so that might be the problem.
 
Great!
After this advice I deleted https://svn.freebsd.org/base/releng/12.1 from /us/src completly (.svn folder including) and i download the new sources like this doas svn co https://svn.freebsd.org/base/stable/12 /usr/src/
I made my custom config and i could compile it and install it sucessfully.
Resume: i'm using freebsd 12.1 stable and i compiled /base/stable/12 sources. That's the perfect combination.
Thank you all!
 
Back
Top