perhapsmaple opened a new issue, #349:
URL: https://github.com/apache/logging-log4cxx/issues/349
Hi, I am trying to build log4cxx with the MultiprocessRollingFileAppender
using CMake with the following command:
```
cmake -B build -S . -DLOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER=ON
-DCMAKE_CXX_STANDARD=17
```
When I build the project, I get the following error:
```
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:
In member function ‘const string
log4cxx::rolling::TimeBasedRollingPolicy::createFile(const string&, const
string&, log4cxx::helpers::Pool&)’:
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:181:21:
error: ‘log4cxx::filesystem’ has not been declared
181 | LOG4CXX_NS::filesystem::path path(fileName);
| ^~~~~~~~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:182:35:
error: ‘path’ was not declared in this scope
182 | std::string newFilename = path.filename().string() + szUid +
suffix;
| ^~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:182:35:
note: suggested alternatives:
In file included from /usr/include/c++/11/filesystem:45,
from
/home/harish/build/original-log4cxx/build/src/main/include/log4cxx/private/boost-std-configuration.h:9,
from
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:31:
/usr/include/c++/11/bits/fs_path.h:248:9: note:
‘std::filesystem::__cxx11::path’
248 | class path
| ^~~~
In file included from
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:31:
/home/harish/build/original-log4cxx/build/src/main/include/log4cxx/private/boost-std-configuration.h:12:35:
note: ‘{anonymous}::filesystem::path’
12 | typedef std::filesystem::path path;
| ^~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:183:21:
error: ‘log4cxx::filesystem’ has not been declared
183 | LOG4CXX_NS::filesystem::path retval = path.parent_path() /
newFilename;
| ^~~~~~~~~~
/home/harish/build/original-log4cxx/src/main/cpp/timebasedrollingpolicy.cpp:184:16:
error: ‘retval’ was not declared in this scope
184 | return retval.string();
| ^~~~~~
gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1868:
src/main/cpp/CMakeFiles/log4cxx.dir/timebasedrollingpolicy.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1366:
src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
```
After scratching my head for a bit, I found the boost-std-configuration.h
file inside my cmake build folder:
```
#ifndef BOOST_STD_CONFIGURATION_H
#define BOOST_STD_CONFIGURATION_H
#define STD_FILESYSTEM_FOUND 1
#define Boost_FILESYSTEM_FOUND 0
#define STD_EXPERIMENTAL_FILESYSTEM_FOUND 1
#if STD_FILESYSTEM_FOUND
#include <filesystem>
namespace {
namespace filesystem {
typedef std::filesystem::path path;
}
}
#elif STD_EXPERIMENTAL_FILESYSTEM_FOUND
#include <experimental/filesystem>
namespace {
namespace filesystem {
typedef std::experimental::filesystem::path path;
}
}
#elif Boost_FILESYSTEM_FOUND
#include <boost/filesystem.hpp>
namespace {
namespace filesystem {
typedef boost::filesystem::path path;
}
}
#endif
#endif /* BOOST_STD_CONFIGURATION_H */
```
which is generated by this:
```
configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/boost-std-configuration.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/boost-std-configuration.h
```
That value is not set and comes up empty when trying to print with:
```message (NAMESPACE=${NAMESPACE_ALIAS})```
gives the following in the output:```NAMESPACE=```
The build errors do go away when built with the CMake option
```-DLOG4CXX_NS="log4cxx"```
I'm happy to help with any further investigations.
Built latest log4cxx with ```gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0```
Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]