Question

I need to build the log4cxx library on a SuSE linux system where I am not root. The package manager, zypper, apparently does not know about log4cxx.

I download log4cxx and try to build with autotools

./configure

checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.

I then search for libapr:

find / -name libapr*

/usr/share/doc/packages/libapr-util1
/usr/share/doc/packages/libapr1
/usr/lib64/libaprutil-1.so.0.3.12
/usr/lib64/libapr-1.so.0.4.5
/usr/lib64/libaprutil-1.so.0
/usr/lib64/libapr-1.so.0

So I try

./configure --with-apr=/usr/lib64/libapr-1.so.0

configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.

The same for --with-apr=/usr/lib64/libapr-1.so.0.4.5 and --with-apr=/usr/lib64/.

Which file does ./configure look for? What does --with-apr expect? Is one of the two *.so.* files the needed library?

Was it helpful?

Solution 3

On software.opensuse.org someone has packages built for recent versions of openSUSE as well as SLE at liblog4cxx10. Maybe that'll work for you instead of building your own.

OTHER TIPS

You'll probably want to install libapr1-devel so that you can compile against it. Then try re-running ./configure.

I ran into the same issue, I think you're using the source code off of appache's site which I beleive is outdated. This issue has been fixed in the SVN trunk several years ago (lolol, I guess right around the time this question was asked).

Just pull the svn trunk's source and compile it:

svn checkout http://svn.apache.org/repos/asf/incubator/log4cxx/trunk apache-log4cxx 
./autogen.sh
./configure
make
make check
sudo make install

MichaelGoren is right. There is multiple ".h" file missing. So you have to add them before launching make.

sed -i '1i#include <string.h>\n'    src/main/cpp/inputstreamreader.cpp
sed -i '1i#include <string.h>\n'    src/main/cpp/socketoutputstream.cpp   
sed -i '1i#include <string.h>\n'    src/examples/cpp/console.cpp       
sed -i '1i#include <stdio.h>\n'     src/examples/cpp/console.cpp       

I bumped into the same problem on 3.3.4-5.fc17.x86_64 and resolved it by including the appropriate H files to the CPP files reported by the make utility. In my case I should run the make utility 3 times each time getting a new error and fixing it by adding the appropriate include H to the reported CPP file.

The main idea is as following: 1) Check by running the man utility, where the function mentioned in the error defined. For example, man memmove says that it is defined in the string.h header file. 2) Add the appropriate include file to the CPP file. For example, the make utility complains that inputstreamreader.cpp does not find the memmove function. Open the inputstreamreader.cpp file and add string.h to its header files. 3) Run the make utility until the log4cxx is compiled without errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top