apache / apache/logging-log4cxx

Error building log4cxx with cmake, APR_STATIC and APU_STATIC options

Open
#366 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
301
Forks
142
Avg merge
1d 2h
Merged PRs (30d)
29

Description

Based on the answer to this issue https://github.com/apache/logging-log4cxx/issues/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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the build using the provided APR, APR-util, CMake, and Ubuntu 18.04 steps, then inspect the generated target in src/test/cpp and its link configuration. Focus on why autoconfiguretestcase cannot resolve dlopen, dlerror, dlsym, and dlclose; done means the documented build and make command complete successfully on Ubuntu 18.04.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.