Skip to content

Error building log4cxx with cmake, APR_STATIC and APU_STATIC options #366

@clobotorre

Description

@clobotorre

Based on the answer to this issue #362 I have done following steps on both Ubuntu 18.04 and Ubuntu 22.04.

Initial steps

	# mkdir /home/test_build_log4cxx_with_static_apr_libs
	# mkdir /home/test_build_log4cxx_with_static_apr_libs/target

libapr compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs
	# mkdir apr
	# cd apr
	# curl -L -O https://archive.apache.org/dist/apr/apr-1.7.4.tar.bz2
	# tar xf apr-1.7.4.tar.bz2
	# cd apr-1.7.4
	# touch libtoolT
	# export CFLAGS=-fPIC
	# ./configure --prefix=/home/test_build_log4cxx_with_static_apr_libs/target
	# make install

libapr-util compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs/apr
	# curl -L -O https://archive.apache.org/dist/apr/apr-util-1.6.3.tar.bz2
	# tar xf apr-util-1.6.3.tar.bz2
	# cd apr-util-1.6.3
	# export CFLAGS=-fPIC
	# ./configure --prefix=/home/test_build_log4cxx_with_static_apr_libs/target --with-apr=/home/test_build_log4cxx_with_static_apr_libs/target
	# make install	

log4cxx compilation steps

	# cd /home/test_build_log4cxx_with_static_apr_libs
	# mkdir log4cxx
	# cd log4cxx
	# curl -L -O https://dlcdn.apache.org/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz
	# tar xzvf apache-log4cxx-1.2.0.tar.gz
	# cd apache-log4cxx-1.2.0
	# mkdir build
	# cd build
	# cmake -DAPR_STATIC=yes -DAPU_STATIC=yes -DCMAKE_PREFIX_PATH=/home/test_build_log4cxx_with_static_apr_libs/target/ ..
	# make
	# make install					

I have no problems on Ububntu 22.04, but on Ubuntu 18.04, the make command output ends like this:

[ 54%] Building CXX object src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/autoconfiguretestcase.cpp.o
[ 54%] Linking CXX executable autoconfiguretestcase
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlclose'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlsym'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlopen'
../../main/cpp/liblog4cxx.so.15.2.0: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/build.make:100: recipe for target 'src/test/cpp/autoconfiguretestcase' failed
make[2]: *** [src/test/cpp/autoconfiguretestcase] Error 1
CMakeFiles/Makefile2:1419: recipe for target 'src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/all' failed
make[1]: *** [src/test/cpp/CMakeFiles/autoconfiguretestcase.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions