Skip to content

make fails miserably #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LinaSchad opened this issue Jun 15, 2018 · 22 comments
Closed

make fails miserably #317

LinaSchad opened this issue Jun 15, 2018 · 22 comments
Assignees

Comments

@LinaSchad
Copy link

LinaSchad commented Jun 15, 2018

Hi there :)

I just wanted to start using log4cplus, because I really need a logging framework and it looks awesome. I need to use it on Windows 10 and I was able to run ./configure, but just with --disable-dependency-tracking because with just ./configure I got an error saying "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. ..." When I now try to make I get this output:

make
make  all-recursive
make[1]: Entering directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1'
Making all in include
make[2]: Entering directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1/include'
make[2]: Entering directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1'
g++ -DHAVE_CONFIG_H   -I./include -I./threadpool -I./include -I./catch/single_include -DCATCH_CONFIG_PREFIX_ALL=1 -DNDEBUG -D_GNU_SOURCE=1 -U__STRICT_ANSI__ -DWIN32 -D_WIN32 -DMINGW_HAS_SECURE_API=1 -D_REENTRANT  -g -O2 -Wall -fdiagnostics-show-caret -ftrack-macro-expansion -fdiagnostics-color=auto -Wextra -pedantic -Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual -Wc++14-compat -Wundef -Wshadow -Wformat -Wnoexcept -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-variadic-macros -fvisibility=hidden  -c -o simpleserver/loggingserver.o simpleserver/loggingserver.cxx
In file included from ./include/log4cplus/configurator.h:27:0,
                 from simpleserver/loggingserver.cxx:24:
./include/log4cplus/thread/syncprims.h:75:38: error: 'recursive_mutex' in namespace 'std' does not name a type
     LOG4CPLUS_THREADED (mutable std::recursive_mutex mtx;)
                                      ^
./include/log4cplus/config.hxx:177:31: note: in definition of macro 'LOG4CPLUS_THREADED'
 #define LOG4CPLUS_THREADED(x) x
                               ^
In file included from ./include/log4cplus/helpers/pointer.h:38:0,
                 from ./include/log4cplus/appender.h:36,
                 from ./include/log4cplus/configurator.h:33,
                 from simpleserver/loggingserver.cxx:24:
./include/log4cplus/thread/syncprims.h:95:18: error: 'mutex' in namespace 'std' does not name a type
     mutable std::mutex mtx;
                  ^~~~~
./include/log4cplus/thread/syncprims.h:96:18: error: 'condition_variable' in namespace 'std' does not name a type
     mutable std::condition_variable cv;
                  ^~~~~~~~~~~~~~~~~~
./include/log4cplus/thread/syncprims.h:121:18: error: 'mutex' in namespace 'std' does not name a type
     mutable std::mutex mtx;
                  ^~~~~
./include/log4cplus/thread/syncprims.h:122:18: error: 'condition_variable' in namespace 'std' does not name a type
     mutable std::condition_variable cv;
                  ^~~~~~~~~~~~~~~~~~
In file included from ./include/log4cplus/configurator.h:33:0,
                 from simpleserver/loggingserver.cxx:24:
./include/log4cplus/appender.h:317:14: error: 'mutex' in namespace 'std' does not name a type
         std::mutex in_flight_mutex;
              ^~~~~
./include/log4cplus/appender.h:318:14: error: 'condition_variable' in namespace 'std' does not name a type
         std::condition_variable in_flight_condition;
              ^~~~~~~~~~~~~~~~~~
In file included from ./include/log4cplus/socketappender.h:36:0,
                 from simpleserver/loggingserver.cxx:25:
./include/log4cplus/thread/threads.h:85:21: error: 'thread' is not a member of 'std'
     std::unique_ptr<std::thread> thread;
                     ^~~
./include/log4cplus/thread/threads.h:85:21: note: suggested alternative:
In file included from ./include/log4cplus/helpers/pointer.h:38:0,
                 from ./include/log4cplus/appender.h:36,
                 from ./include/log4cplus/configurator.h:33,
                 from simpleserver/loggingserver.cxx:24:
