Bug #2505

i386 buildkernel cc1: error: too many filenames given /usr/obj/usr/src/world_i386/usr/include: No such file or directory

Added by davshao over 1 year ago. Updated over 1 year ago.

Status:In ProgressStart date:02/03/2013
Priority:NormalDue date:
Assignee:-% Done:

50%

Category:-
Target version:-

Description

On a i386 build updating from

commit e2a099cf1b1188b60aecc18de449444f7dca0f6a
Date: Fri Feb 1 13:47:37 2013 -0800

kernel - Fix kernel panic caused by rename race

to

commit 6de060a4493ce25dda4287f3ab00041b698ba2b8
Date: Sun Feb 3 13:32:01 2013 +0100

Unbreak world with NO_GCC44

with /etc/make.conf

CFLAGS+=-g
STRIP=

# make buildworld && make buildkernel

ends with an error:
===> bus/cam/cam
@ -> /usr/src/sys/bus/cam/cam/../../..
echo "#define SCSI_DELAY 15000" > opt_scsi.h
rm -f .depend
> .depend
mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I. -I@ -I/usr/obj/usr/src/sys/GENERIC -I/usr/obj/usr/src/sys/GENERIC/include -I@/../include -I/usr/obj/usr/src/world_i386/usr/include -std=c99 -std=gnu99 -std=c99 /usr/src/sys/bus/cam/cam/../cam.c /usr/src/sys/bus/cam/cam/../cam_periph.c /usr/src/sys/bus/cam/cam/../cam_queue.c /usr/src/sys/bus/cam/cam/../cam_sim.c /usr/src/sys/bus/cam/cam/../cam_xpt.c /usr/src/sys/bus/cam/cam/../cam_extend.c /usr/src/sys/bus/cam/cam/../scsi/scsi_all.c /usr/src/sys/bus/cam/cam/../scsi/scsi_cd.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ch.c /usr/src/sys/bus/cam/cam/../scsi/scsi_da.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pass.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pt.c /usr/src/sys/bus/cam/cam/../scsi/scsi_sa.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ses.c /usr/src/sys/bus/cam/cam/../scsi/scsi_targ_bh.c /usr/src/sys/bus/cam/cam/../scsi/scsi_target.c
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/obj/usr/src/world_i386/usr/include: No such file or directory
compilation terminated.
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/obj/usr/src/world_i386/usr/include: No such file or directory
compilation terminated.
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/obj/usr/src/world_i386/usr/include: No such file or directory
compilation terminated.
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/obj/usr/src/world_i386/usr/include: No such file or directory
compilation terminated.

...

cc1: fatal error: /usr/obj/usr/src/world_i386/usr/include: No such file or directory
compilation terminated.
mkdep: compile failed
*** Error code 1

Stop.
make: stopped in /usr/src/sys/bus/cam/cam
*** Error code 1

Stop.
make: stopped in /usr/src/sys/bus/cam
*** Error code 1

Stop.
make: stopped in /usr/src/sys/bus
*** Error code 1

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

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

Stop.
make: stopped in /usr/src
.CURDIR='/usr/src'
.OBJDIR='/usr/obj/usr/src'
.MAKE='make'
MAKE_VERSION='20121010'
LD_LIBRARY_PATH=''
MACHINE_ARCH='i386'
MACHINE='i386'
MAKEFILE='/usr/src/Makefile.inc1'
.TARGETS='buildkernel'
.ERROR_TARGET='buildkernel'
.ERROR_META_FILE=''
.MAKE.LEVEL='1'
.MAKE.MODE=''
*** Error code 1

History

#1 Updated by yellowrabbit2010 over 1 year ago

Same for x86_64:

gcc44 works, gcc47 shows interesting COLLECT_GCC_OPTIONS and can't construct correct search list.

