Bug 1794368 - owfs-3.2p3-3.fc31: FTBFS with gcc 10: owserver.h:21: multiple definition of `persistence_mutex'
Summary: owfs-3.2p3-3.fc31: FTBFS with gcc 10: owserver.h:21: multiple definition of `...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: owfs
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomasz Torcz
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks: F32FTBFS GCC10
TreeView+ depends on / blocked
 
Reported: 2020-01-23 12:25 UTC by Jitka Plesnikova
Modified: 2020-01-31 14:39 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-31 14:39:23 UTC
Type: Bug


Attachments (Terms of Use)

Description Jitka Plesnikova 2020-01-23 12:25:33 UTC
owfs-3.2p3-3.fc31 fails to build in F32:

/usr/bin/ld: from_client.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: multiple definition of `persistence_mutex'; owserver.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: first defined here
/usr/bin/ld: to_client.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: multiple definition of `persistence_mutex'; owserver.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: first defined here
/usr/bin/ld: /usr/bin/ld: read.o:from_client.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: multiple definition of `persistence_mutex'; /builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: multiple definition of `persistence_mutex'; owserver.o:/builddir/build/BUILD/owfs-3.2p3/module/owserver/src/c/../include/owserver.h:21: first defined here

A difference between passing and failing build root is at 
https://koschei.fedoraproject.org/build/7745907
This is probably triggered with an upgrade of gcc from 9.2.1-1.fc32.3 to 10.0.1-0.3.fc32.


Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/owfs

Comment 1 Tomasz Torcz 2020-01-25 18:21:44 UTC
What exactly is going on here? All "locations" points to exactly the same place: owserver.h:21

Comment 2 Petr Pisar 2020-01-27 14:35:42 UTC
When a header file is included into a source file, it becomes part of a compilation unit and the variable definition is put into BSS section of the object file. When a program is linked all definitions are collected from all object files. If there are multiple definitions of the the same-named variable, an error is raised because the linker does not know which definition is the right one. Linker does not have any information that would explain it that the two definitions are actually identical.

In other words, you cannot include the same header file (owserver.h) into more source files (from_client.c, owserver.c) and then link them into one program (owexternal) if the header file contains a variable definition (persistence_mutex).

A fix is changing the definition into a declaration in the header file and add the definition into one of the source files it fits better.

Comment 3 Tomasz Torcz 2020-01-29 19:39:37 UTC
I've fixed it with https://github.com/owfs/owfs/pull/52
Fix committed to owfs.spec, should be picked up by mass rebuild


Note You need to log in before you can comment on or make changes to this bug.