hyperledger-archives / indy-sdk

indy-sdk
https://wiki.hyperledger.org/display/indy
Apache License 2.0
668 stars 735 forks source link

Build issue with libindy/include/indy_types.h #658

Closed stachen closed 6 years ago

stachen commented 6 years ago

Hi all,

I recently started digging into indy, and was trying to compile the code and ran into this issue.

In the recent commit of libindy/include/indy_types.h

https://github.com/hyperledger/indy-sdk/commit/4cafeda266a087836425a69b3f2951be6efde697#diff-6ab3e784eca5e2160eaad8ae4d050b30

These two lines were added

typedef long long     indy_i64_t;
typedef unsigned long long     indy_u64_t;

And their names collide with the existing member variables

typedef int64_t       indy_i64_t;
typedef uint64_t      indy_u64_t;

A little background, I was compiling the code with the nodeJS wrapper https://github.com/Picolab/indy-sdk/tree/master/wrappers/nodejs

Build Log (sorry that it's long)

root@ubuntudev-vm:~/git/src/github.com/pico2/wrappers/nodejs# npm run rebuild

> indy-sdk@0.2.1 rebuild /home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs
> node codegen && node-gyp rebuild

make: Entering directory '/home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs/build'
  CXX(target) Release/obj.target/indynodejs/src/indy.o
In file included from ../src/indy_core.h:5:0,
                 from ../src/indy.cc:4:
/home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs/include/indy_types.h:13:23: error: conflicting declaration ‘typedef long long int indy_i64_t’
 typedef long long     indy_i64_t;
                       ^
/home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs/include/indy_types.h:10:23: note: previous declaration as ‘typedef int64_t indy_i64_t’
 typedef int64_t       indy_i64_t;
                       ^
/home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs/include/indy_types.h:14:32: error: conflicting declaration ‘typedef long long unsigned int indy_u64_t’
 typedef unsigned long long     indy_u64_t;
                                ^
/home/ubuntudev/git/src/github.com/pico2/wrappers/nodejs/include/indy_types.h:8:23: note: previous declaration as ‘typedef uint64_t indy_u64_t’
 typedef uint64_t      indy_u64_t;
                       ^
indynodejs.target.mk:97: recipe for target 'Release/obj.target/indynodejs/src/indy.o' failed

I wonder how you guys manage to build it, given the name collision?

Thanks Stanley

vimmerru commented 6 years ago

Rust build and all existing plugins don't use C headers. Can you just fix this and send PR? It would be nice to have a bug in our Jira.

farskipper commented 6 years ago

Just submitted a PR that'll resolve this.

@stachen For now just remove these lines:

typedef uint64_t      indy_u64_t;
typedef int64_t       indy_i64_t;