You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2023/01/14 16:02:03 UTC

[GitHub] [logging-log4cxx] geirg71 opened a new issue, #177: LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC

geirg71 opened a new issue, #177:
URL: https://github.com/apache/logging-log4cxx/issues/177

   I originally found this issue when compiling log4cxx 1.0.0 as a DLL in the MSYS2 environment on Windows, using GCC 12. It is however a general problem and can be easily reproduced with GCC on Linux, as follows.
   
   Change LOG4CXX_INSTANTIATE_EXPORTED_PTR in src/main/include/log4cxx/log4cxx.h.in to make it identical as for the Win32/DLL case. That is:
   
   Change
   `#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T)`
   to
   `#define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>`
   
   Compiling on Ubuntu 22.04 with GCC 11:
   
   ```
   $ gcc --version
   gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
   Copyright (C) 2021 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   
   $ cmake --build cmake_build --target install --config RelWithDebInfo --parallel
   Checking configuration
   [  0%] Built target configure_log4cxx
   Consolidate compiler generated dependencies of target log4cxx
   [  2%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/class.cpp.o
   [  2%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/defaultconfigurator.cpp.o
   [  3%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/domconfigurator.cpp.o
   [  4%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/filterbasedtriggeringpolicy.cpp.o
   [  5%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/inputstreamreader.cpp.o
   [  6%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/optionconverter.cpp.o
   [  6%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/properties.cpp.o
   [  7%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/propertyconfigurator.cpp.o
   [  8%] Building CXX object src/main/cpp/CMakeFiles/log4cxx.dir/propertysetter.cpp.o
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/inputstreamreader.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::InputStream>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/helpers/inputstreamreader.h:32:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      32 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::CharsetDecoder>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/helpers/inputstreamreader.h:33:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      33 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(CharsetDecoder);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/propertysetter.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:762: src/main/cpp/CMakeFiles/log4cxx.dir/inputstreamreader.cpp.o] Error 1
   gmake[2]: *** Waiting for unfinished jobs....
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/properties.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::InputStream>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/helpers/inputstreamreader.h:32:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      32 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::CharsetDecoder>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/helpers/inputstreamreader.h:33:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      33 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(CharsetDecoder);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1392: src/main/cpp/CMakeFiles/log4cxx.dir/properties.cpp.o] Error 1
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/filterbasedtriggeringpolicy.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:636: src/main/cpp/CMakeFiles/log4cxx.dir/filterbasedtriggeringpolicy.cpp.o] Error 1
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/propertyconfigurator.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/optionconverter.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1448: src/main/cpp/CMakeFiles/log4cxx.dir/propertysetter.cpp.o] Error 1
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/domconfigurator.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/defaultconfigurator.cpp:17:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1280: src/main/cpp/CMakeFiles/log4cxx.dir/optionconverter.cpp.o] Error 1
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:426: src/main/cpp/CMakeFiles/log4cxx.dir/defaultconfigurator.cpp.o] Error 1
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:1420: src/main/cpp/CMakeFiles/log4cxx.dir/propertyconfigurator.cpp.o] Error 1
   In file included from src/main/include/log4cxx/logstring.h:22,
                    from src/main/cpp/class.cpp:18:
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::spi::Filter>’ in namespace ‘log4cxx::rolling’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h:39:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      39 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::spi::Filter);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cmake_build/src/main/include/log4cxx/log4cxx.h:94:80: error: explicit instantiation of ‘class std::shared_ptr<log4cxx::helpers::Object>’ in namespace ‘log4cxx::helpers’ (which does not enclose namespace ‘std’) [-fpermissive]
      94 | #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
         |                                                                                ^~~~~~~~~~~~~
   src/main/include/log4cxx/config/propertysetter.h:30:1: note: in expansion of macro ‘LOG4CXX_INSTANTIATE_EXPORTED_PTR’
      30 | LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:468: src/main/cpp/CMakeFiles/log4cxx.dir/domconfigurator.cpp.o] Error 1
   gmake[2]: *** [src/main/cpp/CMakeFiles/log4cxx.dir/build.make:272: src/main/cpp/CMakeFiles/log4cxx.dir/class.cpp.o] Error 1
   gmake[1]: *** [CMakeFiles/Makefile2:226: src/main/cpp/CMakeFiles/log4cxx.dir/all] Error 2
   gmake: *** [Makefile:136: all] Error 2
   ```


