osu-crypto / libPSI

A repository for private set intersection.
Other
172 stars 48 forks source link

build error for dependencies #50

Closed nerdneilsfield closed 1 year ago

nerdneilsfield commented 1 year ago

Hi, I trying to compile LibPSI in ubuntu 20.04 with AUTO_FETCH=ON, then I got those errors:

/home/dengqi/Source/langs/cpp/libPSI/thirdparty/libOTe/cryptoTools/thirdparty/relic/src/md/blake2.h:101:23:
    error: size of array element of type 'blake2s_state' (aka 'struct
    __blake2s_state') (185 bytes) isn't a multiple of its alignment (64 bytes)

        blake2s_state S[8][1]
                          ^

    /home/dengqi/Source/langs/cpp/libPSI/thirdparty/libOTe/cryptoTools/thirdparty/relic/src/md/blake2.h:102:20:
    error: size of array element of type 'blake2s_state' (aka 'struct
    __blake2s_state') (185 bytes) isn't a multiple of its alignment (64 bytes)

        blake2s_state R[1]
                       ^

    /home/dengqi/Source/langs/cpp/libPSI/thirdparty/libOTe/cryptoTools/thirdparty/relic/src/md/blake2.h:109:23:
    error: size of array element of type 'blake2b_state' (aka 'struct
    __blake2b_state') (361 bytes) isn't a multiple of its alignment (64 bytes)

        blake2b_state S[4][1]
                          ^

    /home/dengqi/Source/langs/cpp/libPSI/thirdparty/libOTe/cryptoTools/thirdparty/relic/src/md/blake2.h:110:20:
    error: size of array element of type 'blake2b_state' (aka 'struct
    __blake2b_state') (361 bytes) isn't a multiple of its alignment (64 bytes)

        blake2b_state R[1]
                       ^

    /home/dengqi/Source/langs/cpp/libPSI/thirdparty/libOTe/cryptoTools/thirdparty/relic/src/md/blake2s-ref.c:329:18:
    error: size of array element of type 'blake2s_state' (aka 'struct
    __blake2s_state') (185 bytes) isn't a multiple of its alignment (64 bytes)

      blake2s_state S[1]
                     ^

    5 errors generated.

the error seems came from the relic library depended by cryptoTools, I try to update the tag of getRelic.cmake to the newest stable version of relic as 0.6.0. Then this error disappear , but there came another error forcryptoTools`:

libPSI/thirdparty/libOTe/cryptoTools/cryptoTools/Crypto/RCurve.cpp:230:9:
  fatal error: use of undeclared identifier 'bn_init'

          bn_init(mVal, static_cast<int>(sizeDigits()))
          ^

  1 error generated.

Then I try to update the version of cryptoTools, but it does not help, and will introduce another errors.

ladnir commented 1 year ago

What system/OS are you on?

You can try to remove the "staged" version of relic.

rm -rf out/install
rm -rf thirdparty/libOTe/out/install

Just changing the commit won't restage relic and therefore you still might be on a old version? Maybe not though since it failed to compile in the first place...

You can also build libOTe with relic disabled and sodium enabled. This can be done in thirdparty/getLibOTe.cmake. But make sure it actually rebuild libOTe... e.g. remove out/ and thirdparty/libOTe/out/.

nerdneilsfield commented 1 year ago

Thank you very much for your reply!

I am using Ubuntu 20.04 with clang-16 and gcc-11. For the above tests, I have already removed the output to test the newer version of Relic, but it still failed.

I will try to disable relic and use sodium for test.

ladnir commented 1 year ago

Build libOTe with sodium support instead of relic.

Clone libPSI Edit https://github.com/osu-crypto/libPSI/blob/2eb0514f66a0a0d8ce0ffcead73485886f21306f/thirdparty/getLibOTe.cmake#L31 to be -DENABLE_SODIUM=ON build libOTe as the Readme describes.