编译 内核 2.6.0 出错问题

220 views
Skip to first unread message

赖伟峰

unread,
Mar 1, 2018, 7:42:26 AM3/1/18
to 西邮Linux兴趣小组
我的环境 : Visual-box 5.2,Ubuntu  14.04,gcc 4.8.2
make menuconfig 时用了默认配置,选择 Save Configuration to an Alternate File  后 EXIT,进行下一步 make/make bzImage 时有如下报错:

/*******************************************************
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  SYMLINK include/asm -> include/asm-x86_64
  HOSTCC  scripts/split-include
scripts/split-include.c: In function ‘main’:
scripts/split-include.c:133:11: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
      fgets(old_line, buffer_size, fp_target);
           ^
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/docproc
  HOSTCC  scripts/kallsyms
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:43:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
    fgets(str, 500, in);
         ^
  CC      scripts/empty.o
  HOSTCC  scripts/mk_elfconfig
  MKELF   scripts/elfconfig.h
  HOSTCC  scripts/file2alias.o
  HOSTCC  scripts/modpost.o
  HOSTLD  scripts/modpost
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/bin2c
  SPLIT   include/linux/autoconf.h -> include/config/*
  CC      arch/x86_64/kernel/asm-offsets.s
In file included from include/linux/spinlock.h:16:0,
                 from include/linux/capability.h:45,
                 from include/linux/sched.h:7,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/processor.h:80:26: error: array type has incomplete element type
 extern struct tss_struct init_tss[NR_CPUS];
                          ^
In file included from include/asm/smp.h:18:0,
                 from include/linux/smp.h:17,
                 from include/linux/sched.h:23,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/mpspec.h:79:2: warning: ‘packed’ attribute ignored for field of type ‘unsigned char[6]’ [-Wattributes]
  unsigned char mpc_bustype[6] __attribute((packed));
  ^
In file included from include/asm/processor.h:19:0,
                 from include/linux/spinlock.h:16,
                 from include/linux/capability.h:45,
                 from include/linux/sched.h:7,
                 from arch/x86_64/kernel/asm-offsets.c:7:
include/asm/apic.h: In function ‘apic_write_atomic’:
include/asm/system.h:185:22: warning: value computed is not used [-Wunused-value]
 #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
                      ^
include/asm/apic.h:33:2: note: in expansion of macro ‘xchg’
  xchg((volatile unsigned int *)(APIC_BASE+reg), v);
  ^
make[1]: *** [arch/x86_64/kernel/asm-offsets.s] 错误 1
make: *** [arch/x86_64/kernel/asm-offsets.s] 错误 2

*******************************************************/

请问该怎么解决呢?

孙郭程港

unread,
Nov 22, 2018, 4:30:36 AM11/22/18
to 西邮Linux兴趣小组

include/asm/processor.h:80:26: error: array type has incomplete element type

字面意思去理解就是,数组元素的类型不完全。

写Makefile时报了这个错误,发现原来在主函数中包含某个头文件,这个头文件引用了其它文件的一个结构体,而这个结构体还没有声明!(原答案地址:https://blog.csdn.net/suer0101/article/details/7616960

建议看下 processor.h 文件

本人不才,如回答有误还望谅解。


在 2018年3月1日星期四 UTC+8下午8:42:26,赖伟峰写道:
Reply all
Reply to author
Forward
0 new messages