foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.31k stars 1.75k forks source link

"Nothing to compile" on fresh foundry install and forge init #9282

Closed travs closed 1 week ago

travs commented 1 week ago

Component

Forge

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

What version of Foundry are you on?

forge 0.2.0 (58bf161 2024-11-07T00:20:40.732513260Z)

What command(s) is the bug in?

forge build

Operating System

Windows

Describe the bug

I selected windows as the OS in my bug report, but really it is WSL:

$ uname -r
5.15.153.1-microsoft-standard-WSL2

When I initialize a new project with forge init, it isn't picking up the contracts when I do forge build.

$ forge init hello_foundry
Initializing /home/travis/prg/random/hello_foundry...
Installing forge-std in /home/travis/.config/.foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None)
Cloning into '/home/travis/.config/.foundry/lib/forge-std'...
remote: Enumerating objects: 1928, done.
remote: Counting objects: 100% (1923/1923), done.
remote: Compressing objects: 100% (736/736), done.
remote: Total 1928 (delta 1289), reused 1725 (delta 1140), pack-reused 5 (from 1)
Receiving objects: 100% (1928/1928), 622.81 KiB | 3.87 MiB/s, done.
Resolving deltas: 100% (1289/1289), done.
    Installed forge-std v1.9.4
    Initialized forge project

$ cd hello_foundry

$ forge build
Nothing to compile

$ tree
.
├── README.md
├── foundry.toml
├── script
│   └── Counter.s.sol
├── src
│   └── Counter.sol
└── test
    └── Counter.t.sol

3 directories, 5 files

$ cat foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]

$ which forge
/home/travis/.config/.foundry/bin/forge

I uninstalled foundry with rm -rf ~/.config/.foundry, then reinstalled with the curl command from the wiki. Tried again and same result.

travs commented 1 week ago

Weirdly, doing forge build . works (but still not forge build without the .).

Not sure why this would be the case on my system, but please feel free to close this as irrelevant.

travs commented 1 week ago

Found out I had set FOUNDRY_ROOT to something else, giving this wierdness. Closing.