[SOLVED] ../../zen/http.cpp:198:21: error: ‘TlsContext’ was not declared in this scope

Get help for specific problems
Posts: 310
Joined: 7 Jan 2018

bgstack15

When trying to compile the latest and greatest version of FreeFileSync, I am unable to resolve a dependency needed for "open_ssl.h," or more specifically for TlsContext.
[bgstack15@localhost|/usr/src/freefilesync/10.14-1/FreeFileSync/Source]$ make
mkdir -p /tmp/FreeFileSync_Make/ffs/src/../../zen/
g++ -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -DLIBSSH2_OPENSSL -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags openssl` `pkg-config --cflags libcurl` `pkg-config --cflags libssh2` `pkg-config --cflags gtk+-3.0` -isystem/usr/include/gtk-3.0 `pkg-config --cflags libselinux` -DHAVE_SELINUX -c ../../zen/http.cpp -o /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o
../../zen/http.cpp:10:14: fatal error: open_ssl.h: No such file or directory
     #include "open_ssl.h"
              ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:124: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o] Error 1
I could not find any relevant files in libssh2-devel or openssl-devel-1.1.1c-2.fc29.x86_64. So when I comment out this included file, I get a more specific error.
[bgstack15@localhost|/usr/src/freefilesync/10.14-1/FreeFileSync/Source]$ make
mkdir -p /tmp/FreeFileSync_Make/ffs/src/../../zen/
g++ -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -DLIBSSH2_OPENSSL -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags openssl` `pkg-config --cflags libcurl` `pkg-config --cflags libssh2` `pkg-config --cflags gtk+-3.0` -isystem/usr/include/gtk-3.0 `pkg-config --cflags libselinux` -DHAVE_SELINUX -c ../../zen/http.cpp -o /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o
../../zen/http.cpp:198:21: error: ‘TlsContext’ was not declared in this scope
     std::unique_ptr<TlsContext> tlsCtx_; //optional: support HTTPS
                     ^~~~~~~~~~
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:124: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o] Error 1
But I cannot find what provides whatever is needed (probably the TlsContext class).

My build environment is Fedora 29. I have all the build dependencies installed that are required for building FreeFileSync 10.13.
BuildRequires: boost-devel
BuildRequires: compat-wxGTK3-gtk2-devel
BuildRequires: desktop-file-utils
BuildRequires: gcc-c++
BuildRequires: ImageMagick
BuildRequires: libcurl-devel %{min_libcurl}
BuildRequires: libssh2-devel %{min_libssh2}
BuildRequires: patch
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(zlib)
%if 0%{?el6}%{?el7}
BuildRequires: wxGTK-devel
BuildRequires: %{scl_buildreq}
BuildRequires: openssl-%{name}-devel %{min_openssl}
Requires: libcurl %{min_libcurl}
Requires: libssh2 %{min_libssh2}
Requires: openssl-%{name}-libs %{min_openssl}
%else
BuildRequires: openssl-devel
%endif
The bundled file FreeFileSync/Source/afs/libssh2/init_open_ssl.h, when included (with a -Iafs/libssh in the Makefile, and modifying the name of the included file in http.cpp), does not resolve the issue.

Can anyone please help me compile this on Fedora 29? Is there perhaps a file missing from the source zip that would facilitate the compilation of this application?
User avatar
Site Admin
Posts: 7285
Joined: 9 Dec 2007

Zenju

Fixed, the file was indeed missing. PS: FFS does not depend on boost
Posts: 310
Joined: 7 Jan 2018

bgstack15