./include/log4cplus/thread/syncprims.h:38:33: note:   'log4cplus::thread'
 namespace log4cplus { namespace thread {
                                 ^~~~~~
In file included from ./include/log4cplus/socketappender.h:36:0,
                 from simpleserver/loggingserver.cxx:25:
./include/log4cplus/thread/threads.h:85:21: error: 'thread' is not a member of 'std'
     std::unique_ptr<std::thread> thread;
                     ^~~
./include/log4cplus/thread/threads.h:85:21: note: suggested alternative:
In file included from ./include/log4cplus/helpers/pointer.h:38:0,
                 from ./include/log4cplus/appender.h:36,
                 from ./include/log4cplus/configurator.h:33,
                 from simpleserver/loggingserver.cxx:24:
./include/log4cplus/thread/syncprims.h:38:33: note:   'log4cplus::thread'
 namespace log4cplus { namespace thread {
                                 ^~~~~~
In file included from ./include/log4cplus/socketappender.h:36:0,
                 from simpleserver/loggingserver.cxx:25:
./include/log4cplus/thread/threads.h:85:32: error: template argument 1 is invalid
     std::unique_ptr<std::thread> thread;
                                ^
./include/log4cplus/thread/threads.h:85:32: error: template argument 2 is invalid
make[2]: *** [simpleserver/loggingserver.o] Error 1
make[2]: Leaving directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/z/metaproc-research/UIAutomation/log4cplus-2.0.1'
make: *** [all] Error 2`

I'd really appreciate help, thanks in advance :)

@wilx wilx self-assigned this Jun 15, 2018
@wilx
Copy link
Contributor

wilx commented Jun 15, 2018

What compiler are you using? What version of it? It seems like you are not giving it appropriate -std=c++11 or similar flag so that it can find C++11 threading and synchronization primitives.

@LinaSchad
Copy link
Author

Ah right, I forgot to mention that one. I just installed the latest MinGW, Version 6.3.0-1 and gcc version is 6.3.0.

@wilx
Copy link
Contributor

wilx commented Jun 15, 2018

@LinaSchad commented on 15 Jun 2018, 15:11 CEST:

Ah right, I forgot to mention that one. I just installed the latest MinGW, Version 6.3.0-1 and gcc version is 6.3.0.

Try running the configure script again but this time like ./configure CXXFLAGS="-std=c++11".

@LinaSchad
Copy link
Author

LinaSchad commented Jun 15, 2018

Did that, and it worked now. Still, make fails with errors that I posted first :/ Oh and I also tried it with the CXXFlag set like for ./configure

@wilx
Copy link
Contributor

wilx commented Jun 15, 2018

@LinaSchad commented on 15 Jun 2018, 15:11 CEST:

Ah right, I forgot to mention that one. I just installed the latest MinGW, Version 6.3.0-1 and gcc version is 6.3.0.

Can you point me to exact installer that you have used? There is a distinction between MinGW and MinGW64, AFAIK.

@LinaSchad
Copy link
Author

I have no clue how to do a quote properly and sorry that I didn't tell you the important things right away, I haven't programmed for Windows quite a while.

I used this one: MinGW and that's the exact output of gcc --version (without copyright):
gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0

@wilx
Copy link
Contributor

wilx commented Jun 15, 2018

Thank you for the information. I have tried and downloaded it. It is as I expected. MinGW is not built with C++11 threading support. If you look into C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++config.h you will notice this:

/* Define if gthreads library is available. */
/* #undef _GLIBCXX_HAS_GTHREADS */

_GLIBCXX_HAS_GTHREADS has to be defined for the threading and mutexes to be available.

I suggest that you abandon MinGW in favour of some MinGW64 distribution. If you can do without MSYS I would go for Stephan T. Lavavej's distro. Or try MSYS2.

In any case, I would suggest using CMake based build system for log4cplus on Windows instead of the Autotools based one.

@LinaSchad
Copy link
Author

Oh wow, thank you so much! So if I'm going with MinGW64 I should be safe?

@wilx
Copy link
Contributor

wilx commented Jun 15, 2018

@LinaSchad commented on 15 Jun 2018, 16:39 CEST:

Oh wow, thank you so much! So if I'm going with MinGW64 I should be safe?

Yes.

@wilx
Copy link
Contributor

wilx commented Jun 16, 2018

I am closing this on assumption that MinGW64 solves your issue.

@wilx wilx closed this as completed Jun 16, 2018
@LinaSchad
Copy link
Author

Unfortunately it doesn't totally solve my problem :( After getting over one obstacle, that was installing the compiler in a folder without a space, I face now the problem, that make fails because of this error:

./include/log4cplus/thread/impl/tls.h:119:24: error: 'FlsAlloc' was not declared in this scope DWORD const slot = FlsAlloc (cleanupfunc);

I'm feeling quite dump already, I never had such big problems with a framework yet :( I'm pretty sure I'm doing something wrong, but I just can't see what.

@wilx wilx reopened this Jun 18, 2018
@wilx
Copy link
Contributor

wilx commented Jun 18, 2018

Use the CMake based build instead. That should work.

This is probably because of missing appropriate -D_WIN32_WINNT=0x0600. Add it to CPPFLAGS or CXXFLAGS on ./configure command line.

This should be documented.

wilx added a commit to wilx/log4cplus that referenced this issue Jun 19, 2018
Add missing _WIN32_WINNT. This fixes GitHub issue log4cplus#317.
@wilx
Copy link
Contributor

wilx commented Jun 19, 2018

I have committed some changes to the Autotools build to fix your builds. I will be merging this to master and 2.0.x eventually, but if you want to, you can check out master from wilx/log4cplus.

@LinaSchad
Copy link
Author

LinaSchad commented Jun 19, 2018

Okay, I somehow over read that part where the readme says one should use the CMake build. I was able to build the log4cplus part in Visual Studio. I just don't understand know why it's not found, when I try to include it in my project. I provided the path to the include folder in ´additional include directories´ and I also told my project to use ´log4cplus.lib´ as one of the ´additional dependencies´. I guess I now have just plain problems understanding how to include a library in C++ with Visual Studio :/
But thanks for fixing these problems, I'll check that out in a minute and try it that way.
Edit: I found one problem: I used the x64 debug/release mode, changed that to x86 now, since my colleague told me thats what should be used.

@LinaSchad
Copy link
Author

Oh and your version does come a lot further, but make is now crashing, because of src/global-init.cxx:35:10: fatal error: ThreadPool.h: No such file or directory #include "ThreadPool.h".

@wilx
Copy link
Contributor

wilx commented Jun 19, 2018

This is just that you have to do git clone with --recurse-submodules option.

@LinaSchad
Copy link
Author

Hi, with the option it's almost working now I think. The only problem is, that it looks for QtGlobal, since I don't use Qt, I would highly prefer not to get involved with that. Is it possible to omit the qtXdebugappender in general?

@wilx
Copy link
Contributor

wilx commented Jun 25, 2018

@LinaSchad commented on 25 Jun 2018, 11:52 CEST:

Hi, with the option it's almost working now I think. The only problem is, that it looks for QtGlobal, since I don't use Qt, I would highly prefer not to get involved with that. Is it possible to omit the qtXdebugappender in general?

The Qt appenders do not have to be built. Just configure with --without-qt --without-qt5. That should do it.

@LinaSchad
Copy link
Author

Cool, I got that one know. If you could possibly help me with one last thing, I tried to include it in my project and I told VS the folder path in 'additional include directories' and I also tried to tell the linker to look for a log4cplus.lib, neither worked. I still get the error "cannot open source file "log4cplus"". For the additional include directory I tried the highest level of log4cplus folders, the include folder and the log4cplus folder inside the include one. I know that this is a very basic and noob thing, but it's so long ago that I programmed with C++ and I can't get it right. Google also didn't help me much.

@wilx
Copy link
Contributor

wilx commented Jun 25, 2018

@LinaSchad commented on 25 Jun 2018, 12:21 CEST:

Cool, I got that one know. If you could possibly help me with one last thing, I tried to include it in my project and I told VS the folder path in 'additional include directories' and I also tried to tell the linker to look for a log4cplus.lib, neither worked. I still get the error "cannot open source file "log4cplus"". For the additional include directory I tried the highest level of log4cplus folders, the include folder and the log4cplus folder inside the include one. I know that this is a very basic and noob thing, but it's so long ago that I programmed with C++ and I can't get it right. Google also didn't help me much.

If your intended use as part of Visual Studio based project then you can throw all of your effort up to this point away. Libraries compiled with MinGW/GCC are not compatible with Visual Studio compiler. You have to compile log4cplus with Visual Studio compiler if you want to use it in its projects.

@LinaSchad
Copy link
Author

Oh damn it, well I did that just now and it worked. I still cannot link it for some reason.

@LinaSchad
Copy link
Author

Nevermind I found my problem. I forgot to add the path in the additional library directories. Thanks a lot for helping me though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants