eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.

Home Page:http://mraa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

linking fails on Dragonboard 410c with multiple definitions

jpelletier opened this issue · comments

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

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

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.

did u find any fix @jpelletier?

did u find any fix @jpelletier?

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

@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.

mraa/include/version.h

Lines 14 to 15 in d7ae171

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

Can we backport this fix to the latest release?