0

I downloaded and installed the APR and APR-util C libraries but I can't use them in a project I am doing I keep getting the following errors (I am on Linux Mint):

undefined reference to `apr_pool_initialize'
undefined reference to `apr_pool_create_ex'
etc...

My libraries were originally installed into /usr/local/APR. At first I thought that this file was just not in my cc include path to I copied the /apr/ directory into /usr/local/include and /usr/include both of which are in the include path but I got the exact same errors. I tried adding the lib folder in /apr/ into /etc/ld.so.conf.d/ and then running ldconfig as recommended by the website I am doing the project from but that didn't help either. I thought that I may have installed it improperly so I redid it but that didn't help either. I'm at a loss. If anyone could help me fix this I would really appreciate it. For reference this is the install script I used:

set -e
cd /tmp

curl -L -O http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz

tar -xzvf apr-1.4.6.tar.gz
cd apr-1.4.6

./configure
make
sudo make install

cd /tmp
rm -rf apr-1.4.6 apr-1.4.6.tar.gz

curl -L -O http://archive.apache.org/dist/apr/apr-util-1.4.1.tar.gz

tar -xzvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1

./configure --with-apr=/usr/local/apr

make
sudo make install

cd /tmp
rm -rf apr-util-1.4.1* apr-1.4.6*

And this is the Makefile I am using, all separations are tabs:

PREFIX?=/usr/local
CFLAGS=-g -Wall -I${PREFIX}/apr/include/apr-1  -
I${PREFIX}/apr/include/apr-util-1   -D_LARGEFILE64_SOURCE=1
LDFLAGS=-L${PREFIX}/apr/lib -lapr-1 -pthread -laprutil-1

all: devpkg

devpkg: bstrlib.o db.o shell.o commands.o

install: all
    install -d $(DESTDIR)/$(PREFIX)/bin/
    install devpkg $(DESTDIR)/$(PREFIX)/bin/

clean:
    rm -f *.o
    rm -f devpkg
    rm -rf *.dSYM
  • I suspect a problem with `LDFLAGS`, The linker can't find the functions. Have you confirmed the `libapr-1` and `libaprutil-1` library names and their existence? – David C. Rankin May 31 '17 at 22:35
  • have you tried compiling your code manually with gcc to make sure you are setting the flags properly? – bruceg May 31 '17 at 22:37
  • I confirmed the existence and names of libapr-1 and libaprutil-1 but if I try and compile my files individually I get errors akin to: fatal error: apr_general.h: No such file or directory compilation terminated. – aprdrivesmecrazy May 31 '17 at 22:56

1 Answers1

0

Linux Mint : Unless it's an old version, all later Mint have libapr1, libaprutil1 version 1.5.0 or 1.5.2 or later installed by default.

The get the complete apr, apr-util ... please do:

sudo apt update && sudo apt install libapr1-dev libaprutil1-dev
Knud Larsen
  • 5,753
  • 2
  • 14
  • 19