![cc1:编译 FreeBSD 8.2 版本时警告被视为错误](https://linux22.com/image/34367/cc1%EF%BC%9A%E7%BC%96%E8%AF%91%20FreeBSD%208.2%20%E7%89%88%E6%9C%AC%E6%97%B6%E8%AD%A6%E5%91%8A%E8%A2%AB%E8%A7%86%E4%B8%BA%E9%94%99%E8%AF%AF.png)
我正在尝试编译 FreeBsd 8.2 RELEASE 内核
# uname -a
FreeBSD 8.2-RELEASE FreeBSD 8.2-RELEASE #2: Sun May 18 00:07:10 PDT 2014
构建内核
# pwd
/usr/src
# make buildkernel
...它编译直到我收到此错误...
MAKE=make sh /usr/src/sys/conf/newvers.sh GENERIC
cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -Werror vers.c
linking kernel.debug
text data bss dec hex filename
9336435 915392 672984 10924811 a6b30b kernel.debug
objcopy --only-keep-debug kernel.debug kernel.symbols
objcopy --strip-debug --add-gnu-debuglink=kernel.symbols kernel.debug kernel
cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=/usr/obj/usr/src/sys/GENERIC/modules KMODDIR=/boot/kernel MODULES_OVERRIDE="usb/run" DEBUG_FLAGS="-g" MACHINE=i386 KERNBUILDDIR="/usr/obj/usr/src/sys/GENERIC" SYSDIR="/usr/src/sys" make all
===> usb/run (all)
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -g -I/usr/obj/usr/src/sys/GENERIC -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c /usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:150: error: 'USB_PRODUCT_CISCOLINKSYS_AE1000' undeclared here (not in a function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_vap_delete':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:861: error: 'struct run_vap' has no member named 'beacon_mbuf'
cc1: warnings being treated as errors
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:861: warning: passing argument 1 of 'm_freem' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:862: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:862: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_newstate':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1809: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1809: warning: passing argument 1 of 'm_freem' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1810: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:1810: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_set':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2106: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2106: warning: passing argument 1 of 'atomic_load_acq_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_delete_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2166: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2166: warning: passing argument 1 of 'atomic_clear_barr_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_key_delete':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2181: error: 'struct run_softc' has no member named 'cmdq_key_del'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2181: warning: passing argument 1 of 'atomic_set_barr_int' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_drain_fifo':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2284: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2284: warning: assignment from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: 'RUN_TXCNT' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: (Each undeclared identifier is reported only once
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: for each function it appears in.)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: error: lvalue required as increment operand
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2285: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: 'RUN_SUCCESS' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: error: lvalue required as increment operand
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2287: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2298: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2298: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: error: 'RUN_RETRY' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2299: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_iter_func':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2315: error: array type has incomplete element type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2324: warning: cast discards qualifiers from pointer target type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2325: warning: passing argument 4 of 'run_read_region_1' makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2330: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: error: 'struct usb_device_id' has no member named 'tx'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: error: request for member 'retry' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2332: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: error: 'struct usb_device_id' has no member named 'tx'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: error: request for member 'success' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2333: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2334: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: error: 'struct usb_device_id' has no member named 'error'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: error: request for member 'fail' in something not a structure or union
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2336: warning: cast from pointer to integer of different size
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2339: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2339: warning: assignment from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2341: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2341: warning: comparison of distinct pointer types lacks a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2342: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2342: warning: comparison of distinct pointer types lacks a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: error: 'RUN_TXCNT' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2345: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: error: 'RUN_SUCCESS' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2346: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: error: 'RUN_RETRY' undeclared (first use in this function)
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: error: array subscript is not an integer
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2347: warning: assignment makes integer from pointer without a cast
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2315: warning: unused variable 'sta'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_newassoc_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: error: 'struct run_softc' has no member named 'wcid_stats'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:2378: warning: passing argument 1 of 'memset' discards qualifiers from pointer target type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_update_beacon':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:3990: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:3990: warning: passing argument 3 of 'ieee80211_beacon_update' from incompatible pointer type
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c: In function 'run_update_beacon_cb':
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4019: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4020: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4021: warning: statement with no effect
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4022: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4025: error: 'struct run_vap' has no member named 'beacon_mbuf'
/usr/src/sys/modules/usb/run/../../../dev/usb/wlan/if_run.c:4025: warning: assignment from incompatible pointer type
*** Error code 1
Stop in /usr/src/sys/modules/usb/run.
*** Error code 1
Stop in /usr/src/sys/modules.
*** Error code 1
Stop in /usr/obj/usr/src/sys/GENERIC.
*** Error code 1
Stop in /usr/src.
*** Error code 1
Stop in /usr/src.
我不确定如何评估此错误消息并修复它。
有推荐的方向吗?
在另一台虚拟机上尝试更新
收到类似的错误消息
cc -static -o rescue rescue.o cat.lo chflags.lo chio.lo chmod.lo cp.lo date.lo dd.lo df.lo echo.lo ed.lo expr.lo getfacl.lo hostname.lo kenv.lo kill.lo ln.lo ls.lo mkdir.lo mv.lo pkill.lo ps.lo pwd.lo realpath.lo rm.lo rmdir.lo setfacl.lo sh.lo stty.lo sync.lo test.lo rcp.lo csh.lo atacontrol.lo badsect.lo camcontrol.lo ccdconfig.lo clri.lo devfs.lo dmesg.lo dump.lo dumpfs.lo dumpon.lo fsck.lo fsck_ffs.lo fsck_msdosfs.lo fsdb.lo fsirand.lo gbde.lo geom.lo ifconfig.lo init.lo kldconfig.lo kldload.lo kldstat.lo kldunload.lo ldconfig.lo md5.lo mdconfig.lo mdmfs.lo mknod.lo mount.lo mount_cd9660.lo mount_msdosfs.lo mount_nfs.lo mount_ntfs.lo mount_nullfs.lo mount_udf.lo mount_unionfs.lo newfs.lo newfs_msdos.lo nos-tun.lo ping.lo reboot.lo restore.lo rcorder.lo route.lo routed.lo rtquery.lo rtsol.lo savecore.lo spppcontrol.lo swapon.lo sysctl.lo tunefs.lo umount.lo atmconfig.lo ping6.lo ipf.lo zfs.lo zpool.lo bsdlabel.lo sconfig.lo fdisk.lo dhclient.lo head.lo mt.lo sed.lo tail.lo tee.lo gzip.lo bzip2.lo xz.lo tar.lo vi.lo id.lo chroot.lo chown.lo /usr/src/rescue/rescue/../librescue/exec.o /usr/src/rescue/rescue/../librescue/getusershell.o /usr/src/rescue/rescue/../librescue/login_class.o /usr/src/rescue/rescue/../librescue/popen.o /usr/src/rescue/rescue/../librescue/rcmdsh.o /usr/src/rescue/rescue/../librescue/sysctl.o /usr/src/rescue/rescue/../librescue/system.o -lcrypt -ledit -lkvm -ll -ltermcap -lutil -lalias -lcam -lcurses -ldevstat -lipsec -lipx -lzfs -lnvpair -luutil -lavl -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz -lbz2 -llzma -larchive -lcrypto -lm
csh.lo(.text+0xdba6): In function `nlsclose':
: undefined reference to `dl_iconv_close'
csh.lo(.text+0xdd21): In function `nlsinit':
: undefined reference to `dl_iconv_open'
csh.lo(.text+0xde1c): In function `iconv_catgets':
: undefined reference to `dl_iconv'
*** Error code 1
Stop in /usr/src/rescue/rescue.
*** Error code 1
Stop in /usr/src/rescue/rescue.
*** Error code 1
Stop in /usr/src/rescue.
*** Error code 1
Stop in /usr/src.
*** Error code 1
Stop in /usr/src.
答案1
在这两种情况下,这些主要都不是破坏构建的警告。
对于内核编译:
error: 'struct run_vap' has no member named 'beacon_mbuf'
编译器告诉您,代码正在尝试访问不存在的东西。这可能有很多原因,但通常表明代码已损坏。也许您正在尝试编译一个依赖于较新/较旧的内部内核 API 的模块(即使用与内核其余部分不同的结构定义)。
warning: passing argument 1 of 'm_freem' from incompatible pointer type
通常要么是编程错误(即确实传递了除预期之外的其他内容作为参数),要么是缺少强制转换运算符。
cc1: warnings being treated as errors
是由-Werror
编译器标志引起的,它告诉编译器将警告视为错误。实际上,这通常是一个好主意TM(主要是因为经常遇到 -“但是它编译了,只有一些警告”态度)。
对于另一个问题:
csh.lo(.text+0xdba6): In function `nlsclose':
: undefined reference to `dl_iconv_close'
实际上是来自链接器的错误 - 编译(或多或少)进行得很好,但您没有提供提供代码引用的一些符号的外部库。当您正确地#include
设置头文件,然后忘记告诉链接器实际链接到该库(通常是-l
选项)时,通常会发生这种情况。