Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译tpre_test时报错 #150

Closed
Smart-SangGe opened this issue Oct 5, 2023 · 5 comments
Closed

编译tpre_test时报错 #150

Smart-SangGe opened this issue Oct 5, 2023 · 5 comments

Comments

@Smart-SangGe
Copy link

g++ tpre_test.cc -I/home/sangge/yacl -o tpre_test

In file included from /home/sangge/yacl/yacl/math/mpint/mp_int.h:25,
from /home/sangge/yacl/yacl/crypto/base/ecc/ec_point.h:21,
from /home/sangge/yacl/yacl/crypto/primitives/tpre/capsule.h:23,
from /home/sangge/yacl/yacl/crypto/primitives/tpre/tpre.h:23,
from tpre_test.cc:15:
/home/sangge/yacl/yacl/base/int128.h:110:20: error: redefinition of ‘constexpr int128_t std::abs(int128_t)’
110 | constexpr int128_t abs(int128_t x) { return x >= 0 ? x : -x; }
| ^~~
In file included from /usr/include/c++/12/cstdlib:77,
from /usr/include/c++/12/ext/string_conversions.h:41,
from /usr/include/c++/12/bits/basic_string.h:3960,
from /usr/include/c++/12/string:53,
from /usr/include/c++/12/bits/locale_classes.h:40,
from /usr/include/c++/12/bits/ios_base.h:41,
from /usr/include/c++/12/ios:42,
from /usr/include/c++/12/ostream:38,
from /usr/include/c++/12/iostream:39,
from /home/sangge/yacl/yacl/crypto/primitives/tpre/tpre.h:17:
/usr/include/c++/12/bits/std_abs.h:85:3: note: ‘constexpr __int128 std::abs(__int128)’ previously defined here
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -x; }
| ^~~
In file included from /home/sangge/yacl/yacl/crypto/base/ecc/any_ptr.h:22,
from /home/sangge/yacl/yacl/crypto/base/ecc/ec_point.h:20:
/home/sangge/yacl/yacl/math/mpint/mp_int.h: In member function ‘std::size_t std::hashyacl::math::MPInt::operator()(const yacl::math::MPInt&) const’:
/home/sangge/yacl/yacl/math/mpint/mp_int.h:392:22: error: ‘mp_hash’ was not declared in this scope; did you mean ‘hash’?
392 | MPINT_ENFORCE_OK(mp_hash(&x.n
, &h));
| ^~~~~~~
/home/sangge/yacl/yacl/base/exception.h:353:52: note: in definition of macro ‘YACL_ENFORCE_THAT_IMPL’
353 | ::yacl::enforce_detail::EnforceFailMessage r(condition);
| ^~~~~~~~~
/home/sangge/yacl/yacl/math/mpint/mp_int_enforce.h:26:3: note: in expansion of macro ‘YACL_ENFORCE_EQ’
26 | YACL_ENFORCE_EQ((MP_ERR), MP_OKAY, VA_ARGS)
| ^~~~~~~~~~~~~~~
/home/sangge/yacl/yacl/math/mpint/mp_int.h:392:5: note: in expansion of macro ‘MPINT_ENFORCE_OK’
392 | MPINT_ENFORCE_OK(mp_hash(&x.n
, &h));

@Smart-SangGe
Copy link
Author

第二个错误解决了,我安装的tommath是1.2.0版,而好像只有develop branch 有mp_hash这个函数.

@anakinxc
Copy link
Collaborator

anakinxc commented Oct 5, 2023

@Smart-SangGe 请用 bazel 来 build targets

@Smart-SangGe
Copy link
Author

@anakinxc 我在bazel-bin里面找到了这个tpre-test. 那么如果我想用这个库来写点别的代码,我应该怎么编译和链接呢

@anakinxc
Copy link
Collaborator

anakinxc commented Oct 6, 2023

@anakinxc 我在bazel-bin里面找到了这个tpre-test. 那么如果我想用这个库来写点别的代码,我应该怎么编译和链接呢

你可以在 bazel 里添加新的 targets

@Smart-SangGe
Copy link
Author

@anakinxc 明白了, 感谢.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants