4

Let's go step by step with my full trace and see if anyone can help. Basically, I can't even get the example to work in the documentation:

First, start geth on Windows 10, 64 bit on a private test network.

D:\archive\prog\ethereum\Geth-Win64-latest>geth --networkid 54321 --genesis genesis.json --datadir .ethereum_experiment console

Let it come up...

I0506 16:50:03.380287   13936 database.go:71] Alloted 16MB cache to .ethereum_experiment\chaindata
I0506 16:50:03.414806   13936 database.go:71] Alloted 16MB cache to .ethereum_experiment\dapp
I0506 16:50:03.431311   13936 backend.go:314] Protocol Versions: [63 62 61], Network Id: 54321
I0506 16:50:03.431812   13936 genesis.go:89] Genesis block already in chain. Writing canonical number
I0506 16:50:03.431812   13936 backend.go:326] Successfully wrote genesis block. New genesis hash = bb7de14b2509aeff30096e412ba22e8a9a86c2cd734ba8fd5a0d6f91e5e4d1bf
I0506 16:50:03.432312   13936 backend.go:362] Blockchain DB Version: 3
I0506 16:50:03.432312   13936 blockchain.go:214] Last header: #0 [bb7de14b…] TD=1048576
I0506 16:50:03.432812   13936 blockchain.go:215] Last block: #0 [bb7de14b…] TD=1048576
I0506 16:50:03.432812   13936 blockchain.go:216] Fast block: #0 [bb7de14b…] TD=1048576
I0506 16:50:03.435815   13936 cmd.go:115] Starting Geth/v1.3.6/windows/go1.5.1
I0506 16:50:03.436316   13936 server.go:311] Starting Server
I0506 16:50:05.495355   13936 nat.go:111] mapped network port udp:30303 -> 30303 (ethereum discovery) using UPNP IGDv1-IP1
I0506 16:50:05.589213   13936 udp.go:212] Listening, enode://caa503a9c083524e25149ce2363805c9fccddad96003466f8b77e039b0e594266c509811b4e1aa865948609520f72e29078adbdb7d4c003fde198d676068c9db@98.207.1.52:30303
I0506 16:50:05.589712   13936 server.go:552] Listening on [::]:30303
I0506 16:50:05.589712   13936 backend.go:526] Server started
I0506 16:50:05.590712   13936 ipc.go:112] IPC service started (\\.\pipe\geth.ipc)
I0506 16:50:05.591712   13936 nat.go:111] mapped network port tcp:30303 -> 30303 (ethereum p2p) using UPNP IGDv1-IP1
instance: Geth/v1.3.6/windows/go1.5.1
 datadir: .ethereum_experiment
coinbase: 0x4c6dfd596afe1ce8c01cec00e2042f04f159957e
at block: 0 (Wed, 31 Dec 1969 16:00:00 PST)
modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0

Cool... Let's see if there are any compilers installed. I put solc.exe in my path..

> web3.eth.getCompilers();
I0506 16:50:12.735747   13936 solidity.go:114] solc, the solidity compiler commandline interface
Version: 0.3.0-1f9578ce/Release-Windows/msvc/JIT linked to libethereum-

path: C:\Program Files\Ethereum\solc.exe
["Solidity"]

Nice... that seemed to work. Getting excited. Let's try the example.

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

Cool... so far so good. I feel I am close now!

> contract = eth.compile.solidity(source).test

solc: no build results found
    at InvalidResponse (<anonymous>:-81662:-45)
    at send (<anonymous>:-156322:-45)
    at solidity (<anonymous>:-133322:-45)
    at <anonymous>:1:12

....and BOOM. fail.

The previous trace shows my solidity version is 0.3.0.

This trace here shows my geth version is 1.3.6

D:\archive\prog\ethereum\Geth-Win64-latest>geth --help
NAME:
   geth - the go-ethereum command line interface

USAGE:
   geth [options] command [command options] [arguments...]

VERSION:
   1.3.6

I posted this question on the gitter chat room as well as the ethereum forum with no luck so far.

Any help or ideas appreciated. Apologies if I am doing something incredibly dumb.

1

Issue

The compiler is not generating the *.bin output file in the temporary directory.

From go-ethereum - common/compiler/solidity.go, lines 127 to 163:

func (sol *Solidity) Compile(source string) (map[string]*Contract, error) {
    // Short circuit if no source code was specified
    if len(source) == 0 {
        return nil, errors.New("solc: empty source string")
    }
    // Create a safe place to dump compilation output
    wd, err := ioutil.TempDir("", "solc")
    if err != nil {
        return nil, fmt.Errorf("solc: failed to create temporary build folder: %v", err)
    }
    defer os.RemoveAll(wd)

    // Assemble the compiler command, change to the temp folder and capture any errors
    stderr := new(bytes.Buffer)

    var params []string
    if sol.legacy {
        params = paramsLegacy
    } else {
        params = paramsNew
        params = append(params, wd)
    }
    compilerOptions := strings.Join(params, " ")

    cmd := exec.Command(sol.solcPath, params...)
    cmd.Dir = wd
    cmd.Stdin = strings.NewReader(source)
    cmd.Stderr = stderr

    if err := cmd.Run(); err != nil {
        return nil, fmt.Errorf("solc: %v\n%s", err, string(stderr.Bytes()))
    }
    // Sanity check that something was actually built
    matches, _ := filepath.Glob(wd + "/*\\.bin*")
    if len(matches) < 1 {
        return nil, fmt.Errorf("solc: no build results found")
    }

From golang.org - os/file_windows.go, lines 510 to 524, the Go function os.TempDir() calls the Windows GetTempPath() function.

510 // TempDir returns the default directory to use for temporary files.
511 func TempDir() string {
512     n := uint32(syscall.MAX_PATH)
513     for {
514         b := make([]uint16, n)
515         n, _ = syscall.GetTempPath(uint32(len(b)), &b[0])
516         if n > uint32(len(b)) {
517             continue
518         }
519         if n > 0 && b[n-1] == '\\' {
520             n--
521         }
522         return string(utf16.Decode(b[:n]))
523     }
524 }

And from microsoft.com - GetTempPath:

The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:

  1. The path specified by the TMP environment variable.
  2. The path specified by the TEMP environment variable.
  3. The path specified by the USERPROFILE environment variable.
  4. The Windows directory.


Possible Solutions

  1. Check your TMP and TEMP environment variables. Use the Windows SET command to find the location that these environment variables point to, and try creating a subdirectory and file in these directories. Correct this issue if necessary.

  2. Try running geth with the --datadir subdirectory from the same drive as the drive pointed to by your temporary environment variables.

  3. If you still cannot resolve your issue, please update your question with further information including the details on your environment variables and your testing whether the temporary directory can be written to.

1

My problem was solved using the latest Geth.

In Windows, I noticed a forward slash (d:\ethereum\ethereumchain/testnet) which I think caused the failure. The latest geth (Geth 1.4.4) displayed the directory in the right way: d:\ethereum\ethereumchain\testnet

No more ": solc: no build results found" for me.

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.