Open
Description
Hello, I get the following compilation error:
make
[ 2%] Building CXX object depends/CMakeFiles/zm.dir/ate-pairing/src/zm.cpp.o
[ 4%] Building CXX object depends/CMakeFiles/zm.dir/ate-pairing/src/zm2.cpp.o
[ 6%] Linking CXX static library libzm.a
[ 6%] Built target zm
[ 8%] Building CXX object libff/CMakeFiles/ff.dir/algebra/curves/bls12_381/bls12_381_fields.cpp.o
[ 10%] Building CXX object libff/CMakeFiles/ff.dir/algebra/curves/bls12_381/bls12_381_g1.cpp.o
In file included from /home/taghi/Project/libff/libff/../libff/algebra/fields/prime_base/fp.hpp:203,
from /home/taghi/Project/libff/libff/../libff/algebra/curves/bls12_381/bls12_381_fields.hpp:10,
from /home/taghi/Project/libff/libff/../libff/algebra/curves/bls12_381/bls12_381_init.hpp:11,
from /home/taghi/Project/libff/libff/../libff/algebra/curves/bls12_381/bls12_381_g1.hpp:12,
from /home/taghi/Project/libff/libff/algebra/curves/bls12_381/bls12_381_g1.cpp:1:
/home/taghi/Project/libff/libff/../libff/algebra/fields/prime_base/fp.tcc: In instantiation of ‘std::ostream& libff::operator<<(std::ostream&, const Fp_model<n, modulus>&) [with long int n = 6; const bigint<n>& modulus = (& bls12_381_modulus_q); std::ostream = std::basic_ostream<char>]’:
/home/taghi/Project/libff/libff/algebra/curves/bls12_381/bls12_381_g1.cpp:361:17: required from here
361 | out << copy.X << OUTPUT_SEPARATOR << (copy.Y.as_bigint().data[0] & 1);
| ^
/home/taghi/Project/libff/libff/../libff/algebra/fields/prime_base/fp.tcc:812:25: error: ‘libff::bigint<n> libff::Fp_model<n, modulus>::bigint_repr() const [with long int n = 6; const libff::bigint<n>& modulus = ((const libff::bigint<6>&)(& libff::bls12_381_modulus_q))]’ is private within this context
812 | out << p.bigint_repr();
| ~~~~~~~~~~~~~^~
compilation terminated due to -Wfatal-errors.
make[2]: *** [libff/CMakeFiles/ff.dir/build.make:90: libff/CMakeFiles/ff.dir/algebra/curves/bls12_381/bls12_381_g1.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:422: libff/CMakeFiles/ff.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
I am using Arch Linux and gcc (GCC) 14.1.1 20240522.
Thanks.
Update:
I could successfully compile by changing the declaration of operator<< and operator>>:
git diff
diff --git a/libff/algebra/fields/prime_base/fp.hpp b/libff/algebra/fields/prime_base/fp.hpp
index e30210c..eac9224 100755
--- a/libff/algebra/fields/prime_base/fp.hpp
+++ b/libff/algebra/fields/prime_base/fp.hpp
@@ -138,8 +138,8 @@ public:
static Fp_model<n, modulus> geometric_generator(); // generator^k, for k = 1 to m, domain size m
static Fp_model<n, modulus> arithmetic_generator();// generator++, for k = 1 to m, domain size m
- friend std::ostream& operator<< <n,modulus>(std::ostream &out, const Fp_model<n, modulus> &p);
- friend std::istream& operator>> <n,modulus>(std::istream &in, Fp_model<n, modulus> &p);
+ friend std::ostream& operator<< <>(std::ostream &out, const Fp_model<n, modulus> &p);
+ friend std::istream& operator>> <>(std::istream &in, Fp_model<n, modulus> &p);
private:
/** Returns a representation in bigint, depending on the MONTGOMERY_OUTPUT flag. */
I'm not an expert C++ developer, and I'm having difficulty understanding the need to include <n, modulus>
in the declarations of operator<<
and operator>>
. This issue exists in FP2, FP3, ...
Metadata
Metadata
Assignees
Labels
No labels