-- 
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-unsubscribe@logging.apache.org.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "thkdev2 (via GitHub)" <gi...@apache.org>.
thkdev2 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1819228310

   Thank you for taking care of this issue and fixing it.


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "rm5248 (via GitHub)" <gi...@apache.org>.
rm5248 closed issue #177: LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC
URL: https://github.com/apache/logging-log4cxx/issues/177


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "rm5248 (via GitHub)" <gi...@apache.org>.
rm5248 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1819198395

   > I don't know if you want include it in your pull request. Otherwise I can do a separate one after yours is merged.
   
   Since it doesn't cause a problem I left it in; it's not a big enough issue to worry about.
   
   With that fix now in, this issue should now be resolved.


-- 
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-unsubscribe@logging.apache.org

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


[GitHub] [logging-log4cxx] rm5248 commented on issue #177: LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC

Posted by GitBox <gi...@apache.org>.
rm5248 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1384126363

   > Hence I guess the C++ standard really prohibits this type of template instantiations, and the issue could resurface later in e.g. future MSVC versions implementing the standard.
   
   MSVC has always been a weird compiler in my experience - as long as we check for `MSC_VER` we can also check for the compiler version / C++ standard and change the macro appropriately.
   


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "thkdev2 (via GitHub)" <gi...@apache.org>.
thkdev2 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1818800168

   Thank you, your change will fix the problem.
   
   Since object.h is already included, the code in propertysetter could be simplified as follows:
   
   `#include <log4cxx/helpers/object.h>
   
   // Instantiate template pointer type passed as parameter
   LOG4CXX_INSTANTIATE_EXPORTED_PTR(LOG4CXX_NS::helpers::Object);
   
   namespace LOG4CXX_NS
   {
   namespace helpers
   {
   class Properties;
   class Pool;
   }`
   
   I don't know if you want include it in your pull request.
   Otherwise I can do a separate one after yours is merged.
   


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "guenterberner (via GitHub)" <gi...@apache.org>.
guenterberner commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1815987349

   The non-standard macro provided by the log4cxx codebase still causes problems for compilers != MSVC. (i.e. clang and gcc).
   Are there any plans to fix this issue?
   


-- 
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-unsubscribe@logging.apache.org

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


[GitHub] [logging-log4cxx] swebb2066 commented on issue #177: LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC

Posted by GitBox <gi...@apache.org>.
swebb2066 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1382937359

   So does changing the
   `#if _WIN32`
    at line 66 in log4cxx.h.in to 
   `#if defined(_MSC_VER`)
   fix the problem?


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "thkdev2 (via GitHub)" <gi...@apache.org>.
thkdev2 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1816476018

   Yes, the problem still exists in version 1.1.0.
   Compiling with CLang provided by VC 2022 still fails.
   
   I try to clarify the problem.
   The macro definition itself isn't the problem, just the usage.
   https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1383078063 above shows what to have to be fixed.
   There are 3 places in the log4cxx library where this pattern is used: in propertysetter.h, inputstreamreader.h and filterbasedtriggeringpolicy.h.
   I applied the fix to the 3 files and built the library.
   And with the fixed header files also the CLang build succeeded.
   I can try to prepare a pull request if you insist.


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "rm5248 (via GitHub)" <gi...@apache.org>.
rm5248 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1817198251

   I do not currently have a way to validate that any fixes made will work, which is why a PR would be useful.  I don't know if anybody else has ready access to GCC for windows either.  This means that any fixes we make may or may not actually work.


-- 
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-unsubscribe@logging.apache.org

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


[GitHub] [logging-log4cxx] geirg71 commented on issue #177: LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC

