homebrew-avr icon indicating copy to clipboard operation
homebrew-avr copied to clipboard

Homebrew avr-gdb build broken on macOS

Open second-string opened this issue 1 year ago • 4 comments
trafficstars

On macOS Sonoma 14.6.1, M1 MacBook Pro, I cannot build/install avr-gdb from home-brew.

I have successfully installed the main toolchain with brew install avr-gcc. When executing brew install avr-gdb, all of the home-brew dependencies download and update correctly, but I get an error in the final make call of the build.

[2726] <name>@<name>-mbp /opt/.../avr-gcc@9/9.4.0_1 (stable) $ brew install avr-gdb
==> Fetching dependencies for osx-cross/avr/avr-gdb: [email protected] and texinfo
==> Fetching [email protected]
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/manifests/3.9.19_1
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/7d5ecae27ba7a9eff93afb08c5f49da947202b856cdabac33980ebd081994385--python@3.9-3.9.19_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/blobs/sha256:57f58fe8682f4dbcf39f5f4f1cedb0c7ce6f75275d7325fb1b314f9574d4842f
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/2c992d968f3e8100adf8ca65cf211112246e0370dcd6772453e1309620d23e07--python@3.9--3.9.19_1.arm64_sonoma.bottle.tar.gz
==> Fetching texinfo
==> Downloading https://ghcr.io/v2/homebrew/core/texinfo/manifests/7.1
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/a6ba99ebaacd398154745b25484544963ff1b229ee0e853ecb3e17f744c69f76--texinfo-7.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/texinfo/blobs/sha256:6ee1d5c2e64d80dcc8da4639d55d6c7a907550efd3ecfb4757f719f875e3df1b
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/2b03b8291213a3c1ceaef53f7e68a68b63b2657f298040e58423d760b6400f9d--texinfo--7.1.arm64_sonoma.bottle.tar.gz
==> Fetching osx-cross/avr/avr-gdb
==> Downloading https://raw.githubusercontent.com/osx-cross/homebrew-avr/18d50ba2a168a3b90a25c96e4bc4c053df77d7dc/Patch/avr-binutils-elf-bfd-gdb-fix.patch
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ftp.gnu.org/gnu/gdb/gdb-10.1.tar.xz
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/d6dfd55ca620ab89b3209b96be8cac6a9b85c636faf527f4c5e4bc7e7ff07cee--gdb-10.1.tar.xz
==> Installing avr-gdb from osx-cross/avr
==> Installing dependencies for osx-cross/avr/avr-gdb: [email protected] and texinfo
==> Installing osx-cross/avr/avr-gdb dependency: [email protected]
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/manifests/3.9.19_1
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/7d5ecae27ba7a9eff93afb08c5f49da947202b856cdabac33980ebd081994385--python@3.9-3.9.19_1.bottle_manifest.json
==> Pouring [email protected]_1.arm64_sonoma.bottle.tar.gz
==> /opt/homebrew/Cellar/[email protected]/3.9.19_1/bin/python3.9 -Im ensurepip
==> /opt/homebrew/Cellar/[email protected]/3.9.19_1/bin/python3.9 -Im pip install -v --no-index --upgrade --isolated --target=/opt/homebrew/lib/python3.9/site-packages /opt/homebrew/Cellar/[email protected]/3.9.19_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ensurepip/_bun
🍺  /opt/homebrew/Cellar/[email protected]/3.9.19_1: 3,068 files, 56.7MB
==> Installing osx-cross/avr/avr-gdb dependency: texinfo
==> Downloading https://ghcr.io/v2/homebrew/core/texinfo/manifests/7.1
Already downloaded: /Users/<name>/Library/Caches/Homebrew/downloads/a6ba99ebaacd398154745b25484544963ff1b229ee0e853ecb3e17f744c69f76--texinfo-7.1.bottle_manifest.json
==> Pouring texinfo--7.1.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/texinfo/7.1: 494 files, 9.1MB
==> Installing osx-cross/avr/avr-gdb
==> Patching
==> Applying avr-binutils-elf-bfd-gdb-fix.patch
patching file 'bfd/elf-bfd.h'
==> ../configure --target=avr --prefix=/opt/homebrew/Cellar/avr-gdb/10.1 --disable-debug --disable-dependency-tracking --disable-binutils --disable-nls --disable-libssp --disable-install-libbfd --disable-install-libiberty --with-python=/opt/homebrew/opt/[email protected]/bin/py
==> make
Last 15 lines from /Users/<name>/Library/Logs/Homebrew/avr-gdb/02.make:
4 errors generated.
make[2]: *** [ada-exp.o] Error 1
3 errors generated.
make[2]: *** [ada-tasks.o] Error 1
In file included from ../../gdb/addrmap.c:20:
In file included from ../../gdb/defs.h:65:
../../gdb/../gdbsupport/enum-flags.h:85:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
    integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                   ^
