relic-toolkit / relic

Code
Other
452 stars 179 forks source link

Error in ep_param_set() #269

Closed Vageous closed 1 year ago

Vageous commented 1 year ago

Hi, I'm new to the relic. When I choose the BLS12-455, I follow the Building instructions in the wiki page linked above. However, I cannot obtain the file "librelilc.so", only the "librelic_s.a". What is the reason for this?

dfaranha commented 1 year ago

Make sure that you have SHLIB=on in the build configuration, otherwise a shared library will not be built.

Vageous commented 1 year ago

I set the SHLIB=on in the build configuration, then I get the following error:

/usr/bin/ld: /usr/local/lib/libgmp.a(realloc.o): warning: relocation against __gmp_reallocate_func' in read-only section.text' /usr/bin/ld: /usr/local/lib/libgmp.a(lt4-clear.o): relocation R_X86_64_PC32 against symbol `__gmp_free_func' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[2]: [src/CMakeFiles/relic.dir/build.make:4738: lib/librelic.so] Error 1 make[1]: [CMakeFiles/Makefile2:229: src/CMakeFiles/relic.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

dfaranha commented 1 year ago

I believe you need libgmp.so (a shared library for GMP)

Vageous commented 1 year ago

I have the libgmp.so in the /usr/local/lib, but compile still reports the above error

dfaranha commented 1 year ago

Then you need to find a way to tell the linker to look into /use/local/lib as well.

On Thu, Jun 8, 2023, 14:22 Vageous @.***> wrote:

I have the libgmp.so in the /usr/local/lib, but compile still reports the above error

— Reply to this email directly, view it on GitHub https://github.com/relic-toolkit/relic/issues/269#issuecomment-1582486061, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI67USSBHILCXXV7IJRD73XKG7XBANCNFSM6AAAAAAY7DSJOU . You are receiving this because you commented.Message ID: @.***>

Vageous commented 1 year ago

Thanks for your help. I solved the problem.

Vageous commented 1 year ago

I modify the gmp.cmake as follows:

if(STBIN) find_library(GMP_LIBRARIES NAMES libgmp.so gmp.lib libgmp-10 libgmp gmp) else(STBIN) find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib libgmp-10 libgmp gmp) endif(STBIN)

After that, the above error has been solved. But, I meet a new error as follows.

/usr/bin/ld: cannot find -lgcc_s: No such file or directory /usr/bin/ld: cannot find -lgcc_s: No such file or directory collect2: error: ld returned 1 exit status make[2]: [src/CMakeFiles/relic.dir/build.make:4738: lib/librelic.so] Error 1 make[1]: [CMakeFiles/Makefile2:229: src/CMakeFiles/relic.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

dfaranha commented 1 year ago

Oh that means your toolchain has problems linking (static) binaries. It's not related to RELIC or GMP anymore :(