3

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?

ldav1s
  • 15,885
  • 2
  • 53
  • 56
clstaudt
  • 21,436
  • 45
  • 156
  • 239

5 Answers5

3

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

Jack Kelly
  • 18,264
  • 2
  • 56
  • 81
  • 1
    ...and also `libapr-util1-devel`, then `./configure` works, but `make` fails with a compiler error. – clstaudt Jan 20 '13 at 09:47
  • This is the entire output of make: https://gist.github.com/4577990 The issue seems to be: `inputstreamreader.cpp: In member function 'virtual log4cxx::LogString log4cxx::helpers::InputStreamReader::read(log4cxx::helpers::Pool&)': inputstreamreader.cpp:66:64: error: 'memmove' was not declared in this scope` – clstaudt Jan 20 '13 at 11:24
  • The fact that it's trying to rerun the autotools bothers me (but is probably unrelated to your problem). A tarball properly made with `make distcheck` shouldn't need to rerun the autotools as they're a developer tool. – Jack Kelly Jan 20 '13 at 20:31
  • As to the actual compile error: memmove should be provided by an `#include ` line in that file, and it's been fixed in svn for over 4 years http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/inputstreamreader.cpp?view=markup , so I'm not sure what's going on. – Jack Kelly Jan 20 '13 at 20:32
3

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
thebunnyrules
  • 1,520
  • 15
  • 22
  • 2
    Also the most recent git repository `git clone http://git-wip-us.apache.org/repos/asf/logging-log4cxx.git` has fixed it. Thanks for this hint. – Alex Jan 12 '18 at 11:28
1

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.

ldav1s
  • 15,885
  • 2
  • 53
  • 56
  • @EliahKagan an RPM package is just a cpio archive. Even if the OP can't install the package they can just unpackage it to somewhere they can write to and fix up the environment so it'll work. It's obviously not as nice as just installing it. If they don't have any of the dependencies (like libapr1 apparently), they'll also have to unpackage those as well if they aren't already installed. But it'd be just easier to ask someone with root access to install them. At least they get out of installing build dependencies (like libapr1-devel) this way. – ldav1s Jan 20 '13 at 22:49
  • In any case, the OP is going to have to install any missing runtime dependencies and fix up the environment for their compiled liblog4cxx anyway. – ldav1s Jan 20 '13 at 23:26
1

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       
0

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.

MichaelGoren
  • 961
  • 9
  • 15