Problems installing the Solidity compiler

I want to use the solidity compiler from the geth console. I have solc installed at /usr/local/bin/solc

In the geth console, I run:

> admin.setSolc('/usr/local/bin/solc')

Which returns:

"solc, the solidity compiler commandline interface\nVersion: 0.3.4-0a0fc046/Release-Darwin/appleclang/JIT\n\npath: /usr/local/bin/solc"

All looks good so far, right? However, I get an empty array when I run eth.getCompilers(). i.e:

> eth.getCompilers()

And, presumably. that is the reason for the following:

>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; } }'

$ geth version
Version: 1.4.5-stable-a269a713
Protocol Versions: [63 62 61]
Network Id: 1
Go Version: go1.6.2
OS: darwin

Help! :smile:


  • octoct Member Posts: 1
    I'm new to this myself, so I don't know reason why eth.getCompilers() returns empty.

    I had a similar problem with mine, once I ignored the response from getCompilers() and continued on with the example - everything worked fine.

    the "undefined" is the default response from Javascript interactive interpreter (REPL), it just means that it has no values to display, it does not mean there is an error (unless you are expecting a returned value!)

    Also the line "var greeterSource = 'contract mortal { ...." is just assigning the contract source code text into a variable for has not been compiled at this stage, that will happen later on in the example after the variable "greeterSource" gets passed into the compiler.

  • mimarobmimarob Member Posts: 33
    Check from the bash promt that your solc really is in /usr/local/bin, mine is in /usr/bin

    shell> which solc

Sign In or Register to comment.