I can't compile a C project in Termix on android, what should I do?

I'm trying to compile this C code project : https://github.com/msantos/sods it seems successfull using Ubuntu, Debian, Kali Linux and the others, but in Android on Termux it doesn't succeed as when I execute the make command, I get an error that libresolv.a is not found, I have realized that libresolv.a exists only in some Linux extensions like Debian, but it's not the same situation for android, the configure file doesn't even have a specific configuration for android, and now I'm confused because I didn't find an alternative for this libresolv.a in android, any solutions?

I have tried to get help from ChatGPT but it didn't help me as I expected.

EDIT to be more clear here is what I have done in Termux :

pkg install git
git clone https://github.com/msantos/sods.git

then I went to the sods client folder "sdt"

cd sods/sdt

then I have executed the configure file

./configure

it generates the required Makefile of the operating system "Linux" but of the normal linux, not linux of android. then when I execute

make

the compilation returns with error that libresolv.a doesn't exist here is the configure file :

#!/bin/sh

OS=`uname -s`

case $OS in
    'Linux')
        if [ -e /usr/lib/libresolv.a ]; then
            STATIC_LIB=/usr/lib/libresolv.a
        else
            STATIC_LIB=/usr/lib/*/libresolv.a
        fi
        DEF="-DHAVE_ERRX"
    ;;
    'Darwin'|'NetBSD')
        DEF="-DHAVE_ARC4RANDOM -DHAVE_ERRX"
        LIB="-lresolv"
    ;;
    'OpenBSD')
        if [ ! -e /usr/local/lib/libbind/libbind.a ]; then
            echo "Please install libbind: sudo pkg_add libbind"
            exit 1
        fi
        DEF="-DHAVE_ARC4RANDOM -DHAVE_ERRX"
        LIB="-L/usr/local/lib/libbind -Wl,-rpath=/usr/local/lib/libbind -lbind -I/usr/local/include/bind"
    ;;
    'FreeBSD')
        if [ ! -e /usr/local/lib/libbind.a ]; then
            echo "Please install libbind: sudo pkg add libbind"
            exit 1
        fi
        DEF="-DHAVE_ARC4RANDOM -DHAVE_ERRX"
        LIB="-L/usr/local/lib -lbind -I/usr/local/include/bind"
    ;;
    'SunOS')
        if [ ! -e /opt/local/lib/libbind.a ]; then
            echo "Please install libbind: sudo pkg_add libbind"
            exit 1
        fi
        DEF="-DHAVE_ERRX"
        LIB="-lsocket -lnsl -L/opt/local/lib -Wl,-rpath=/opt/local/lib -lbind -I/opt/local/include/bind"
    ;;
    *)
        echo "Guessing, adjust Makefile by hand ..."
        LIB="-lresolv"
    ;;

esac

if [ -e /dev/urandom ]; then
    DEF="${DEF} -DHAVE_URANDOM"
fi

cat<<EOF>Makefile
CC ?= cc
RM ?= rm
APP=sdt

STATIC_LIB=${STATIC_LIB}
DEF=${DEF}
LIB=${LIB}

all:
        \$(CC) \$(DEF) -g -Wall \$(LIB) \\
    -Wall -Wextra -pedantic \\
    -Wshadow -Wpointer-arith -Wcast-qual \\
    -Wstrict-prototypes -Wmissing-prototypes \\
    -I../common \\
    -o \$(APP) \$(APP).c \$(APP)_dns.c \$(APP)_err.c \$(APP)_rand.c base32.c ../common/strtonum.c \$(STATIC_LIB) \\
    -Wl,-z,relro,-z,now -Wl,-z,noexecstack

clean:
        -@\$(RM) *.o \$(APP)
EOF

and here is the Makefile:

CC ?= cc
RM ?= rm
APP=sdt

STATIC_LIB=/usr/lib/*/libresolv.a
DEF=-DHAVE_ERRX -DHAVE_URANDOM
LIB=

all:
        $(CC) $(DEF) -g -Wall $(LIB) \
    -Wall -Wextra -pedantic \
    -Wshadow -Wpointer-arith -Wcast-qual \
    -Wstrict-prototypes -Wmissing-prototypes \
    -I../common \
    -o $(APP) $(APP).c $(APP)_dns.c $(APP)_err.c $(APP)_rand.c base32.c ../common/strtonum.c $(STATIC_LIB) \
    -Wl,-z,relro,-z,now -Wl,-z,noexecstack

clean:
        -@$(RM) *.o $(APP)

and here is the make command output error :
cc -DHAVE_ERRX -DHAVE_URANDOM -g -Wall  \
    -Wall -Wextra -pedantic \
    -Wshadow -Wpointer-arith -Wcast-qual \
    -Wstrict-prototypes -Wmissing-prototypes \
    -I../common \
    -o sdt sdt.c sdt_dns.c sdt_err.c sdt_rand.c base32.c ../common/strtonum.c /usr/lib/libresolv.a \
    -Wl,-z,relro,-z,now -Wl,-z,noexecstack
clang: error: no such file or directory: '/usr/lib/*/libresolv.a'
make: *** [Makefile:10: all] Error 1

Upvotes: 0

Views: 116

Answers (0)

Related Questions