[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Something for our Advent calendar (Was: Bug#976254: rnahybrid: Does not build from source "multiple definition of")



Hi,

That is a common problem with legacy code being compiled with gcc-10, since it defaults to "-fno-common". It can be solved for legacy packages by passing "CFLAGS=-fcommon" to the `configure` (e.g `./configure CFLAGS=-fcommon`), then `make` will succeed.
More information from https://gcc.gnu.org/gcc-10/porting_to.html:

> Default to -fno-common
> A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker
> error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. If tentative definitions of particular variables need to be placed in a common block, __attribute__((__common__)) can be used to force
> that behavior even in code compiled without -fcommon. As a workaround, legacy C code where all tentative definitions should be placed into a common block can be compiled with -fcommon.

Regards,
Hamid Nassiby





On Wed, Dec 2, 2020 at 12:51 PM Andreas Tille <andreas@an3as.eu> wrote:
Control: tags -1 help

Hi,

no idea why this was not catched in the usual gcc-10 rebuilds.  Any volunteer?

Kind regards

     Andreas.

On Wed, Dec 02, 2020 at 12:08:32AM +0100, Andreas Tille wrote:
> Source: rnahybrid
> Severity: serious
> Tags: ftbfs
> Justification: FTBFS
>
> Hi,
>
> I tried to rebuild the package but the build ends in:
>
> ...
> gcc -g -O2 -fdebug-prefix-map=/build/rnahybrid-2.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -fdebug-prefix-map=/build/rnahybrid-2.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wl,-z,now -Wl,-z,relro -Wl,-z,now -o RNAeffective rnaeffective.o hybrid_core.o numerical.o energy.o input.o fasta.o random.o mt19937-1.o plot.o  -lg2 -lm
> /usr/bin/ld: /usr/bin/ld: /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:13: multiple definition of `x'; rnahybrid.o:./src/hybrid_core.h:13: first defined here
> hybrid_core.o:./src/hybrid_core.h:/usr/bin/ld: hybrid_core.o13: multiple definition of `x'; :./src/hybrid_core.h:15: multiple definition of `y'; rnahybrid.o:./src/hybrid_core.h:15: first defined herehybrid_core.o
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r1'; rnahybrid.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r2'; rnahybrid.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r3'; rnahybrid.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:13:./src/hybrid_core.h:28: multiple definition of `r4'; rnahybrid.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o: multiple definition of `x'; :./src/hybrid_core.h:30: multiple definition of `a1'; rnahybrid.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a2'; rnahybrid.o:./src/hybrid_core.h:30: first defined herernaeffective.o:./src/hybrid_core.h:13: first defined here
> /usr/bin/ld: hybrid_core.o
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a3'; rnahybrid.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a4'; rnahybrid.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a5'; rnahybrid.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a6'; rnahybrid.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld:./src/hybrid_core.h:15: multiple definition of `y'; rnaeffective.o:./src/hybrid_core.h:15: first defined here
> /usr/bin/ld: hybrid_core.o: hybrid_core.o:./src/hybrid_core.h:23: multiple definition of `helix_start'; rnahybrid.o:./src/hybrid_core.h:23: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:23: multiple definition of `helix_end'; rnahybrid.o:./src/hybrid_core.h:23: first defined here
> /usr/bin/ld: hybrid_core.o:./src/energy.h:50: multiple definition of `canPair'; rnahybrid.o:./src/energy.h:50: first defined here
> /usr/bin/ld:./src/hybrid_core.h:28: multiple definition of `r1'; rnaeffective.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r2'; rnaeffective.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r3'; rnaeffective.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:28: multiple definition of `r4'; rnaeffective.o:./src/hybrid_core.h:28: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a1'; rnaeffective.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: hybrid_core.o:./src/hybrid_core.h:30: multiple definition of `a2'; rnaeffective.o:./src/hybrid_core.h:30: first defined here
> /usr/bin/ld: rnacalibrate.ohybrid_core.o::./src/hybrid_core.h:./src/hybrid_core.h:3013: multiple definition of `: first defined herea3'
> ...
>
> Kind regards
>
>       Andreas.
>
>
> -- System Information:
> Debian Release: bullseye/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (500, 'testing'), (50, 'buildd-unstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 5.9.0-3-amd64 (SMP w/4 CPU threads)
> Kernel taint flags: TAINT_WARN
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> _______________________________________________
> Debian-med-packaging mailing list
> Debian-med-packaging@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-packaging

--
http://fam-tille.de


Reply to: