Skip to content

Compilation error multiple definition #5

@ckastall

Description

@ckastall

Hi,

I've been trying to compile snppit under linux (gcc 12.2.0) by running Compile_snppit.sh.

This failed with these errors:

src/pbt_C_fb.c: In function ‘ForwardStep’:
src/pbt_C_fb.c:250:48: warning: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  250 |                 ret->FB[t] = (struct fb_cell *)calloc(ret->Kt[t], sizeof(struct fb_cell));
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/pbt_C_fb.c:4:
/usr/include/stdlib.h:556:14: note: in a call to allocation function ‘calloc’ declared here
  556 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
/usr/bin/ld: /tmp/ccUQCvT1.o:(.bss+0x0): multiple definition of `gHasSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccUQCvT1.o:(.bss+0x20): multiple definition of `gSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccJt2mTE.o:(.bss+0x0): multiple definition of `gHasSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccJt2mTE.o:(.bss+0x20): multiple definition of `gSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccNp1FIn.o:(.bss+0x0): multiple definition of `gHasSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccNp1FIn.o:(.bss+0x20): multiple definition of `gSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccbyE1VZ.o:(.bss+0x0): multiple definition of `gHasSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccbyE1VZ.o:(.bss+0x20): multiple definition of `gSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccC37iJn.o:(.bss+0x64): multiple definition of `gHasSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccC37iJn.o:(.bss+0x80): multiple definition of `gSnpSumPedPath'; /tmp/ccNqPloF.o:(.bss+0x20): first defined here
collect2: error: ld returned 1 exit status

My fix was to add the flag "-fcommon" to the gcc command, and it now compiles successfully. I've ran the tests, and they almost all pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions