Can't compile a contract

webnatorwebnator Member Posts: 1
edited September 2015 in Smart Contracts and Dapps
Hello, I've managed to install Frontier with geth, and also the solidity compiler.
If I run
eth.getCompilers()

it returns
["Solidity"]

so that's ok for now, then if I run
admin.setSolc("/usr/local/bin/solc")

I get this response
I0917 09:35:12.111693 3838 solidity.go:101] solc v0.1.1
Solidity Compiler: /usr/local/bin/solc

"solc v0.1.1\nSolidity Compiler: /usr/local/bin/solc\n"


But when I try to compile the example contract from the website
var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }'

var greeterCompiled = web3.eth.compile.solidity(greeterSource)


I get this error
solc error: signal: segmentation fault
at InvalidResponse (:-81076:-63)
at send (:-154580:-63)
at solidity (:-131712:-63)
at :1:23


I'm running geth on a private network, with my own genesis block for testing, on a Macbook Pro with Yosemite.

I believe that the Solc version (v0.1.1) is not the most recent, so I don't know if it has something to do with that.
I've also tried compiling simpler contracts, but at the point I insert some variable of type address, I get that error.

Please help... :)

Comments

  • LisardoLisardo Member Posts: 2
    edited September 2015
    Did you try to use geth 'develop' branch?

    I also had issues with solc 0.1.2 and solc 0.1.1
  • pegacatpegacat Member Posts: 2
    Hi Folks,

    I'm having the same problem on a Macbook Pro with Yosemite, with the new Homestead release. Like webnator my environment looks sane, but the compiler throws a segfault, even on simple sample code:
    
    > console.log(source)
    contract test { function multiply(uint a) returns(uint d) { return a * 7; } }
    undefined
    > var compiledTest = web3.eth.compile.solidity(source);
    solc: signal: segmentation fault
    
        at InvalidResponse (<anonymous>:-81662:-54)
        at send (<anonymous>:-156322:-54)
        at solidity (<anonymous>:-133322:-54)
        at <anonymous>:1:20
    I'm a newbie, so I may be doing something obvious: any ideas?
  • pegacatpegacat Member Posts: 2
    Is there anybody out there :-)?

    Still have no idea how to debug this... any help would be appreciated.
  • Jeffrey_McAteerJeffrey_McAteer Member Posts: 1
    I am also having this problem with the example greeter contract.
    Running MBP El Cap, geth version data:
    Version: 1.3.6
    Git Commit: 9e323d65b20c32ab1db40e8dde7172826e0e9c45
    I dual-boot Arch, if this is a mac-specific problem I don't mind moving things over.
Sign In or Register to comment.