SpectrumIM / spectrum2

Spectrum 2 IM transports
https://spectrum.im
408 stars 91 forks source link

Compatibility with latest Protobuf #496

Closed b4sti closed 1 month ago

b4sti commented 1 month ago

Seems like protobuf requires CXX 14 now to build. Unfortunately changing CMAKE_CXX_STANDARD from 11 to 14 in CMakeLists.txt did not fix it:

FAILED: plugin/cpp/CMakeFiles/transport-plugin.dir/Util.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DBOOST_FILESYSTEM_VERSION=3 -DPURPLE_RUNTIME=0 -DSPECTRUM_VERSION=\"2.2.1\" -DSUPPORT_LEGACY_CAPS -DWITH_LIBEVENT -DWITH_LOG4CXX -DWITH_PROTOBUF -DWITH_SQLITE -Dtransport_plugin_EXPORTS -I/usr/include/libpurple -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I./spectrum2-2.2.1/include  -O2 -pipe -std=c++14 -fPIC   -fPIC -MD -MT plugin/cpp/CMakeFiles/transport-plugin.dir/Util.cpp.o -MF plugin/cpp/CMakeFiles/transport-plugin.dir/Util.cpp.o.d -o plugin/cpp/CMakeFiles/transport-plugin.dir/Util.cpp.o -c ./spectrum2-2.2.1/plugin/cpp/Util.cpp
./spectrum2-2.2.1/plugin/cpp/Util.cpp: In function ‘void Transport::Util::createDirectories(Transport::Config*, const boost::filesystem::path&)’:
./spectrum2-2.2.1/plugin/cpp/Util.cpp:56:38: error: ‘const class boost::filesystem::path’ has no member named ‘branch_path’
   56 |         createDirectories(config, ph.branch_path());
vitalyster commented 1 month ago

You need to compile Swiften in C++14 mode first

vitalyster commented 1 month ago

Well, for branch_path and other boost.filesystem deprecations you need to define BOOST_FILESYSTEM_ALLOW_DEPRECATED But there are can be a lot of other problems in both Spectrum and Swiften

b4sti commented 1 month ago

You are right, there are two independent issues. For protobuf it seems to be enough to set CMAKE_CXX_STANDARD=14 in CMakeLists.txt. The boost issues are unrelated and caused by an update of boost to 1.85 I recently did. Regarding the boost issues I will try to apply the replacements for the deprecated methods here: https://www.boost.org/doc/libs/1_85_0/libs/filesystem/doc/deprecated.html

vitalyster commented 1 month ago

We should be compatible with previous boost versions so it's better to enable deprecated functions for now

dekeonus commented 1 month ago

From: https://www.boost.org/users/history/version_1_85_0.html

Removed APIs that were previously declared deprecated. In particular, path and recursive_directory_iterator member functions, is_regular, copy_directory, symbolic_link_exists, complete, copy_option, symlink_option, as well as boost/filesystem/convenience.hpp and boost/filesystem/path_traits.hpp headers were removed. Possible replacements for the removed components are mentioned in the documentation.

BOOST_FILESYSTEM_ALLOW_DEPRECATED only suppressed warnings (referring to branch_path() and is_regular() as used in spectrum2). From: https://www.boost.org/users/history/version_1_81_0.html

Previously deprecated APIs will now generate compilation warnings on use. To suppress these warnings, BOOST_FILESYSTEM_ALLOW_DEPRECATED macro can be defined when compiling user's code.

vitalyster commented 1 month ago

Well, these functions were deprecated a long time ago and many boost versions before, it is safe to use replacements now

vitalyster commented 1 month ago

Now it is possible to override CMAKE_CXX_STANDARD from command line and it is actually used in our CI