Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 696946 - app-misc/mosquitto-1.6.7 - ld: error: pub_shared.o: multiple definition of 'cfg'
Summary: app-misc/mosquitto-1.6.7 - ld: error: pub_shared.o: multiple definition of 'cfg'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Rage <oxr463>
URL: https://github.com/eclipse/mosquitto/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-08 08:57 UTC by jveber
Modified: 2019-12-20 21:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,49.88 KB, text/plain)
2019-10-08 08:57 UTC, jveber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jveber 2019-10-08 08:57:17 UTC
Created attachment 592122 [details]
build.log

It seems like a bug in the source as "pub_shared.o" contains "cfg" definition, and "rr_client.o" contains it as well.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-10-08 13:06:36 UTC
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/8.3.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: error: pub_shared.o: multiple definition of 'cfg'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/8.3.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: rr_client.o: previous definition here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:39: mosquitto_rr] Error 1
Comment 2 jveber 2019-10-08 13:11:40 UTC
Found out that it's caused by switch "-fno-common" in my make.conf.


-fno-common

    In C code, this option controls the placement of global variables defined without an initializer, known as tentative definitions in the C standard. Tentative definitions are distinct from declarations of a variable with the extern keyword, which do not allocate storage.

    Unix C compilers have traditionally allocated storage for uninitialized global variables in a common block. This allows the linker to resolve all tentative definitions of the same variable in different compilation units to the same object, or to a non-tentative definition. This is the behavior specified by -fcommon, and is the default for GCC on most targets. On the other hand, this behavior is not required by ISO C, and on some targets may carry a speed or code size penalty on variable references.

    The -fno-common option specifies that the compiler should instead place uninitialized global variables in the BSS section of the object file. This inhibits the merging of tentative definitions by the linker so you get a multiple-definition error if the same variable is defined in more than one compilation unit. Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
Comment 3 Matt Turner gentoo-dev 2019-10-08 18:51:14 UTC
I doubt we're going to fix something like this in Gentoo. My advice would be to file an issue at https://github.com/eclipse/mosquitto

I expect the solution is to add an 'extern' keyword somewhere.
Comment 4 jveber 2019-10-09 11:06:49 UTC
Agreed, already posted issue on Github. You're right there must be 'extern' in rr_client.c on line 50 before the definition of 'cfg'. Let's hope it'll be fixed in the next release.

You may close this issue.
Comment 5 Matt Turner gentoo-dev 2019-11-20 22:08:22 UTC
Thanks. Looks like this was fixed by

commit 8a4ae28fa926589e9891674ca4424dc703ad2d88
Author: Roger A. Light <roger@atchoo.org>
Date:   Wed Oct 9 14:01:44 2019 +0100

    Fix duplicate cfg definition in rr_client.
    
    Closes #1453. Thanks to jveber.

and will presumably be in v1.6.8.
Comment 6 Larry the Git Cow gentoo-dev 2019-12-20 21:59:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c16ad6e181ac72bc15ad81ff394e8d52858ba04

commit 7c16ad6e181ac72bc15ad81ff394e8d52858ba04
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2019-12-20 20:40:59 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2019-12-20 21:58:53 +0000

    app-misc/mosquitto: Version bump to 1.6.8
    
    Closes: https://bugs.gentoo.org/696946
    Closes: https://bugs.gentoo.org/700816
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 app-misc/mosquitto/Manifest               |   1 +
 app-misc/mosquitto/mosquitto-1.6.8.ebuild | 114 ++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+)