Ubuntu 无法将solc链接到Geth

Ubuntu 无法将solc链接到Geth,ubuntu,solidity,Ubuntu,Solidity,我已经在ubuntu中安装了Solidity编译器(solc)。 无法将solc链接到Geth 我们怎样才能做到这一点 以下是我完成的步骤: sudo add-apt-repository ppa:ethereum/ethereum sudo apt-get update sudo apt-get install solc 它将显示如下: > eth.getCompilers() [] > eth.getCompilers() ['Solidity' ] 我想显示如下: >

我已经在ubuntu中安装了Solidity编译器(
solc
)。 无法将
solc
链接到
Geth

我们怎样才能做到这一点

以下是我完成的步骤:

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
它将显示如下:

> eth.getCompilers()
[]
> eth.getCompilers()
['Solidity' ]
我想显示如下:

> eth.getCompilers()
[]
> eth.getCompilers()
['Solidity' ]

由于您已经通过源代码安装了
solc
,因此只需使用
which
命令即可找到它:

0 ✓ user@hoster ~ $ which geth
/usr/bin/geth
0 ✓ user@hoster ~ $ which solc
/usr/bin/solc
现在,您可以使用
setSolc()
方法将其添加到
geth

0 ✓ user@hoster ~ $ geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.4.7-stable-667a386d/linux/go1.6.2/JIT
coinbase: 0xfcae7970392f510a985a7eaccd3820b7759d65d9
at block: 1757738 (Thu, 23 Jun 2016 18:33:28 CEST)
 datadir: /home/user/.ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.getCompilers()
[]
> admin.setSolc("/usr/bin/solc")
"solc, the solidity compiler commandline interface\nVersion: 0.3.5-5f97274a/Release-Linux/g++/Interpreter\n\npath: /usr/bin/solc"
> eth.getCompilers()
["Solidity"]
> 
现在它是链接的。另见