*** gcc44 ***
/usr/obj/usr/src/sys/X86_64_GENERIC/usr/src/sys/bus/cam/cam $ CCVER=gcc44 MKDEP_CPP_OPTS="-M -v" mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I. -I@ -I/usr/obj/usr/src/sys/X86_64_GENERIC -I/usr/obj/usr/src/sys/X86_64_GENERIC/include -I@/../include -I/usr/obj/usr/src/world_x86_64/usr/include -std=c99 -std=gnu99 -std=c99 /usr/src/sys/bus/cam/cam/../cam.c /usr/src/sys/bus/cam/cam/../cam_periph.c /usr/src/sys/bus/cam/cam/../cam_queue.c /usr/src/sys/bus/cam/cam/../cam_sim.c /usr/src/sys/bus/cam/cam/../cam_xpt.c /usr/src/sys/bus/cam/cam/../cam_extend.c /usr/src/sys/bus/cam/cam/../scsi/scsi_all.c /usr/src/sys/bus/cam/cam/../scsi/scsi_cd.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ch.c /usr/src/sys/bus/cam/cam/../scsi/scsi\
_da.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pass.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pt.c /usr/src/sys/bus/cam/cam/../scsi/scsi_sa.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ses.c /usr/src/sys/bus/cam/cam/../scsi/scsi_targ_bh.c /usr/src/sys/bus/cam/cam/../scsi/scsi_target.c
Using built-in specs.
Target: x86_64-pc-dragonflybsd
Configured with: DragonFly/x86_64 system compiler
Thread model: posix
gcc version 4.4.7 2012.03.13 (DragonFly)
COLLECT_GCC_OPTIONS='-E' '-M' '-v' '-nostdinc' '-D_KERNEL' '-DKLD_MODULE' '-I.' '-I@' '-I/usr/obj/usr/src/sys/X86_64_GENERIC' '-I/usr/obj/usr/src/sys/X86_64_GENERIC/include' '-I@/../include' '-I/usr/obj/usr/src/world_x86_64/usr/include' '-std=c99' '-std=gnu99' '-std=c99'
/usr/libexec/gcc44/cc1 -E -quiet -nostdinc -v -I. -I@ -I/usr/obj/usr/src/sys/X86_64_GENERIC -I/usr/obj/usr/src/sys/X86_64_GENERIC/include -I@/../include -I/usr/obj/usr/src/world_x86_64/usr/include -M -D_KERNEL -DKLD_MODULE /usr/src/sys/bus/cam/cam/../cam.c -std=c99 -std=gnu99 -std=c99
#include "..." search starts here:
#include <...> search starts here:
.
@
/usr/obj/usr/src/sys/X86_64_GENERIC
/usr/obj/usr/src/sys/X86_64_GENERIC/include
@/../include
/usr/obj/usr/src/world_x86_64/usr/include
End of search list.
.....

*** gcc47 ***
/usr/obj/usr/src/sys/X86_64_GENERIC/usr/src/sys/bus/cam/cam $ CCVER=gcc47 MKDEP_CPP_OPTS="-M -v" mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I. -I@ -I/usr/obj/usr/src/sys/X86_64_GENERIC -I/usr/obj/usr/src/sys/X86_64_GENERIC/include -I@/../include -I/usr/obj/usr/src/world_x86_64/usr/include -std=c99 -std=gnu99 -std=c99 /usr/src/sys/bus/cam/cam/../cam.c /usr/src/sys/bus/cam/cam/../cam_periph.c /usr/src/sys/bus/cam/cam/../cam_queue.c /usr/src/sys/bus/cam/cam/../cam_sim.c /usr/src/sys/bus/cam/cam/../cam_xpt.c /usr/src/sys/bus/cam/cam/../cam_extend.c /usr/src/sys/bus/cam/cam/../scsi/scsi_all.c /usr/src/sys/bus/cam/cam/../scsi/scsi_cd.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ch.c /usr/src/sys/bus/cam/cam/../scsi/scsi_da.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pass.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pt.c /usr/src/sys/bus/cam/cam/../scsi/scsi_sa.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ses.c /usr/src/sys/bus/cam/cam/../scsi/scsi_targ_bh.c /usr/src/sys/bus/cam/cam/../scsi/scsi_target.c
Using built-in specs.
COLLECT_GCC=/usr/libexec/gcc47/cc
Target: x86_64-pc-dragonflybsd
Configured with: DragonFly/x86_64 system compiler (c, c++, objc, LTO)
Thread model: posix
gcc version 4.7.2 [DragonFly] Release/2012-09-20
COLLECT_GCC_OPTIONS='-E' '-M' '-v' '-nostdinc' '-D' '_KERNEL' '-D' 'KLD_MODULE' '-I' '.' '-I' '@' '-I' '/usr/obj/usr/src/sys/X86_64_GENERIC' '-I' '/usr/obj/usr/src/sys/X86_64_GENERIC/include' '-I' '@/../include' '-I' '/usr/obj/usr/src/world_x86_64/usr/include' '-std=c99' '-std=gnu99' '-std=c99'
/usr/libexec/gcc47/cc1 -E -quiet -nostdinc -v -I . -I @ -I /usr/obj/usr/src/sys/X86_64_GENERIC -I /usr/obj/usr/src/sys/X86_64_GENERIC/include -I @/../include -I /usr/obj/usr/src/world_x86_64/usr/include -M -D _KERNEL -D KLD_MODULE /usr/src/sys/bus/cam/cam/../cam.c -std=c99 -std=gnu99 -std=c99
ignoring nonexistent directory "-I"
#include "..." search starts here:
#include <...> search starts here:
.
@
/usr/obj/usr/src/sys/X86_64_GENERIC
/usr/obj/usr/src/sys/X86_64_GENERIC/include
End of search list.
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/obj/usr/src/world_x86_64/usr/include: No such file or directory
compilation terminated.

