blizzard4591 / openMittsu

An open source implementation and desktop client of the Threema Messenger App.
Other
175 stars 22 forks source link

spdlog dependency issue #54

Open gyps opened 4 years ago

gyps commented 4 years ago

Dear all, I just found your awesome free software to do threema on my linux laptop. Unfortunately I fail to compile it. After cloning the git and installing all dependencies obviously libspdlog was missing so I installed it. But when compiling, the C++ compiler complains (see below). I am running a debian testing/bullesey system and apt tells me libspdlog is version (1:1.3.1-1). What version is actually needed? Does it help to install libspdlog from source?

Thanks for any help, Alex

In file included from /home/[USER]/src/openMittsu/src/main.cpp:1: /home/[USER]/src/openMittsu/src/Init.h: In function ‘bool initializeLogging(std::size_t, std::size_t)’: /home/[USER]/src/openMittsu/src/Init.h:149:51: error: ‘stdout_sink_st’ is not a member of ‘spdlog::sinks’ 149 sinks.push_back(std::make_shared()); ^~~~~~ /home/[USER]/src/openMittsu/src/Init.h:149:51: error: ‘stdout_sink_st’ is not a member of ‘spdlog::sinks’ /home/[USER]/src/openMittsu/src/Init.h:149:67: error: no matching function for call to ‘make_shared< >()’ 149 sinks.push_back(std::make_shared()); ^ In file included from /usr/include/c++/9/memory:81, from /usr/include/spdlog/common.h:14, from /usr/include/spdlog/spdlog.h:12, from /home/[USER]/src/openMittsu/src/utility/Logging.h:16, from /home/[USER]/src/openMittsu/src/Init.h:21, from /home/[USER]/src/openMittsu/src/main.cpp:1: /usr/include/c++/9/bits/shared_ptr.h:714:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’ 714 make_shared(_Args&&... __args) ^~~ /usr/include/c++/9/bits/shared_ptr.h:714:5: note: template argument deduction/substitution failed: In file included from /home/[USER]/src/openMittsu/src/main.cpp:1: /home/[USER]/src/openMittsu/src/Init.h:149:67: error: template argument 1 is invalid 149 sinks.push_back(std::make_shared()); ^ /home/[USER]/src/openMittsu/src/Init.h:150:51: error: ‘rotating_file_sink_mt’ is not a member of ‘spdlog::sinks’ 150 sinks.push_back(std::make_shared(logFileName.toStdString(), maxLogfileSize, maxFileCount)); ^~~~~ /home/[USER]/src/openMittsu/src/Init.h:150:51: error: ‘rotating_file_sink_mt’ is not a member of ‘spdlog::sinks’ /home/[USER]/src/openMittsu/src/Init.h:150:129: error: no matching function for call to ‘make_shared< >(std::string, std::size_t&, std::size_t&)’ 150 sinks.push_back(std::make_shared(logFileName.toStdString(), maxLogfileSize, maxFileCount)); ^ In file included from /usr/include/c++/9/memory:81, from /usr/include/spdlog/common.h:14, from /usr/include/spdlog/spdlog.h:12, from /home/[USER]/src/openMittsu/src/utility/Logging.h:16, from /home/[USER]/src/openMittsu/src/Init.h:21, from /home/[USER]/src/openMittsu/src/main.cpp:1: /usr/include/c++/9/bits/shared_ptr.h:714:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’ 714 make_shared(_Args&&... __args) ^~~ /usr/include/c++/9/bits/shared_ptr.h:714:5: note: template argument deduction/substitution failed: In file included from /home/[USER]/src/openMittsu/src/main.cpp:1: /home/[USER]/src/openMittsu/src/Init.h:150:129: error: template argument 1 is invalid 150 sinks.push_back(std::make_shared(logFileName.toStdString(), maxLogfileSize, maxFileCount));
blizzard4591 commented 4 years ago

My guess would be that your Spdlog version is either too old or too new. I have not updated the git submodule for spdlog in a while so it might be that the interface has changed in the meantime.

I just bumped it and commited the updated submodule, but it still works without a problem.

Maybe try uninstalling your system version of libspdlog and use the supplied version (its header-only, so no pollution of the system happens) by way of the git submodules: git submodule update --init --recursive (the init is only necessary the first time).

This should then be used without having to do anything. If this does not help, we will investigate further :)

gyps commented 4 years ago

Thanks for the hint. I tried it and it cmake'd and compiled without any error. When I started it, unfortunately I got:

~/src/openMittsu/build$ ./openMittsu Logging location: ~/.local/share/openMittsu.log Segmentation fault

Log-File is empty.

blizzard4591 commented 4 years ago

Could you run with gdb or similar? Since you compiled openMittsu yourself, symbols should be available and tell us more about the crash location. With some more information, I'll be happy to fix this for you :)

For example on Debian:

I hope this helps!

gyps commented 4 years ago

Problem seems to be spdlog related to me:

(gdb) run Starting program: ~/src/openMittsu/build/openMittsu [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Logging location: ~/.local/share/openMittsu.log

Program received signal SIGSEGV, Segmentation fault. 0x00005555559c2700 in spdlog::logger::should_log(spdlog::level::level_enum) const () (gdb) bt

0 0x00005555559c2700 in spdlog::logger::should_log(spdlog::level::level_enum) const ()

1 0x00005555559daee4 in void spdlog::logger::log<std::cxx11::basic_string<char, std::char_traits, std::allocator > >(spdlog::source_loc, spdlog::level::level_enum, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) ()

2 0x00005555559d5451 in void spdlog::logger::log<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >(spdlog::level::level_enum, char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) ()

3 0x0000555555a10db5 in void spdlog::logger::info<std::cxx11::basic_string<char, std::char_traits, std::allocator >>(char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) ()

4 0x0000555555a05f84 in main ()

blizzard4591 commented 4 years ago

I installed debian testing, installed the packages, compiled and ran - it seems to work. I then installed the libspdlog-dev package, re-cmaked, build again and tested - still works. Did you try deleting the build directory and rebuilding? Could you test whether the tests execute (./openMittsuTests)? Could you check permissions on the log dir and file (for you ~/.local/share/openMittsu.log)? Maybe executing it from the build folder makes a difference? Very interesting issue! I hope we get to the bottom of this.

blizzard4591 commented 4 years ago

Sorry for coming back to this so late, I think I fixed this in 68f5a74787ae6aaf264aa31574c8e65f99f73244. Could you test this again and tell me if it works? Of course, after pulling master, do not forget to update the submodules as well (git submodule update --recursive) :)