Thank you for the rapid response! I completely borked my dev env playing with different releases of openssl, and had to switch to a new one.
I get this rather curious error now, during the linking:
g++ -o ../Build/Bin/FreeFileSync /tmp/FreeFileSync_Make/ffs/src/base/algorithm.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/application.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/binary.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/comparison.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/config.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/db_file.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/dir_lock.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/ffs_paths.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/file_hierarchy.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/generate_logfile.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/icon_buffer.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/icon_loader.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/localization.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/parallel_scan.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/path_filter.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/perf_check.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/resolve_path.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/status_handler.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/structures.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/synchronization.cpp.o /tmp/FreeFileSync_Make/ffs/src/base/versioning.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/abstract.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/concrete.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/ftp.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/gdrive.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/init_curl_libssh2.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/native.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/sftp.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/libssh2/init_libssh2.cpp.o /tmp/FreeFileSync_Make/ffs/src/afs/libssh2/init_open_ssl.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/batch_config.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/abstract_folder_picker.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/batch_status_handler.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/cfg_grid.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/command_box.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/folder_history_box.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/folder_selector.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/file_grid.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/file_view.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/log_panel.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/tree_grid.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/gui_generated.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/gui_status_handler.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/main_dlg.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/progress_indicator.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/search_grid.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/small_dlgs.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/sync_cfg.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/taskbar.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/tray_icon.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/triple_splitter.cpp.o /tmp/FreeFileSync_Make/ffs/src/ui/version_check.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/recycler.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/file_access.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/file_io.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/file_traverser.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/zstring.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/format_unit.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/process_priority.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/shutdown.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/thread.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../zen/zlib_wrap.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/file_drop.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/grid.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/image_tools.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/graph.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/tooltip.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/image_resources.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/popup_dlg.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../wx+/popup_dlg_generated.cpp.o /tmp/FreeFileSync_Make/ffs/src/../../xBRZ/src/xbrz.cpp.o -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread `pkg-config --libs   openssl` `pkg-config --libs   libcurl` `pkg-config --libs   libssh2` `pkg-config --libs   gtk+-2.0` `pkg-config --libs libselinux`
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::HttpInputStream::~HttpInputStream()':
http.cpp:(.text+0x77a): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::internetIsAlive()':
http.cpp:(.text+0x1efa): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `(anonymous namespace)::sendHttpRequestImpl(zen::Zbase<char, zen::DefaultStoragePolicy> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*, zen::Zbase<char, zen::DefaultStoragePolicy> const&, zen::Zbase<char, zen::DefaultStoragePolicy> const*, std::function<void (long)> const&) [clone .isra.237]':
http.cpp:(.text+0x23df): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::HttpInputStream::readAll[abi:cxx11]()':
http.cpp:(.text+0x2754): undefined reference to `zen::TlsContext::tryRead(void*, unsigned long)'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::HttpInputStream::read(void*, unsigned long)':
http.cpp:(.text+0x3010): undefined reference to `zen::TlsContext::tryRead(void*, unsigned long)'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `std::default_delete<zen::TlsContext>::operator()(zen::TlsContext*) const [clone .isra.62] [clone .part.63]':
http.cpp:(.text.unlikely._ZNKSt14default_deleteIN3zen10TlsContextEEclEPS1_.isra.62.part.63[_ZN3zen15HttpInputStream4ImplC5ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE]+0x5): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `(anonymous namespace)::sendHttpRequestImpl(zen::Zbase<char, zen::DefaultStoragePolicy> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*, zen::Zbase<char, zen::DefaultStoragePolicy> const&, zen::Zbase<char, zen::DefaultStoragePolicy> const*, std::function<void (long)> const&) [clone .isra.237] [clone .cold.276]':
http.cpp:(.text.unlikely+0x385): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::HttpInputStream::Impl::tryRead(void*, unsigned long)':
http.cpp:(.text._ZN3zen15HttpInputStream4Impl7tryReadEPvm[_ZN3zen15HttpInputStream4Impl7tryReadEPvm]+0x2e): undefined reference to `zen::TlsContext::tryRead(void*, unsigned long)'
/usr/bin/ld: /tmp/FreeFileSync_Make/ffs/src/../../zen/http.cpp.o: in function `zen::HttpInputStream::Impl::Impl(zen::Zbase<char, zen::DefaultStoragePolicy> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*, bool, zen::Zbase<char, zen::DefaultStoragePolicy> const&, zen::Zbase<char, zen::DefaultStoragePolicy> const*, std::function<void (long)> const&)':
http.cpp:(.text._ZN3zen15HttpInputStream4ImplC2ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE[_ZN3zen15HttpInputStream4ImplC5ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE]+0xb4b): undefined reference to `zen::TlsContext::TlsContext(int, zen::Zbase<char, zen::DefaultStoragePolicy> const&, zen::Zbase<char, zen::DefaultStoragePolicy> const*)'
/usr/bin/ld: http.cpp:(.text._ZN3zen15HttpInputStream4ImplC2ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE[_ZN3zen15HttpInputStream4ImplC5ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE]+0xb68): undefined reference to `zen::TlsContext::~TlsContext()'
/usr/bin/ld: http.cpp:(.text._ZN3zen15HttpInputStream4ImplC2ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE[_ZN3zen15HttpInputStream4ImplC5ERKNS_5ZbaseIcNS_20DefaultStoragePolicyEEEPKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_ESaISF_EEbS6_PS5_RKSt8functionIFvlEE]+0xc07): undefined reference to `zen::TlsContext::tryWrite(void const*, unsigned long)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:120: ../Build/Bin/FreeFileSync] Error 1
I am continuing to investigate on my own, but if you could point me in the right direction, that'd be great!
Posts: 310
Joined: 7 Jan 2018

bgstack15

Got it! Need to include the added file open_ssl.cpp to the CPP_FILES in the Makefile.
diff -Naur 10.14-0/FreeFileSync/Source/Makefile 10.14-1/FreeFileSync/Source/Makefile
--- 10.14-0/FreeFileSync/Source/Makefile        2019-07-15 10:47:45.750085144 -0400
+++ 10.14-1/FreeFileSync/Source/Makefile        2019-07-15 15:03:52.346413941 -0400
@@ -99,6 +99,7 @@
 CPP_FILES+=../../zen/shutdown.cpp
 CPP_FILES+=../../zen/thread.cpp
 CPP_FILES+=../../zen/zlib_wrap.cpp
+CPP_FILES+=../../zen/open_ssl.cpp
 CPP_FILES+=../../wx+/file_drop.cpp
 CPP_FILES+=../../wx+/grid.cpp
 CPP_FILES+=../../wx+/image_tools.cpp
General reference: https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix

I examined the linker parameters and realized the new file, open_ssl.cpp.o, was not included.

Thanks, Zenju, for writing and publishing this open-source software.
User avatar
Site Admin
Posts: 7285
Joined: 9 Dec 2007

Zenju

Just fixed the makefile :) but you beat me to it.