#2 Updated by swildner over 1 year ago

On Mon, 04 Feb 2013 08:12:36 +0100, David Shao via Redmine
<> wrote:

>
> Issue #2505 has been reported by davshao.
>
> ----------------------------------------
> Bug #2505: i386 buildkernel cc1: error: too many filenames given
> /usr/obj/usr/src/world_i386/usr/include: No such file or directory
> http://bugs.dragonflybsd.org/issues/2505
>
> Author: davshao
> Status: New
> Priority: Normal
> Assignee:
> Category:
> Target version:
>
>
> On a i386 build updating from
>
> commit e2a099cf1b1188b60aecc18de449444f7dca0f6a
> Date: Fri Feb 1 13:47:37 2013 -0800
>
> kernel - Fix kernel panic caused by rename race
>
> to
>
> commit 6de060a4493ce25dda4287f3ab00041b698ba2b8
> Date: Sun Feb 3 13:32:01 2013 +0100
>
> Unbreak world with NO_GCC44
>
> with /etc/make.conf
>
> CFLAGS+=-g
> STRIP=

A shorter way for this is to just set

DEBUG_FLAGS=-g

in make.conf (the STRIP isn't needed in this case).

S.

#3 Updated by yellowrabbit2010 over 1 year ago

May be there is a problem with ``response files'' thing? Like, if you pass "@file" as an argument to a program, the file is read, and the contents are treated as command-line options?

Then '-I@/../include -I/usr/obj/usr/src/world_x86_64/usr/include' is Ok,
but '-I' '@/../include -I/usr/obj/usr/src/world_x86_64/usr/include' is terribly wrong.

Can we throw away '-Isomething' -> '-I' 'something' conversion somehow?

#4 Updated by davshao over 1 year ago

Right now I am building world with defaults and setting CCVER=gcc44 for buildkernel

# make buildworld
# make CCVER=gcc44 buildkernel

Is there going to be some problem with the kernel being built with gcc44 separately?

Does all of userspace need to be rebuilt with the switch to gcc47 as the default, in particular, all of pkgsrc? See

http://bugs.dragonflybsd.org/issues/2511

for an example of problems I am experiencing.

#5 Updated by ftigeot over 1 year ago

I also see the same errors with buildkernel

Strangely, make nativekernel succeeds with the same src/ tree

#6 Updated by ftigeot over 1 year ago

I have rebuilt gcc47 with an additional fprintf() line

gcc apparently tries to compile /usr/include:

mkdep -f .depend -a -nostdinc -D_KERNEL -DKLD_MODULE -I. -I@ -I/usr/obj/usr/src/sys/X86_64_GENERIC -I/usr/obj/usr/src/sys/X86_64_GENERIC/include -I@/../include -I/usr/include -std=c99 -std=gnu99 -std=c99 /usr/src/sys/bus/cam/cam/../cam.c /usr/src/sys/bus/cam/cam/../cam_periph.c /usr/src/sys/bus/cam/cam/../cam_queue.c /usr/src/sys/bus/cam/cam/../cam_sim.c /usr/src/sys/bus/cam/cam/../cam_xpt.c /usr/src/sys/bus/cam/cam/../cam_extend.c /usr/src/sys/bus/cam/cam/../scsi/scsi_all.c /usr/src/sys/bus/cam/cam/../scsi/scsi_cd.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ch.c /usr/src/sys/bus/cam/cam/../scsi/scsi_da.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pass.c /usr/src/sys/bus/cam/cam/../scsi/scsi_pt.c /usr/src/sys/bus/cam/cam/../scsi/scsi_sa.c /usr/src/sys/bus/cam/cam/../scsi/scsi_ses.c /usr/src/sys/bus/cam/cam/../scsi/scsi_targ_bh.c /usr/src/sys/bus/cam/cam/../scsi/scsi_target.c
add_input_filename(): /usr/include
add_input_filename(): /usr/src/sys/bus/cam/cam/../cam.c
cc1: error: too many filenames given. Type cc1 --help for usage
cc1: fatal error: /usr/include: No such file or directory
compilation terminated.

#7 Updated by yellowrabbit2010 over 1 year ago

It tries to compile /usr/include porpably because of this conversion:
1. -I@/../include -I/usr/include
2. '-I' '@/../include' '-I' '/usr/include'
3. '-I' '-I' '/usr/include'
4. ignore '-I' '-I' (it seems like -I with ivalid include dir '-I')
5. '/usr/include'

#8 Updated by yellowrabbit2010 over 1 year ago

What happens if GCC try use @some-dir-name as ``response file''?
Filesystem matters.

Simple test:

===== test-resp.c =====
#include <stdio.h>

int
main(int argc, char *argv[])
{
FILE *f;
char str[200];

f = fopen("dir", "r");
if (!f) {
printf("Cannot open.\n");
return(1);
}

if (!fgets(str, sizeof(str), f)) {
printf("NULL read.\n");
return(1);
}
printf("Read is OK.\n");
printf("'%s'\n", str);
fclose(f);
return(0);
}

===== HAMMER =====
# cc -o test-resp test-resp.c
# mkdir dir
# touch dir/file-0
# ./test-resp
NULL read.
#

===== NFS =====
# mount -t nfs 192.168.3.1:/var/xchg /mnt/xchg
# cpdup ./ /mnt/xchg/test-resp
# cd /mnt/xchg/test-resp
# ./test-resp
Read is OK.
'<some garbage>'
#

#9 Updated by ftigeot over 1 year ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I could complete a buildworld+buildkernel sequence in a chroot on a machine where I can't buildkernel in /usr/src without encountering this issue.

I mounted /usr/src in the chroot using a nullfs mount.

It is very likely this gcc47 bug is caused by something present in the world environment.

#10 Updated by ftigeot over 1 year ago

  • % Done changed from 10 to 50

Old files present in /usr/include were likely the reason make buildkernel failed on my machines.

I was able to complete a whole buildworld+kernel sequence with gcc47 after having nuked /usr/include.

#11 Updated by davshao over 1 year ago

Can I have specific instructions how to replace /usr/include?

I have tried
# make buildworld
moving /usr/include to /usr/include.old
# make installworld

and rebooting, but
# make buildkernel
still fails in the same way.

The old files diff-ing /usr/include.old and /usr/include were some meteor files and an ata.h.

#12 Updated by ftigeot over 1 year ago

> Can I have specific instructions how to replace /usr/include?
>
> I have tried
> # make buildworld
> moving /usr/include to /usr/include.old
> # make installworld

This is exactly what I did.
It obviously wasn't enough to fix all machines.

I had a few different files:
stdlib.h.gch
sys/bitstring.h
gelf.h
libelf.h

Can you try building world+kernel in a brand new chroot and see if this makes a difference ?

mkdir /chroot
cd /usr/src && make installworld DESTDIR=/chroot
cd /usr/src/etc && make distribution DESTDIR=/chroot
mount -t null /dev /chroot/dev
mount -t null /usr/src /chroot/usr/src
chroot /chroot

should be enough to give you a clean environment

#13 Updated by yellowrabbit2010 over 1 year ago

I was able to build kernel with gcc47 after rm -rf /include. Why /include ?

=== /usr/src/contrib/gcc-4.7/libiberty/argv.c ==
void
expandargv (int *argcp, char ***argvp)
{
...
size_t file_argc;
/* We are only interested in options of the form "@file". */
filename = (*argvp)[i];
if (filename[0] != '@')
continue;
...
/* Read the contents of the file. */
f = fopen (++filename, "r");
if (!f)
continue;
...
===

So:
-I @/../include --> try open /../include --> try open /include.

#14 Updated by davshao over 1 year ago

THANK YOU for taking so much time and effort to track down a solution to this problem. I have been able to successfully update multiple x86_64 and i386 machines to now use gcc 4.7 as the default compiler for both world and kernel.

Also available in: Atom PDF