foundry icon indicating copy to clipboard operation
foundry copied to clipboard

forge build result in generic "Solc Error:"

Open StErMi opened this issue 4 years ago • 23 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (6cd6618 2022-08-11T00:05:44.416299Z)

What command(s) is the bug in?

forge build

Operating System

macOS (Apple Silicon M1)

Describe the bug

When I try to build and test the project, I get the following error

[⠊] Compiling...
[⠰] installing solc version "0.8.15"
[⠒] Successfully installed solc 0.8.15
Error: 
Solc Error: 

I'm pretty sure it was working correctly yesterday

Update 1: something to note is that solc 0.8.15 as far as I know is already installed, so it should just directly compile without downloading and installing

Update 2: if I switch all the contracts to pragma solidity 0.8.13; it does compile. And it does not try to download+install solc 0.8.13. With pragma solidity 0.8.15; it tries to do so even if I should have already installed.

StErMi avatar Aug 11 '22 09:08 StErMi

Experiencing the same issue, confirming everything works fine if I downgrade to 0.8.13 or 0.8.14. I'm also on M1 and use 0.8.15. Worked perfectly until the latest foundryup.

RensR avatar Aug 11 '22 11:08 RensR

Fixed by installing z3 with brew install z3

RensR avatar Aug 11 '22 12:08 RensR

this could be related to the recent 0.8.16 we added.

could you please nuke the ~/.svm/* folder, that's where we install all solc versions and try again?

mattsse avatar Aug 11 '22 12:08 mattsse

Nuking the folder did not solve the issue. I found a more explicit error message

Solc Error: dyld[60885]: Library not loaded: '/opt/homebrew/opt/z3/lib/libz3.dylib' Referenced from: '/Users/rens/.svm/0.8.15/solc-0.8.15' Reason: tried: '/opt/homebrew/opt/z3/lib/libz3.dylib' (no such file), '/usr/local/lib/libz3.dylib' (no such file), '/usr/lib/libz3.dylib' (no such file)

After installing z3 everything works fine again.

RensR avatar Aug 11 '22 12:08 RensR

right, we now ship with z3 solver. need to document this, thanks, on the book, https://github.com/foundry-rs/book/issues/515

closing this here

mattsse avatar Aug 11 '22 12:08 mattsse

@mattsse just to understand the solution if you are on apple silicon

  • nuke the ~/.svm/* folder
  • install z3 from brew
  • install solc

?

StErMi avatar Aug 11 '22 12:08 StErMi

first two points

nuke the ~/.svm/* folder install z3 from brew

should be sufficient, since we handle installs directly via forge,

I think what probably happened here is that we recently added z3 to the apple silicon builds so checksums differ now

mattsse avatar Aug 11 '22 13:08 mattsse

ok, everything works like a charm!

StErMi avatar Aug 11 '22 13:08 StErMi

awesome, thanks for flagging, will add some troubleshooting docs for M1

mattsse avatar Aug 11 '22 13:08 mattsse

I was on an M1 Pro with OS 11.x and was unable to resolve this issue with z3 or libusb installs, compiling from source, or using the install script.

But, what finally worked was updating the OS entirely to 12.5.1 and was then able to successfully run forge build and forge test.

Leaving this note here in case this helps anyone else who comes here searching for a solution to the similar problem I had.

pagreczner avatar Aug 27 '22 12:08 pagreczner

I tried the steps (deleting the SVM, installing z3) and it does not work on my M1 Mac on Big Sur 11.6.2. Might have to try updating to 12+, unless there's another option..

vchensupra avatar Nov 14 '22 06:11 vchensupra

updating

I have also encountered the same problem on my M1 Big Sur 11.6, and I have already tried the same steps.

The error: Solc Error: dyld: Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEEC1Ev Referenced from: ~/.svm/0.8.18/solc-0.8.18 (which was built for Mac OS X 13.0) Expected in: /usr/lib/libc++.1.dylib

achiko avatar Feb 18 '23 16:02 achiko

You need to follow the next steps:

  1. Delete ~/.svm
  2. Intall z3 brew install z3
  3. Install solc npm i -g solc

RafaBlockDev avatar Mar 03 '23 00:03 RafaBlockDev

@achiko Im getting same error as you. deleting .svm, installing z3 and npm i -g solc did not work for me. Did you find a solution? Also note that im having no issues with solc 0.8.13

ljrahn avatar Apr 11 '23 00:04 ljrahn

Folks. Could you please tell me how to downgrade foundry? I got macos

vlavrenenko-ethers avatar Apr 19 '23 16:04 vlavrenenko-ethers

forge test --use $(which solc) that may help you

kalloc avatar May 27 '23 22:05 kalloc

I met this error because I used an 4G memory server, the memory is not enough to compile my all contracts, so, when I update a new 8G memory server, the problem is sloved ...

libaice avatar Oct 25 '23 07:10 libaice

@ljrahn I'm getting the same error as you and @achiko -- Solc Error: dyld: Symbol not found: __ZNSt3__113basic_filebufIcNS_11char_traitsIcEEEC1Ev Referenced from: ~/.svm/0.8.18/solc-0.8.18 (which was built for Mac OS X 13.0) Expected in: /usr/lib/libc++.1.dylib -- were you able to solve it since April? I'm still running macOS 10.15.7 but I don't think that's the main reason for it to fail, any help would be much appreciated

intldds avatar Nov 08 '23 10:11 intldds

hello guys, I have the same problem, but I have a macbook with an Intel chip, so the solutions above don't work for me. And updates to newer versions of the mac OS are not available to me

R-Morpheus avatar Nov 16 '23 02:11 R-Morpheus

My problem is like

[⠊] Compiling...
[⠘] Installing Solc version 0.8.24
[⠢] Successfully installed Solc 0.8.24
Error: 
solc exited with signal: 6 (SIGABRT)
dyld: Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
  Expected in: /usr/lib/libc++.1.dylib

I'm new to here, how to deal with it

unipooop avatar Feb 20 '24 17:02 unipooop