'Building Palisade with Bazel

I want to use the functionality of the palisade library [1] in my bazel project. But I am having some issues when running some of the examples (which I want to use) that are provided in the palisade library.

Case I: When palisade is built as a standalone project using the installation techniques provided as part of the project, everything works fine. This approach uses cmake to install the libraries on the OS.

Case II: When I build palisade as an external library to my Bazel project, I am able to import the headers. In this case, the palisade library is built using rules_foreign_cc / cmake and the library is installed in The Bazel sandbox. However, code does not execute properly for some examples and gives the following error.

/usr/bin/ld.gold: error: bazel-out/k8-fastbuild/bin/_solib_k8/_U@openfhe_S_S_Cpke___Uexternal_Sopenfhe_Spke_Slib/libPALISADEcore.so.1: symbol 'lbcrypto::PseudoRandomNumberGenerator::m_prng' used as both __thread and non-__thread
/usr/bin/ld.gold: bazel-out/k8-fastbuild/bin/transpiler/_objs/simple-integers-serial-bgvrns/simple-integers-serial-bgvrns.pic.o: previous definition here

To re-create this error please follow following repo, which has everything needed to reproduce the error.

https://github.com/ArmaghanAsghar/bazel_palisade

Reference [1] https://palisade-crypto.org



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source