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

Changes for compiling on macOS #4

Closed
beaugunderson opened this issue Jul 27, 2017 · 10 comments
Closed

Changes for compiling on macOS #4

beaugunderson opened this issue Jul 27, 2017 · 10 comments

Comments

@beaugunderson
Copy link
Contributor

I had to add this to Makefile to get it to work:

CXX=g++  # or c++, clang works too
CXXFLAGS=-std=c++14

I also had to inline assertThrow from Assert.h into Instruction.h because the compiler complained that it wasn't defined--my C++ knowledge is limited so I don't have a guess as to why.

@vors
Copy link

vors commented Jul 27, 2017

That would make a good pool request :)

@msuiche
Copy link
Owner

msuiche commented Jul 28, 2017

Yes, pull request please :)

@beaugunderson
Copy link
Contributor Author

OK, PR #6 for the Makefile change but I don't know how to fix the issue with assertThrow other than moving the definition to Instruction.h, which seems wrong. :)

For what it's worth here's the compiler error:

In file included from Contract.cpp:18:
In file included from ./Porosity.h:41:
In file included from ./PorosityDefs.h:20:
./Instruction.h:214:56: error: use of undeclared identifier 'InvalidOpcode'
            assertThrow(1 <= _number && _number <= 32, InvalidOpcode, "Invalid PUSH instruction requested.");

I changed InvalidOpcode to a string when I was initially investigating; that results in this error:

In file included from Contract.cpp:18:
In file included from ./Porosity.h:41:
In file included from ./PorosityDefs.h:20:
./Instruction.h:214:13: error: use of undeclared identifier 'assertThrow'
            assertThrow(1 <= _number && _number <= 32, "InvalidOpcode", "Invalid PUSH instruction requested.");

@reiven
Copy link

reiven commented Jul 28, 2017

Also it will be great to make it available for linux

Update: i've changed the flag suggested by @beaugunderson but now i got this error

g++ -std=c++14 -c -o Utils.o Utils.cpp In file included from Porosity.h:32:0, from Utils.cpp:17: Common.h:48:66: fatal error: boost_multiprecision_number_compare_bug_workaround.hpp: No such file or directory

Update #2: i've downloaded this file but still cannot compile because of various erros like this one

Statement.h: In member function ‘std::__cxx11::string Statement::getStatementStr()’: Statement.h:135:84: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Any ideas?

@conor10
Copy link

conor10 commented Jul 31, 2017

I'm getting segfaults when I run the OS X compiled binary - is anyone else?

$ export abi=`cat ~/code/java/web3j/src/test/resources/solidity/greeter/build/greeter.abi`
$ export code=`cat ~/code/java/web3j/src/test/resources/solidity/greeter/build/greeter.bin`
$ ./porosity --abi $abi --code $code --decompile --verbose 0
Porosity v0.1 (https://www.comae.io)
Matt Suiche, Comae Technologies <support@comae.io>
The Ethereum bytecode commandline decompiler.
Decompiles the given Ethereum input bytecode and outputs the Solidity code.

Segmentation fault: 11
$ ./porosity --abi $abi --code $code --list --verbose 0
Porosity v0.1 (https://www.comae.io)
Matt Suiche, Comae Technologies <support@comae.io>
The Ethereum bytecode commandline decompiler.
Decompiles the given Ethereum input bytecode and outputs the Solidity code.

Segmentation fault: 11

abi and bin code is as per https://github.com/web3j/web3j/tree/master/src/test/resources/solidity/greeter/build

See deployed code here https://ropsten.etherscan.io/tx/0x654a48e6c24548a1f6c8556747ac849ca8344499b16605b8bd3f55aa9939749d

@beaugunderson
Copy link
Contributor Author

@conor10 can you put the ABI and code in your comment (or a gist) as a bash script so I can easily run it?

@beaugunderson
Copy link
Contributor Author

@conor10 sorry, I wanted something to copy and paste :) willing to help but limited time

@msuiche
Copy link
Owner

msuiche commented Aug 2, 2017

@beaugunderson can you confirm the macOS compilation issue had been fixed with the recent pull request ?

@genecyber
Copy link
Contributor

@beaugunderson can you confirm the macOS compilation issue had been fixed with the recent pull request ?

I added PR #16 to finish the fix for OSX

I'll add a new PR with doc cleanup and OSX build instructions

@msuiche msuiche closed this as completed Aug 21, 2017
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

6 participants