foundry: forge build fails with solc 0.6.12

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (b951f65 2022-03-26T04:46:06.407207863+00:00)

What command(s) is the bug in?

forge build

Operating System

Linux

Describe the bug

When I open a new project but change the solidity version to 0.6.12 forge build fails:

$ forge init forge-2
Initializing $PATH/forge-2...
Installing ds-test in "$PATH/forge-2/lib/ds-test", (url: https://github.com/dapphub/ds-test, tag: None)
    Installed ds-test
    Initialized forge project.
$ cd forge-2
$ forge build
[⠊] Compiling...
[⠢] Compiling 3 files with 0.8.10
Compiler run successful
$ sed -i 's/0.8.10/0.6.12/' src/Contract.sol 
$ grep pragma src/Contract.sol
pragma solidity 0.6.12;
$ forge build
[⠢] Compiling...
Error: 
   0: Solc Error: 

Location:
   cli/src/cmd/utils.rs:40

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
$ forge --version
forge 0.2.0 (b951f65 2022-03-26T04:46:06.407207863+00:00)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (15 by maintainers)

Most upvoted comments

If rebuild solves the problem, I’ll update the remaining 30 static binaries 😃

solc $ ls linux/aarch64/* | xargs -n 1 file | grep static | wc -l
      30

Confirmed that with the newest version of forge I no longer need to use the --offline workaround, the downloaded solc just works.

Thank you for the quick help and for the quick resolution! Also, thank you for foundry in general, outside of the little trouble I had here with getting started forge&cast have been immensely helpful, an absolute delight ❤️

@lithp Yes, running with --offline should skip it 😃

Hi @roynalnaruto! I’ve recompiled and published the remaining binaries. Feel free to update svm-rs 😃

@nikitastupin you can also tag me, so I can update svm-rs once you’ve pushed new binaries.

Perhaps I’ve produced the 0.6.12 version with different compiler options because 0.6.12 binary from the nikitastupin/solc is statically linked while it should be dynamically linked.

% file solc-v0.6.12
solc-v0.6.12: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.7.0, BuildID[sha1]=7c6fdc07ff8d037a626ee1724e31b2d5a2a7532c, with debug_info, not stripped
% file solc-v0.8.13
solc-v0.8.13: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=3eb9fd783d7d83fe0505c62d9b42b9160bb27fa2, not stripped

Let me reproduce the issue locally and fix that.