Skip to content
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

spdlog dependency issue #54

Open
gyps opened this issue Dec 22, 2019 · 6 comments
Open

spdlog dependency issue #54

gyps opened this issue Dec 22, 2019 · 6 comments

Comments

@gyps
Copy link

gyps commented Dec 22, 2019

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_sharedspdlog::sinks::stdout_sink_st());
| ^~~~~~~~~~~~~~
/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_sharedspdlog::sinks::stdout_sink_st());
| ^
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_sharedspdlog::sinks::stdout_sink_st());
| ^
/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_sharedspdlog::sinks::rotating_file_sink_mt(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_sharedspdlog::sinks::rotating_file_sink_mt(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_sharedspdlog::sinks::rotating_file_sink_mt(logFileName.toStdString(), maxLogfileSize, maxFileCount));
|

@blizzard4591
Copy link
Owner

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
Copy link
Author

gyps commented Jan 6, 2020

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
Copy link
Owner

blizzard4591 commented Jan 7, 2020

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:

  • apt install gdb
  • gdb ./openMittsu
  • type "run" to start execution
  • (wait for segfault)
  • type "bt" for printing a backtrace

I hope this helps!

@gyps
Copy link
Author

gyps commented Jan 7, 2020

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
Copy link
Owner

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
Copy link
Owner

Sorry for coming back to this so late, I think I fixed this in 68f5a74. 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) :)

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