-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Recently when I'm trying to compile CGMiner following instructions on Ubuntu linix. i run into the following linker erros:
/usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of bitmain_soc_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here /usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of sp30_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here
/usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of sp10_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here /usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of minion_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here
/usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of knc_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here /usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of klondike_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here
/usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of icarus_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here /usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of hashratio_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here
/usr/bin/ld: cgminer-util.o:/root/cgminer/miner.h:287: multiple definition of `drillbit_drv'; cgminer-cgminer.o:/root/cgminer/./miner.h:287: first defined here
......
I found the reason is the driver struct list is defined in miner.h which is included by many c files.
So, I try to resolve this problem by two steps:
1.mask the following line in miner.h
/* Use DRIVER_PARSE_COMMANDS to generate extern device_drv prototypes*/
//DRIVER_PARSE_COMMANDS(DRIVER_PROTOTYPE)
2.add the masked line in the beginning of cgminer.c, after miner.h is included
DRIVER_PARSE_COMMANDS(DRIVER_PROTOTYPE)
I hope this answer is useful.