Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forge build result in generic "Solc Error:" #2712

Closed
2 tasks done
StErMi opened this issue Aug 11, 2022 · 22 comments
Closed
2 tasks done

forge build result in generic "Solc Error:" #2712

StErMi opened this issue Aug 11, 2022 · 22 comments
Labels
T-bug Type: bug

Comments

@StErMi
Copy link

StErMi commented Aug 11, 2022

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 (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 StErMi added the T-bug Type: bug label Aug 11, 2022
@RensR
Copy link

RensR commented Aug 11, 2022

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
Copy link

RensR commented Aug 11, 2022

Fixed by installing z3 with brew install z3

@mattsse
Copy link
Member

mattsse commented Aug 11, 2022

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?

@RensR
Copy link

RensR commented Aug 11, 2022

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.

@mattsse
Copy link
Member

mattsse commented Aug 11, 2022

right, we now ship with z3 solver.
need to document this, thanks, on the book, foundry-rs/book#515

closing this here

@StErMi
Copy link
Author

StErMi commented Aug 11, 2022

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

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

?

@mattsse
Copy link
Member

mattsse commented Aug 11, 2022

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

@StErMi
Copy link
Author

StErMi commented Aug 11, 2022

ok, everything works like a charm!

@mattsse
Copy link
Member

mattsse commented Aug 11, 2022

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

@Genysys Genysys mentioned this issue Aug 11, 2022
2 tasks
@pagreczner
Copy link

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.

@vchensupra
Copy link

vchensupra commented Nov 14, 2022

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..

@achiko
Copy link

achiko commented Feb 18, 2023

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

@RafaBlockDev
Copy link

You need to follow the next steps:

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

@ljrahn
Copy link

ljrahn commented Apr 11, 2023

@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

@vlavrenenko-hacken
Copy link

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

@kalloc
Copy link

kalloc commented May 27, 2023

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

@libaice
Copy link

libaice commented Oct 25, 2023

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 ...

@intldds
Copy link

intldds commented Nov 8, 2023

@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

@R-Morpheus
Copy link

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

@unipooop
Copy link

unipooop commented Feb 20, 2024

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

@TheWilsonGlobal
Copy link

It does work for 0.8.25 only with mac intel chip
@R-Morpheus, @unipooop
Screen Shot 2024-08-09 at 08 18 17

@finxlfantasy
Copy link

Did you get it fixed? I get the same exact error. It only works when I use forge xyz --use 0.8.25

I've tried changing the remote compiler to "v0.8.25+commit.b61c2a91", but still nothing is working. Also tried putting in specific version in foundry.toml - not working either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests