Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 641412

Summary: sys-boot/grub[netboot]:0: error: ld returned 1 exit status: multiple definition of ...
Product: Gentoo Linux Reporter: Thomas Deutschmann (RETIRED) <whissi>
Component: Current packagesAssignee: Ian Stakenvicius (RETIRED) <axs>
Status: RESOLVED WONTFIX    
Severity: normal CC: base-system, chain, herrtimson, luke, pacho, thomas
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 674364    
Bug Blocks:    

Description Thomas Deutschmann (RETIRED) gentoo-dev 2017-12-16 21:25:08 UTC
x86_64-pc-linux-gnu-gcc -m32 -Os -fno-stack-protector -fno-pie -fno-strict-aliasing -march=i686 -fno-reorder-functions -fno-builtin -nostdinc -I/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot -DSUPPORT_NETBOOT=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -DSUPPORT_GRAPHICS=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS2=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DFSYS_ISO9660=1 -DUSE_MD5_PASSWORDS=1 -DFSYS_TFTP=1 -g -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 -Wl,-O1 -Wl,--as-needed -no-pie -Wl,--build-id=none -o pre_stage2.exec pre_stage2_exec-asm.o pre_stage2_exec-bios.o pre_stage2_exec-boot.o pre_stage2_exec-builtins.o pre_stage2_exec-char_io.o pre_stage2_exec-cmdline.o pre_stage2_exec-common.o pre_stage2_exec-console.o pre_stage2_exec-disk_io.o pre_stage2_exec-fsys_ext2fs.o pre_stage2_exec-fsys_fat.o pre_stage2_exec-fsys_ffs.o pre_stage2_exec-fsys_iso9660.o pre_stage2_exec-fsys_jfs.o pre_stage2_exec-fsys_minix.o pre_stage2_exec-fsys_reiserfs.o pre_stage2_exec-fsys_ufs2.o pre_stage2_exec-fsys_vstafs.o pre_stage2_exec-fsys_xfs.o pre_stage2_exec-gunzip.o pre_stage2_exec-hercules.o pre_stage2_exec-md5.o pre_stage2_exec-serial.o pre_stage2_exec-smp-imps.o pre_stage2_exec-stage2.o pre_stage2_exec-terminfo.o pre_stage2_exec-tparm.o pre_stage2_exec-graphics.o ../netboot/libdrivers.a 
pre_stage2_exec-disk_io.o: In function `__inb':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: multiple definition of `__inb'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: first defined here
pre_stage2_exec-disk_io.o: In function `__inbc':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: multiple definition of `__inbc'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: first defined here
pre_stage2_exec-disk_io.o: In function `__inb_p':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: multiple definition of `__inb_p'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: first defined here
pre_stage2_exec-disk_io.o: In function `__inbc_p':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: multiple definition of `__inbc_p'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:106: first defined here
pre_stage2_exec-disk_io.o: In function `__inw':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:107: multiple definition of `__inw'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:107: first defined here
pre_stage2_exec-disk_io.o: In function `__inwc':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:115: multiple definition of `insw'
pre_stage2_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:115: first defined here
../netboot/libdrivers.a(libdrivers_a-fsys_tftp.o): In function `insl':
[...]
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:115: multiple definition of `insw'
diskless_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:115: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `insl':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:116: multiple definition of `insl'
diskless_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:116: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `outsb':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:118: multiple definition of `outsb'
diskless_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:118: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `outsw':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:119: multiple definition of `outsw'
diskless_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:119: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `outsl':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:120: multiple definition of `outsl'
diskless_exec-builtins.o:/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/linux-asm-io.h:120: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `timer2_running':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/timer.h:53: multiple definition of `timer2_running'
../netboot/libdrivers.a(3c509.o):/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/timer.h:53: first defined here
../netboot/libdrivers.a(libdrivers_a-timer.o): In function `waiton_timer2':
/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/timer.h:58: multiple definition of `waiton_timer2'
../netboot/libdrivers.a(3c509.o):/var/tmp/portage/sys-boot/grub-0.97-r18/work/grub-0.97/netboot/timer.h:58: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1050: diskless.exec] Error 1

See https://bugs.gentoo.org/608460#c24 for build.log.
Comment 1 Ian Stakenvicius (RETIRED) gentoo-dev 2018-01-15 21:13:55 UTC
... this is being caused by a change in how the preprocessor macros are handling the code.  I *think*, instead of the macros being expanded once, they seem to be expanded in every source object that #include's the header; hence why there's suddenly a lot of multiple-definitions.  

I don't know enough about macro expansion (or rather, changes between gcc5 and gcc6 to how macro expansion is occurring) to know how to deal with this properly.

Options?  Drop the use flag?
Comment 2 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-02-08 15:23:07 UTC
grub:0 is gone