mraa icon indicating copy to clipboard operation
mraa copied to clipboard

linking fails on Dragonboard 410c with multiple definitions

Open jpelletier opened this issue 5 years ago • 6 comments

version.c.o multiple definition of `gVERSION' mraa.c.o first defined here

jpelletier avatar Jan 27 '21 13:01 jpelletier

The file version.c is generated automatically and is conflicting with the existing definition in mraa.c. Anybody knows how to fix this?

When the code is cloned on a raspberrypi, it works fine.

With these modifications, it linked successfully. In include/version.h, I commented these lines

const char *gVERSION; const char *gVERSION_SHORT;

and copied these lines in src/mraa.c

jpelletier avatar Jan 30 '21 07:01 jpelletier

Hi @jpelletier, Have you tried disabling the tests (BUILDTESTS option)? This might be caused by trying to build with missing dependencies: Take a look at the CMakeLists.txt file.

Propanu avatar Feb 01 '21 17:02 Propanu

did u find any fix @jpelletier?

RajithShetty619 avatar May 29 '21 10:05 RajithShetty619

did u find any fix @jpelletier?

See Propanu's comments. When disabling the tests, it works.

jpelletier avatar Aug 28 '21 21:08 jpelletier

@jpelletier Thank you for the hint.

I solved the issue by specifying the two constants as extern, as the version.h header file only sets their declaration. The version.c source file provides their values.

extern const char* gVERSION;
extern const char* gVERSION_SHORT;

For an unknown reason, git clone https://github.com/nrcrast/mraa.git provides the version.h header file without extern while the code on repository does include extern.

https://github.com/eclipse/mraa/blob/d7ae17171bd733291aca70f910a0c2618fa4fe1a/include/version.h#L14-L15

rei-vilo avatar May 20 '22 17:05 rei-vilo

Can we backport this fix to the latest release?

Petross404 avatar Jun 13 '22 17:06 Petross404