ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
23.33k stars 5.77k forks source link

How to install standalone? #725

Closed graup closed 8 years ago

graup commented 8 years ago

I wanted to install a standalone compiler, solc. It is referenced in many examples and tutorials. After 2 hours I still didn't get it.

I've been trying several things from this page.

Could someone provide clear instructions and update the documentation?

Operating system: Mac OS 10.10.5

bobsummerwill commented 8 years ago

Hey @awishformore!

Our Jenkins instance died horribly. I've been working day-and-night on bringing up a new TravisCI/Appveyor setup, and on getting the long-standing solidity/cpp-ethereum split done. And now with DAO Hard fork also putting extra pressure there.

There will be new cpp-ethereum and solidity releases this week (and they will be decoupled, for the first time).

The Solidity build instructions will change (and become way simpler).

If you want something to get you going right now, you could try these:

https://github.com/bobsummerwill/solidity/releases

bobsummerwill commented 8 years ago

PS. "As far as I understand, this is not a global command line tool, but only JS bindings to use within JS. That should be mentioned on that documentation page, I think."

Nope - the npm install is a full global "solc" instance. It is the C++ code compiled into JS using Emscripten. That might even be your easiest approach for now.

XertroV commented 8 years ago

For anyone looking at the bobsummerwill repository above, I get this error msg when running solc: dyld: Library not loaded: /Users/travis/build/bobsummerwill/solidity/build/libsolidity/libsolidity.dylib

I tried to fix with some horrendous symlinks and got it working, but it's pretty ugly.

Terminal extract:

➜  $ pwd
/Users/travis/build/bobsummerwill/solidity/build
➜  $ ls -al
total 24
drwxr-xr-x  5 max.kaye  admin  170 18 Jul 17:27 .
drwxr-xr-x  3 max.kaye  admin  102 18 Jul 17:23 ..
lrwxr-xr-x  1 max.kaye  admin   57 18 Jul 17:25 libdevcore -> /Users/max.kaye/Downloads/solidity-develop-osx-elcapitan/
lrwxr-xr-x  1 max.kaye  admin   57 18 Jul 17:25 libevmasm -> /Users/max.kaye/Downloads/solidity-develop-osx-elcapitan/
lrwxr-xr-x  1 max.kaye  admin   57 18 Jul 17:25 libsolidity -> /Users/max.kaye/Downloads/solidity-develop-osx-elcapitan/
➜  $
bobsummerwill commented 8 years ago

Ah - yes - but your nasty symlinks got you to a working state? Great!

Here is the corresponding release flow I've built for cpp-ethereum:

I'd forgotten that the dylib path fixup will need replicating for the Solidity ZIP, and maybe also pulling some extra dylibs into the ZIP too (jsoncpp and boost), to ensure that it is standalone and not implicitly dependent on previous Homebrew installations.

graup commented 8 years ago

Nope - the npm install is a full global "solc" instance.

Are you sure? Neither npm install solc inside a package directory nor npm install -g solc install a global command. Well, they cannot, the package doesn't define a binary. It seems that that is being worked on, though.

bobsummerwill commented 8 years ago

Maybe I am wrong. @chriseth knows for sure.

Either way - it will be fixed with the Solidity standalone builds imminently.

I'm working on the dylib fixup based on your previous comments right now.

https://github.com/bobsummerwill/solidity/commit/5aeabe580e6034f25992f3d4e30977cc676cb53a

bobsummerwill commented 8 years ago

Give these a go! https://github.com/bobsummerwill/solidity/releases/tag/develop-v0.3.5.130

XertroV commented 8 years ago

@bobsummerwill Delicious! Works a treat.

➜  libsolidity $ pwd
/Users/travis/build/bobsummerwill/solidity/build/libsolidity
➜  libsolidity $ cd ../..
➜  solidity $ mv build build.back
➜  solidity $ solc
dyld: Library not loaded: /Users/travis/build/bobsummerwill/solidity/build/libsolidity/libsolidity.dylib
  Referenced from: /usr/local/bin/solc
  Reason: image not found
[1]    58864 trace trap  solc
➜  solidity $ cd ~/Downloads/solidity-develop-osx-elcapitan-new
➜  solidity-develop-osx-elcapitan-new $ ls -al
total 19720
drwx------@   8 max.kaye  ...      272 19 Jul 09:15 .
drwx------+ 344 max.kaye  ...    11696 19 Jul 09:15 ..
-rwxr-xr-x@   1 max.kaye  ...   440444 18 Jul 20:08 libdevcore.dylib
-rwxr-xr-x@   1 max.kaye  ...  2683900 18 Jul 20:08 libevmasm.dylib
-r--r--r--@   1 max.kaye  ...   208240 18 Jul 20:08 libjsoncpp.1.dylib
-rwxr-xr-x@   1 max.kaye  ...  5279888 18 Jul 20:08 libsolidity.dylib
-rwxr-xr-x@   1 max.kaye  ...    65888 18 Jul 20:08 lllc
-rwxr-xr-x@   1 max.kaye  ...  1403560 18 Jul 20:08 solc
➜  solidity-develop-osx-elcapitan-new $ ./solc
solc, the Solidity commandline compiler.
Usage: solc [options] [input_file...]
<snip>

NB for others: if you want solc globally executable it's easiest to just copy the entire contents of the zip to /usr/local/bin/

bobsummerwill commented 8 years ago

Woohoo - thanks very much for the confirmation!

Bonus points which came out of rebuilding the automation is that we now support OS X Mavericks, as well as OS X Yosemite and OS X El Capitan (with work-in-progress on the macOS Sierra preview).

I had to get those working because it appears that TravisCI runs on 2009 era Mac Pro boxes (via VMWare), and doesn't like running binaries built on Yosemite or newer (xcode 7.0+)

This delight ... http://stackoverflow.com/questions/14268887/what-is-the-illegal-instruction-4-error-and-why-does-mmacosx-version-min-10

axic commented 8 years ago

@graup is the current documentation still confusing? Would you be able to summarize in a few points here how to improve it?

graup commented 8 years ago

Since npm install solc now works as expected, I think this issue can be closed.