forge build result in generic "Solc Error:"
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.
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.
Fixed by installing z3 with brew install z3
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?
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.
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 just to understand the solution if you are on apple silicon
- nuke the
~/.svm/*folder - install
z3from brew - install solc
?
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
ok, everything works like a charm!
awesome, thanks for flagging, will add some troubleshooting docs for M1
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.
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..
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
You need to follow the next steps:
- Delete
~/.svm - Intall z3
brew install z3 - Install solc
npm i -g solc
@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
Folks. Could you please tell me how to downgrade foundry? I got macos
forge test --use $(which solc) that may help you
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 ...
@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
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
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