Getting segmentation fault when compiling a simple contract on geth on OSX Yosemite

source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
"contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
contract = eth.compile.solidity(source).test
solc: signal: segmentation fault

    at InvalidResponse (<anonymous>:-81662:-45)
    at send (<anonymous>:-156322:-45)
    at solidity (<anonymous>:-133322:-45)
    at <anonymous>:1:12

my geth version is 1.3.6 and solc is

Version: 0.3.1-12797ed6/RelWithDebInfo-Darwin/appleclang/JIT linked to libethereum-1.2.3-3f84edc3/RelWithDebInfo-Darwin/appleclang/JIT

NOTE: It also raises error when running solc on its own

19:49:55-makoto~/src/webthree-helpers (develop)$ cat contract.sol 
contract test {
    function multiply(uint a) returns(uint d) {
        return a * 7;
19:51:15-makoto~/src/webthree-helpers (develop)$ solc --bin -o solcoutput contract.sol
Segmentation fault: 11
  • can you post some code plz? Apr 9 '16 at 23:25
  • segmentation fault appears when we have some bad sectors, can you please try re-install the solidity?
    – niksmac
    Apr 10 '16 at 1:18
  • Can you even run solc by itself? Probably will crash too and need to re-install it as @NikhilM suggests.
    – eth
    Apr 10 '16 at 6:07
  • I reinstalled cpp-ethereum 2 times and ethereum(aka geth) once.
    – Makoto
    Apr 10 '16 at 18:50
  • same error when running solc on its own
    – Makoto
    Apr 10 '16 at 18:59

Compile it using the latest solc version at http://chriseth.github.io/browser-solidity/. If you don't get good output, then you have a bug you can file with the solidity folks.

I had a segfault back in January, upgrading to the latest version of Solidity fixed it. Thanks to the advice on the gitter thread, which was "try browser-solidity and report back", my issue was resolved quickly.

  • This does not solves OPs question, but it is a workaround yes.
    – niksmac
    Apr 11 '16 at 3:33
  • 2
    yeah you are probably right, I saw the gitter thread. He's in shared lib hell it looks like to me. I've stayed in javascript land and avoided all the binary and library issues with webthree_umbrella and Mix. I'd rather have NPM package issues than shared library issues any day of the week...
    – Paul S
    Apr 11 '16 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.