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

installation error with basic_string #738

Closed
shabo1984 opened this issue Nov 8, 2018 · 8 comments
Closed

installation error with basic_string #738

shabo1984 opened this issue Nov 8, 2018 · 8 comments

Comments

@shabo1984
Copy link

sudo make -j install

/triton/triton/src/libtriton/ast/z3/tritonToZ3Ast.cpp: In member function ‘z3::expr triton::ast::TritonToZ3Ast::convert(const SharedAbstractNode&)’:

/triton/triton/src/libtriton/ast/z3/tritonToZ3Ast.cpp:164:96: error: no matching function for call to ‘std::__cxx11::basic_string::basic_string(triton::uint512)’
std::string value(reinterpret_casttriton::ast::DecimalNode*(node.get())->getValue());

What cause this problem?

@PMmuc
Copy link

PMmuc commented Nov 8, 2018

Are you using the newest boost version 1.68? I had the same problem with this library.
When using boost 1.55 the problem went away.
I don't know the exact reason, but obviously in newer version of boost you are not allowed to implicitly cast from boost::multiprecision::number to const char*/string anymore.

@shabo1984
Copy link
Author

what are gcc/g++ versions you used?

@JonathanSalwan
Copy link
Owner

Can you try the following patch with boost 1.68 and let me know if it works?

diff --git a/src/libtriton/ast/z3/tritonToZ3Ast.cpp b/src/libtriton/ast/z3/tritonToZ3Ast.cpp
index dd2aee69..b2c20a96 100644
--- a/src/libtriton/ast/z3/tritonToZ3Ast.cpp
+++ b/src/libtriton/ast/z3/tritonToZ3Ast.cpp
@@ -161,7 +161,7 @@ namespace triton {
         }
 
         case DECIMAL_NODE: {
-          std::string value(reinterpret_cast<triton::ast::DecimalNode*>(node.get())->getValue());
+          std::string value(reinterpret_cast<triton::ast::DecimalNode*>(node.get())->getValue().convert_to<std::string>());
           return this->context.int_val(value.c_str());
         }
 
@@ -277,7 +277,7 @@ namespace triton {
           /* If the conversion is used to evaluate a node, we concretize symbolic variables */
           if (this->isEval) {
             triton::uint512 value = reinterpret_cast<triton::ast::VariableNode*>(node.get())->evaluate();
-            std::string strValue(value);
+            std::string strValue(value.convert_to<std::string>());
             return this->context.bv_val(strValue.c_str(), symVar->getSize());
           }

JonathanSalwan added a commit that referenced this issue Nov 11, 2018
JonathanSalwan added a commit that referenced this issue Nov 11, 2018
@PMmuc
Copy link

PMmuc commented Nov 12, 2018

Thanks, that fixes the above compile errors. But the Python binding failures from issue #716 are still existing, so that I can't use Triton for python in windows.
@shabo1984 I am using Visual Studio 2017 Compiler Version. But I had no problem compiling Triton with gcc/g++ 7.3 on ubuntu 18

@JonathanSalwan
Copy link
Owner

Mmmmh, what about using Appeveyor's artefacts instead of compiling Triton on windows?

@JonathanSalwan
Copy link
Owner

Btw, i'm really not comfortable with Windows ecosystem so that I cannot figure out by myself what's the root cause of these issues.

@JonathanSalwan
Copy link
Owner

If you figure out how to solve them, I will be more than happy to accept your pull request :)

@JonathanSalwan JonathanSalwan self-assigned this Nov 12, 2018
@JonathanSalwan JonathanSalwan added this to the v0.6 milestone Nov 12, 2018
@PMmuc
Copy link

PMmuc commented Nov 12, 2018

Apparently the Z3 Prover is linked dynamically with Triton, that's why I had to move the libz3.dll into the python2.7\Lib\site-packages directory as well for it to work. The tests still don't work as they seem to end up in an infinite loop but the python examples finally work.

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

No branches or pull requests

3 participants