1 error generated.
make[2]: *** [addrmap.o] Error 1
4 errors generated.
make[2]: *** [ada-lang.o] Error 1
make[1]: *** [all-gdb] Error 2
make: *** [all] Error 2

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

second-string avatar Sep 05 '24 13:09 second-string

Edit: the comment was deleted. aka spam.

...I'm not downloading a random file and compiling something from a bitly link. Given the fact that you posted this 1 minute after me I'm assuming this is bot spam

second-string avatar Sep 05 '24 13:09 second-string

Same problem !

WalderlanSena avatar Sep 13 '24 00:09 WalderlanSena

I get the same issue with slightly different errors. This is on a 2023 MacBook Pro M3 Max, Sonoma 14.6.1

❯ brew install avr-gdb (base) ==> Fetching osx-cross/avr/avr-gdb ==> Downloading https://raw.githubusercontent.com/osx-cross/homebrew-avr/18d50ba2a168a3b90a25c96e4bc4c053df77d7dc/Patch/av Already downloaded: /Users/jefferydech/Library/Caches/Homebrew/downloads/0ca5d8e65886bc674f0ba0ec9f98e4b657920f87f9784a16f9fca756681475b3--avr-binutils-elf-bfd-gdb-fix.patch ==> Downloading https://ftp.gnu.org/gnu/gdb/gdb-10.1.tar.xz Already downloaded: /Users/jefferydech/Library/Caches/Homebrew/downloads/d6dfd55ca620ab89b3209b96be8cac6a9b85c636faf527f4c5e4bc7e7ff07cee--gdb-10.1.tar.xz ==> Installing avr-gdb from osx-cross/avr ==> Patching ==> Applying avr-binutils-elf-bfd-gdb-fix.patch patching file 'bfd/elf-bfd.h' ==> ../configure --target=avr --prefix=/opt/homebrew/Cellar/avr-gdb/10.1 --disable-debug --disable-dependency-tracking --d ==> make Last 15 lines from /Users/jefferydech/Library/Logs/Homebrew/avr-gdb/02.make: make[2]: *** [arch-utils.o] Error 1 3 errors generated. 4 errors generated. make[2]: *** [ada-tasks.o] Error 1 make[2]: *** [ada-exp.o] Error 1 3 errors generated. make[2]: *** [annotate.o] Error 1 3 errors generated. make[2]: *** [auto-load.o] Error 1 3 errors generated. make[2]: *** [auxv.o] Error 1 4 errors generated. make[2]: *** [ada-lang.o] Error 1 make[1]: *** [all-gdb] Error 2 make: *** [all] Error 2

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

These open issues may also help: Homebrew avr-gdb build broken on macOS https://github.com/osx-cross/homebrew-avr/issues/343

jeffdech avatar Sep 15 '24 04:09 jeffdech

Looks like this is a known issue with gdb that was patched for gdb 13.2. Also see mention of a workaround by ignoring -Wenum-constexpr-conversion.

Unfortunately, I'm not savvy enough with this stuff to modify the Makefile to do the ignore and test it. Happy to help any way I can though.

jeffdech avatar Sep 16 '24 04:09 jeffdech

Using the link from @jeffdech, I tried manually downloading GDB 10.1 (the version we currently have in our avr-gdb formula) and applying the two patches outlined in the issue (manually, not with git apply, since the patches had been generated from newer versions of the files than the ones we have in 10.1).

Building and running seemed to work fine; I was able to step thru a simple program built by avr-gcc, with GDB in target remote mode pointing to simavr.

So hypothetically we could add these patches to our formula. However, I also tried the latest GDB 15.2, and that worked for me too. So I wonder if we should just upgrade our formula to the newer version and match the upstream gdb formula on homebrew-core? Or do like we have for avr-gcc and have separate version-locked formulae? I can volunteer to open a PR either way.

reillylm avatar Oct 26 '24 23:10 reillylm

If it works I think it makes sense to use the latest version. Sticking to what brew/core is doing is usually the simplest way to go

I'll review your or as soon as you make it 🙂

ladislas avatar Oct 27 '24 10:10 ladislas

this should be fixed by 30dace29e690270a89fd1bd1ad8983c2464b1b6b i'll close the issue, feel free to reopen if needed

ladislas avatar Nov 25 '24 16:11 ladislas