Skip to content

I found a problem when compile cgminer #15

@xiangxj05

Description

@xiangxj05

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions