Skip to content

Instantly share code, notes, and snippets.

@palaniraja
Created February 24, 2026 23:54
Show Gist options
  • Select an option

  • Save palaniraja/c3e22d747448c4599212bf5b5de35829 to your computer and use it in GitHub Desktop.

Select an option

Save palaniraja/c3e22d747448c4599212bf5b5de35829 to your computer and use it in GitHub Desktop.
my attempt at building gdb on m1 mac to get gdb binary with --target=aarch64-apple-darwin
#!/bin/sh
# install additional dependencies
#brew install gmp mpfr libmpc texinfo pkg-config
# clean old config
# make distclean
# or force a clean
# rm -f config.cache
# find . -name config.cache -print -exec rm -f {} \;
# make distclean || true
# use a sane make - aarch64
# alias make=/opt/homebrew/bin/gmake
# unalias make
# set environment variables for the build
export AR=/usr/bin/ar
export NM=/usr/bin/nm
export RANLIB=/usr/bin/ranlib
export STRIP=/usr/bin/strip
export CC=clang
export CXX=clang++
export HOMEBREW_PREFIX=/opt/homebrew
export CPPFLAGS="-I${HOMEBREW_PREFIX}/include"
export LDFLAGS="-L${HOMEBREW_PREFIX}/lib"
export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/lib/pkgconfig"
# --host=aarch64-apple-darwin --enable-targets=all \
# x86_64-apple-darwin20
./configure --prefix=/usr/local/gdb --target=aarch64-apple-darwin \
--with-gmp=${HOMEBREW_PREFIX}/opt/gmp \
--with-mpfr=${HOMEBREW_PREFIX}/opt/mpfr \
--with-mpc=${HOMEBREW_PREFIX}/opt/libmpc
# make -j$(sysctl -n hw.ncpu) && sudo make -v install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment