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

Intel Mac: Install riscv-tools failed for Submodule newlib #126

Open
Wei-Alwayers opened this issue Apr 20, 2024 · 4 comments
Open

Intel Mac: Install riscv-tools failed for Submodule newlib #126

Wei-Alwayers opened this issue Apr 20, 2024 · 4 comments

Comments

@Wei-Alwayers
Copy link

Device: Intel Mac
OS: Ventura 13.6.4

brew install riscv-tools

brew install riscv-tools Running brew update --auto-update...
==> Fetching dependencies for riscv-software-src/riscv/riscv-tools: riscv-software-src/riscv/riscv-gnu-toolchain, riscv-software-src/riscv/riscv-isa-sim and riscv-software-src/riscv/riscv-pk
==> Fetching riscv-software-src/riscv/riscv-gnu-toolchain
==> Cloning https://github.com/riscv/riscv-gnu-toolchain.git
......
==> Installing riscv-tools from riscv-software-src/riscv
==> Installing dependencies for riscv-software-src/riscv/riscv-tools: riscv-software-src/riscv/riscv-gnu-toolchain, riscv-software-src/riscv/riscv-isa-sim and riscv-software-src/riscv/riscv-pk
==> Installing riscv-software-src/riscv/riscv-tools dependency: riscv-softw
==> git submodule update --depth 1 --init --recursive newlib

git
submodule
update
--depth
1
--init
--recursive
newlib

Submodule 'newlib' (https://sourceware.org/git/newlib-cygwin.git) registered for path 'newlib'
Cloning into '/private/tmp/riscv-gnu-toolchain-20240420-38095-wdj58y/newlib'...
error: Server does not allow request for unadvertised object 26f7004bf73c421c3fd5e5a6ccf470d05337b435
Fetched in submodule path 'newlib', but it did not contain 26f7004bf73c421c3fd5e5a6ccf470d05337b435. Direct fetching of that commit failed.

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
https://github.com/riscv-software-src/homebrew-riscv/issues

@escflee
Copy link

escflee commented Apr 23, 2024

Same. Are there any workarounds for this problem?

@chuckb
Copy link

chuckb commented May 25, 2024

Same here. I can do git clone --recursive https://github.com/riscv-collab/riscv-gnu-toolchain and it clones (newlib included).

Ok, here is a work-around. In the directory /usr/local/Homebrew/Library/Taps/riscv-software-src/homebrew-riscv, edit the file riscv-gnu-toolchain.rb. Find the line where the below comment appears, delete the three git lines as they appear, and replace with the following:

    # need to pull in needed submodules (now that they are disabled above)
    system "git", "submodule", "update", "--init", "newlib/"
    system "git", "submodule", "update", "--depth", "1", "--init", "newlib"
    system "git", "submodule", "update", "--init", "binutils/"
    system "git", "submodule", "update", "--depth", "1", "--init", "binutils"
    system "git", "submodule", "update", "--init", "gcc/"
    system "git", "submodule", "update", "--depth", "1", "--init", "gcc"

Now I have a built binary that runs, although the brew test riscv-tools fails. Still trying to figure out why.

Here is the test result:

$ brew test riscv-tools
==> Testing riscv-software-src/riscv/riscv-tools
==> /usr/local/opt/riscv-gnu-toolchain/bin/riscv64-unknown-elf-gcc /private/tmp/riscv-tools-test-20240524-10521-qsq861/hello.c
==> spike pk /private/tmp/riscv-tools-test-20240524-10521-qsq861/a.out
Error: riscv-software-src/riscv/riscv-tools: failed
An exception occurred within a child process:
  Minitest::Assertion: --- expected
+++ actual
@@ -1,2 +1 @@
-"bbl loader\r
-hello"
+"hello"

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/lib/minitest/assertions.rb:183:in `assert'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/lib/minitest/assertions.rb:223:in `assert_equal'
/usr/local/Homebrew/Library/Taps/riscv-software-src/homebrew-riscv/riscv-tools.rb:27:in `block in <class:RiscvTools>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2786:in `block (3 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/extend/kernel.rb:529:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2785:in `block (2 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1189:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2784:in `block in run_test'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `run'
/usr/local/Homebrew/Library/Homebrew/formula.rb:3095:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2778:in `run_test'
/usr/local/Homebrew/Library/Homebrew/test.rb:46:in `block in <main>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.1/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.1/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.1/lib/ruby/3.3.0/timeout.rb:195:in `timeout'
/usr/local/Homebrew/Library/Homebrew/test.rb:50:in `<main>'

@sbeamer
Copy link
Collaborator

sbeamer commented Sep 2, 2024

I'm not able to reproduce the cloning issue, but it can be tricky to deal with these sorts of issues. Building from head appears stuck in general due to #127, so until that is fixed, it will be hard to confirm other build issues.

@sbeamer
Copy link
Collaborator

sbeamer commented Oct 28, 2024

Building is now fixed and I have pushed new pre-built bottles. Please let me know if there is any additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants