shellunixautotoolsfreetds

Fatal error: 'readline/readline.h' file not found


I am trying to compile FreeTDS for the iPhoneOS platform using Autotools. However, I get the error:

Making all in fisql
  CC       fisql.o
fisql.c:29:10: fatal error: 'readline/readline.h' file not found
#include <readline/readline.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [fisql.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I am using a shell script to run the commands:

#!/bin/sh

VERSION="1.3"
SDKVERSION="14.0"
TARGETSDKVERSION="11.0"
LIB="freetds"

DEVELOPER=`xcode-select -print-path`
ARCHS="arm64"
CURRENTPATH=`pwd`
BUILD="x86_64-apple-darwin19.6.0"
OLD_PATH=$PATH
TDS_VER=7.4

cd ${LIB}-${VERSION}

unset CC
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset LD
unset CPP

for ARCH in ${ARCHS}
do
    case "${ARCH}" in
        "x86_64")
            PLATFORM="MacOSX"
            HOST="${ARCH}-apple-darwin19.6.0"
            ;;
        "arm64")
            PLATFORM="iPhoneOS"
            HOST="aarch64-apple-darwin19.6.0"
            ;;
        *)
            PLATFORM="iPhoneOS"
            HOST="${ARCH}-apple-darwin19.6.0"
            ;;
    esac

    SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
    export CC="clang"
    export CFLAGS="-arch ${ARCH} -isysroot ${SDK} -miphoneos-version-min=11.0"
    export CXXFLAGS="$CFLAGS"
    export LDFLAGS="$CFLAGS"
    export LD=$CC
    # export CFLAGS="-arch ${ARCH} -miphoneos-version-min=${TARGETSDKVERSION} -isysroot ${SDK}"

    PREFIX="${CURRENTPATH}/build/${LIB}/${ARCH}"

    mkdir -p ${PREFIX}

    echo "Please stand by..."

    ./configure --prefix=$PREFIX --host=${HOST} -build=${BUILD} -with-tdsver=${TDS_VER} CFLAGS="${CFLAGS}"

    echo "======== NOW LETS MAKE ========"


    make clean
    make && make install

    echo "======== CHECK ARCH ========"
    xcrun -sdk iphoneos lipo -info ${PREFIX}/lib/libsybdb.a
    echo "======== CHECK DONE ========"

done

echo "== We just need static library == "
echo "== Copy headers to fat folder from i386 folder AND clean files in lib =="
cp -r ${CURRENTPATH}/build/${LIB}/i386/ ${CURRENTPATH}/build/${LIB}/Fat
rm -rf ${CURRENTPATH}/build/${LIB}/Fat/lib/*

echo "Build library - libsybdb.a"
lipo -create ${CURRENTPATH}/build/${LIB}/i386/lib/libsybdb.a  ${CURRENTPATH}/build/${LIB}/armv7/lib/libsybdb.a  ${CURRENTPATH}/build/${LIB}/armv7s/lib/libsybdb.a  ${CURRENTPATH}/build/${LIB}/arm64/lib/libsybdb.a  ${CURRENTPATH}/build/${LIB}/x86_64/lib/libsybdb.a  -output ${CURRENTPATH}/build/${LIB}/Fat/lib/libsybdb.a

echo "======== CHECK FAT ARCH ========"
xcrun -sdk iphoneos lipo -info ${CURRENTPATH}/build/${LIB}/Fat/lib/libsybdb.a
echo "======== CHECK DONE ========"

echo "== Done =="

I tried to fix it by using home-brew to install readline, but no luck so far. I understand that the file can't be found (or it's not where it's supposed to be), but how can I fix it?


Solution

  • I brew reinstalled readline and this fixed the issue.