Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to build log4cpp using MingGW32 compiler

Help
slamdank
2009-02-09
2013-05-20
  • slamdank
    slamdank
    2009-02-09

    Hi,

    Does anybody know how to build log4cpp using MingGW32 compiler under Windows XP?

    My work environment is:
    OS: Windows XP
    IDE: CodeBlocks
    Compiler: MingGW (mingw32-gcc-3.4.5)

    I opened all the source files under CodeBlocks_IDE by the workspace file msvc6.dsw.
    But it can't be built due to a lot of errors.

    Is there any proposal for this case, or may be smb know sth. like a cookbook/how to build log4cpp etc. ?

    regards,
    Slam

     
    • darkangel
      darkangel
      2009-02-09

      log4cpp-1.0 indeed have problems. But current CVS doesn't. I just builded using Boost.Build v2. Not sure about msvc-6 workspace files. Try current CVS. If it doesn't help post error messages.

       
    • slamdank
      slamdank
      2009-02-11

      Hi,

      I have checked out the latest sources from CVS for the msvc6 workspace.
      The workspace for MSVC6 provides following projects:
      log4cpp
      log4cppDLL
      log4cppDLL_stlport_boost
      testCategory
      testDLL
      testMain
      testMain_stlport_boost
      testNDC
      testNDC_stlport_boost
      testNTEventLog
      testNTEventLog_stlport_boost
      testPattern
      testPropConfig

      Then I started to build every project step by step.

      The 'log4cpp'-project has been built without errors.
      Building of the next one, 'log4cppDPP' thrown following error trace:

      -------------- Build: Win32 Release in log4cppDLL ---------------

      mingw32-g++.exe -shared -Wl,--output-def=Release\liblog4cpp.def -Wl,--out-implib=Release\liblog4cpp.a -Wl,--dll  Release\src\AbortAppender.o Release\src\Appender.o Release\src\AppenderSkeleton.o Release\src\BasicConfigurator.o Release\src\BasicLayout.o Release\src\Category.o Release\src\CategoryStream.o Release\src\Configurator.o Release\src\DllMain.o Release\src\DummyThreads.o Release\src\FileAppender.o Release\src\Filter.o Release\src\FixedContextCategory.o Release\src\HierarchyMaintainer.o Release\src\IdsaAppender.o Release\src\LayoutAppender.o Release\src\LoggingEvent.o Release\src\MSThreads.o Release\src\NDC.o Release\src\NTEventLogAppender.o Release\src\OmniThreads.o Release\src\OstreamAppender.o Release\src\PThreads.o Release\src\PatternLayout.o Release\src\PortabilityImpl.o Release\src\Priority.o Release\src\Properties.o Release\src\PropertyConfigurator.o Release\src\PropertyConfiguratorImpl.o Release\src\RemoteSyslogAppender.o Release\src\RollingFileAppender.o Release\src\SimpleConfigurator.o Release\src\SimpleLayout.o Release\src\StringQueueAppender.o Release\src\StringUtil.o Release\src\TimeStamp.o Release\src\Win32DebugAppender.o  Release\log4cppDLL.res  -o Release\log4cpp.dll  -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lws2_32
      Creating library file: Release\liblog4cpp.a
      Release\src\AbortAppender.o: In function `_ZN7log4cpp21create_abort_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\FileAppender.o: In function `_ZN7log4cpp20create_file_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\FileAppender.o: In function `_ZN7log4cpp12FileAppender6reopenEv':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:2136: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\NTEventLogAppender.o:C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/NTEventLogAppender.cpp:98: more undefined references to `log4cpp::FactoryParams::find(std::string const&) const' follow
      Release\src\PatternLayout.o: In function `_ZN7log4cpp13PatternLayout22clearConversionPatternEv':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/char_traits.h:258: undefined reference to `log4cpp::localtime(long const*, tm*)'
      Release\src\RemoteSyslogAppender.o: In function `_ZN7log4cpp29create_remote_syslog_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RemoteSyslogAppender.o: In function `_ZN7log4cpp20RemoteSyslogAppender4openEv':
      C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/RemoteSyslogAppender.cpp:84: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RollingFileAppender.o: In function `_ZN7log4cpp25create_roll_file_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RollingFileAppender.o:C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: more undefined references to `log4cpp::FactoryParams::find(std::string const&) const' follow
      collect2: ld returned 1 exit status
      Process terminated with status 1 (0 minutes, 40 seconds)
      13 errors, 50 warnings

       
      • darkangel
        darkangel
        2009-02-11

        Try current CVS trunc. I just commited fix for this. Note that I can't tell anything about test projects. I have fixed only log4cpp and log4cppDLL projects.

         
    • slamdank
      slamdank
      2009-02-12

      Hi,

      the next problem appeared by building of the 'log4cppDLL_stlport_boost' project.
      Here is the appropriate build log snippet:

      --------- build log snippet beginning -------------
      Creating library file: Release\liblog4cpp.a
      Release\src\AbortAppender.o: In function `_ZN7log4cpp21create_abort_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\FileAppender.o: In function `_ZN7log4cpp20create_file_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\FileAppender.o: In function `_ZN7log4cpp12FileAppender6reopenEv':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:2136: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC1ERKSsS2_S2_i':
      C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
      Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC2ERKSsS2_S2_i':
      C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
      Release\src\NTEventLogAppender.o: In function `_ZN7log4cpp18NTEventLogAppender7getTypeEi':
      C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/NTEventLogAppender.cpp:98: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\PatternLayout.o: In function `_ZN7log4cpp21create_pattern_layoutERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\PatternLayout.o: In function `_ZN7log4cpp13PatternLayout22clearConversionPatternEv':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/char_traits.h:258: undefined reference to `log4cpp::localtime(long const*, tm*)'
      Release\src\RemoteSyslogAppender.o: In function `_ZN7log4cpp29create_remote_syslog_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RemoteSyslogAppender.o: In function `_ZN7log4cpp20RemoteSyslogAppender4openEv':
      C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/RemoteSyslogAppender.cpp:84: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RollingFileAppender.o: In function `_ZN7log4cpp25create_roll_file_appenderERKNS_13FactoryParamsE':
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: undefined reference to `log4cpp::FactoryParams::find(std::string const&) const'
      Release\src\RollingFileAppender.o:C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:62: more undefined references to `log4cpp::FactoryParams::find(std::string const&) const' follow
      collect2: ld returned 1 exit status
      Process terminated with status 1 (0 minutes, 34 seconds)
      16 errors, 50 warnings
      ---------- build log snippet end -----------------

      Regards

       
      • darkangel
        darkangel
        2009-02-12

        Fixed in CVS trunc

         
        • slamdank
          slamdank
          2009-02-13

          ...sorry, still doesn't work:

          --------- build log snippet beginning -------------

          mingw32-g++.exe -shared -Wl,--output-def=Release\liblog4cpp.def -Wl,--out-implib=Release\liblog4cpp.a -Wl,--dll  Release\src\AbortAppender.o Release\src\Appender.o Release\src\AppenderSkeleton.o Release\src\BasicConfigurator.o Release\src\BasicLayout.o Release\src\Category.o Release\src\CategoryStream.o Release\src\Configurator.o Release\src\DllMain.o Release\src\FactoryParams.o Release\src\FileAppender.o Release\src\Filter.o Release\src\FixedContextCategory.o Release\src\HierarchyMaintainer.o Release\src\IdsaAppender.o Release\src\LayoutAppender.o Release\src\Localtime.o Release\src\LoggingEvent.o Release\src\NDC.o Release\src\NTEventLogAppender.o Release\src\OstreamAppender.o Release\src\PatternLayout.o Release\src\PortabilityImpl.o Release\src\Priority.o Release\src\Properties.o Release\src\PropertyConfigurator.o Release\src\PropertyConfiguratorImpl.o Release\src\RemoteSyslogAppender.o Release\src\RollingFileAppender.o Release\src\SimpleConfigurator.o Release\src\SimpleLayout.o Release\src\StringQueueAppender.o Release\src\StringUtil.o Release\src\TimeStamp.o Release\src\Win32DebugAppender.o  Release\log4cppDLL_stlport_boost.res  -o Release\log4cpp.dll  -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lws2_32
          Creating library file: Release\liblog4cpp.a
          Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC1ERKSsS2_S2_i':
          C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
          Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC2ERKSsS2_S2_i':
          C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
          collect2: ld returned 1 exit status
          Process terminated with status 1 (0 minutes, 34 seconds)
          2 errors, 50 warnings

          --------- build log snippet end -------------

           
          • darkangel
            darkangel
            2009-02-13

            This is because no one ever tried to build mingw + boost + strport variant :).
            Try current CVS trunc.

             
            • slamdank
              slamdank
              2009-02-16

              Hello,

              I tried current CVS trunc, but it still doesn't work.
              Build log is the same:

              ----------------------
              ...
              Creating library file: Release\liblog4cpp.a
              Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC1ERKSsS2_S2_i':
              C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
              Release\src\LoggingEvent.o: In function `_ZN7log4cpp12LoggingEventC2ERKSsS2_S2_i':
              C:/wxWidgets-2_8_7/TE_Projects/log4cpp/src/LoggingEvent.cpp:24: undefined reference to `log4cpp::threading::getThreadId()'
              collect2: ld returned 1 exit status
              Process terminated with status 1 (0 minutes, 34 seconds)
              2 errors, 50 warnings
              -----------------------

              Regards

               
              • darkangel
                darkangel
                2009-02-16

                Sorry, never use CodeBlocks so didn't test properly. Now (using CVS trunc) you will have to deal with -lboost_threads to finaly build library. I have tested it in CodeBlocks in fashion you do and seams that everything works except -lboost_thread. So if you build boost_thread and place it where linker find it library will build.