Posted by GitBox <gi...@apache.org>.
geirg71 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1383078063

   Thank you for the lightning fast response Stephen. Your 2 commits fix my problem on MSYS2.
   
   I do however ask you to look at the use of the LOG4CXX_INSTANTIATE_EXPORTED_PTR macro. Clang 14 on Linux complains about the same issue as GCC if I change the macro to the Windows variant (refer output below). Hence I guess the C++ standard really prohibits this type of template instantiations, and the issue could resurface later in e.g. future MSVC versions implementing the standard.
   
   For me both compilers are happy if I move LOG4CXX_INSTANTIATE_EXPORTED_PTR outside of the log4cxx namespace. Example from propertysetter.h, change: 
   
   ```
   #include <log4cxx/logstring.h>
   #include <log4cxx/helpers/object.h>
   
   namespace log4cxx
   {
   namespace helpers
   {
   class Object;
   // Instantiate template pointer type passed as parameter
   LOG4CXX_INSTANTIATE_EXPORTED_PTR(Object);
   LOG4CXX_PTR_DEF(Object);
   ```
   
   to
   
   ```
   #include <log4cxx/logstring.h>
   #include <log4cxx/helpers/object.h>
   
   // Instantiate template pointer type passed as parameter
   LOG4CXX_INSTANTIATE_EXPORTED_PTR(log4cxx::helpers::Object);
   
   namespace log4cxx
   {
   namespace helpers
   {
   class Object;
   LOG4CXX_PTR_DEF(Object);
   ```
   
   Clang 14 on Ubuntu 22.04 with #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>:
   ```
   $ clang++ --version
   Ubuntu clang version 14.0.0-1ubuntu1
   Target: x86_64-pc-linux-gnu
   Thread model: posix
   InstalledDir: /usr/bin
   
   [build] /usr/bin/clang++  -Ilogging-log4cxx/src/test/cpp/util -Ilogging-log4cxx/build/src/main/include -Ilogging-log4cxx/src/main/include -I/usr/include/apr-1.0 -g -std=c++17 -MD -MT src/test/cpp/util/CMakeFiles/testingUtilities.dir/compare.cpp.o -MF src/test/cpp/util/CMakeFiles/testingUtilities.dir/compare.cpp.o.d -o src/test/cpp/util/CMakeFiles/testingUtilities.dir/compare.cpp.o -c logging-log4cxx/src/test/cpp/util/compare.cpp
   [build] In file included from logging-log4cxx/src/test/cpp/util/compare.cpp:23:
   [build] logging-log4cxx/src/main/include/log4cxx/helpers/inputstreamreader.h:32:1: error: explicit instantiation of 'shared_ptr' not in a namespace enclosing 'std'
   [build] LOG4CXX_INSTANTIATE_EXPORTED_PTR(InputStream);
   [build] ^
   [build] logging-log4cxx/build/src/main/include/log4cxx/log4cxx.h:94:80: note: expanded from macro 'LOG4CXX_INSTANTIATE_EXPORTED_PTR'
   [build] #define LOG4CXX_INSTANTIATE_EXPORTED_PTR(T) template class LOG4CXX_EXPORT std::shared_ptr<T>
   [build]                                                                                ^
   [build] /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/shared_ptr.h:175:11: note: explicit instantiation refers here
   [build]     class shared_ptr : public __shared_ptr<_Tp>
   ```


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "geirg71 (via GitHub)" <gi...@apache.org>.
geirg71 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1817481049

   C++ 20 standard reference specifying that it is illegal to explicit instantiate templates the way log4cxx currently does in the 3 mentioned headers (propertysetter.h, inputstreamreader.h, filterbasedtriggeringpolicy.h):
   
   [https://isocpp.org/files/papers/N4860.pdf](url)
   
   Page 406: "An explicit instantiation shall appear in an enclosing namespace of its template"


-- 
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-unsubscribe@logging.apache.org

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


Re: [I] LOG4CXX_INSTANTIATE_EXPORTED_PTR issue on MSYS2 / GCC [logging-log4cxx]

Posted by "rm5248 (via GitHub)" <gi...@apache.org>.
rm5248 commented on issue #177:
URL: https://github.com/apache/logging-log4cxx/issues/177#issuecomment-1816433680

   Does version 1.1.0 still have this issue?  From what I can tell this should not be a problem.  If it is still a problem a pull request to fix it would be helpful.


-- 
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-unsubscribe@logging.apache.org

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