bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unable to build the readrec Bash builtin on M2 Mac [with solution]


From: Ben Block
Subject: Unable to build the readrec Bash builtin on M2 Mac [with solution]
Date: Thu, 27 Apr 2023 12:25:18 -0400

Hello and thanks to Jose & co. for all the great work on recutils.

Recently I had some trouble building the readrec Bash builtin on an M2 Macbook Air (using recutils-1.9). I was able to eventually get it built by modifying some source code and updating the ./configure call with some specific options. Thanks to Jose for aiding with debugging this on the IRC channel.

I wanted to share the steps here in case anyone else runs into this in the future, and in hopes that it is helpful for putting a fix together in recutils so that the builtin is able to be installed on MacOS without issue in a future release.

======================================================================

             Building readrec Bash builtin on Macbook M2

======================================================================

Issue: readrec Bash builtin would not build on an M2 Macbook Air
running Bash 5.2.

This was due to the Bash headers not being in the expected location,
some gcc errors that would occur while trying to build the builtin,
and incorrect paths to the Bash headers in the bash/ Makefile.in and
Makefile.am files.

----------------------------------------------------------------------

Updated args for running ./configure:

  ./configure --with-bash-
  headers=/opt/homebrew/Cellar/bash/5.2.15/include CFLAGS="-O3 -g
  -std=gnu89" CC="gcc -Wno-implicit-function-declaration"
  LDFLAGS="-L/opt/homebrew/Cellar/bash/5.2.15/lib"

  make

  sudo make install

  enable -f /usr/local/lib/readrec.so readrec

  NOTE: I could probably change the --with-bash-headers= command to
  end with /include/bash and clean up some of the Makefile work.

----------------------------------------------------------------------

Files changed after cloning recutils-1.9:

  bash/Makefile.am
    COMMON_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
    -I$(top_srcdir)/src -DHAVE_CONFIG_H
    -I$(BASH_HEADERS) -I$(BASH_HEADERS)/bash
    -I$(BASH_HEADERS)/bash/builtins
    -I$(BASH_HEADERS)/bash/include

  bash/Makefile.in
    @BASH_BUILTINS_TRUE@ -I$(BASH_HEADERS) -I$(BASH_HEADERS)/bash
    -I$(BASH_HEADERS)/bash/builtins \
    @BASH_BUILTINS_TRUE@ -I$(BASH_HEADERS)/bash/include

  configure
    if test -f ${BASH_HEADERS}/bash/config.h; then

----------------------------------------------------------------------

After these updates, I was able to build readrec with the following
commands:

  ./configure [with options specified above]
  make
  sudo make install

reply via email to

[Prev in Thread] Current Thread [Next in Thread]