admin管理员组

文章数量:1394554

I am trying to build log4cxx from source on MacOS (Sequoia, 15.3.2). I am using gcc-14.2.0 installed via homebrew. I have built apr and apr-util from source using the same compiler.

I have downloaded the source for log4cxx 1.4.0 and then try to compile with:

cd apache-log4cxx-1.4.0
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/some/where
make

but I get the error:

<snip>/src/main/cpp/logstream.cpp:44:9: error: 'init' was not declared in this scope; did you mean 'Init'

FYI, lines 43-45 of that file contain:

#if LOG4CXX_INIT_IOS_BASE
    init(NULL);
#endif

If I comment out those 3 lines then it compiles fine. Alternatively, if I leave those lines in and use clang, it compiles fine.

I can't find any record of this issue online or in the GitHub issues, which makes me think it's just me, but equally, I cannot fathom this. I did a search for the definition of init() in the source tree of log4cxx, but I can only find this in src/fuzzers/PatternLayoutFuzzer.cpp which does not seem connected at all.

Has anyone else seen this issue or know why it occurs? At least at first glance, it seems that the error is 'correct' in that logstream.cpp is calling an undefined function. But if that were so, surely it would compile for no-one. So I'm confused!

本文标签: cApachelog4cxx will not compile with gcc14 on MacOS Sequoia init not declaredStack Overflow