rm5248 commented on issue #489:
URL: 
https://github.com/apache/logging-log4cxx/issues/489#issuecomment-2746572548

   After some investigation, this turns out to be partially user error on my 
part.
   
   It turns out that by default, Qt creator is setting 
`-DCMAKE_PREFIX_PATH:STRING=/usr`.  This leads to the unintended consequence 
that the header files in `/usr/local/include/log4cxx` are taking precedence 
over the header files in `/usr/include/log4cxx`, but we're still trying to link 
with the .so file in `/usr/lib`, thus leading to the error linking.
   
   When using cmake as normal(e.g. just running `cmake`), no errors occur 
because the cmake files in `/usr/local` take precedence, so the correct library 
is linked with.
   
   Specifically, at least the following methods fail to link properly:
   ```
   log4cxx::Logger::addErrorEvent
   log4cxx::Logger::addDebugEvent
   ```
   
   It looks like these new methods were introduced in 
https://github.com/apache/logging-log4cxx/pull/337
   
   The default search path for GCC:
   ```
   $ echo | gcc -xc++ -E -v -
   ...
   #include <...> search starts here:
    /usr/include/c++/12
    /usr/include/x86_64-linux-gnu/c++/12
    /usr/include/c++/12/backward
    /usr/lib/gcc/x86_64-linux-gnu/12/include
    /usr/local/include
    /usr/include/x86_64-linux-gnu
    /usr/include
   ```
   
   TL;DR library is backwards compatible(still ABI stable) but the headers are 
not.


-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to