c++ - Apache-log4cxx will not compile with gcc-14 on MacOS Sequoia: init not declared - Stack Overflow

I am trying to build log4cxx from source on MacOS (Sequoia, 15.3.2). I am using gcc-14.2.0 installed vi

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!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744100547a4558513.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信