Cannot build FreeFilSync 9.7 due to `warn_static` was not declared in this scope error

Get help for specific problems
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

FreeFileSync 9.7 source code
running in Ubuntu 14.04 LTS
g++ (GCC) 7.2.0

What I really want is the latest version of FreeFileSync in my Ubuntu 14.04 distribution. I decided to try building from source since only up to FreeFileSync version 7.7 is available via `sudo apt install freefilesync`.

When I run `make` in `FreeFileSync_9.7_Source-20180115/FreeFileSync/Source` I get:

gabriel$ make
mkdir -p ../Obj/FFS_GCC_Make_Release/ffs/src/ui/
g++ -std=c++14 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -Wall -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags gtk+-2.0` `pkg-config --cflags unity` -DHAVE_UBUNTU_UNITY -c ui/main_dlg.cpp -o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/main_dlg.o
ui/main_dlg.cpp: In member function ‘void MainDialog::setGlobalCfgOnInit(const xmlAccess::XmlGlobalSettings&)’:
ui/main_dlg.cpp:925:5: error: ‘warn_static’ was not declared in this scope
warn_static("finish")
^~~~~~~~~~~
ui/main_dlg.cpp:925:5: note: suggested alternative: ‘static’
warn_static("finish")
^~~~~~~~~~~
static
ui/main_dlg.cpp: In member function ‘virtual void MainDialog::OnConfigNew(wxCommandEvent&)’:
ui/main_dlg.cpp:3027:5: error: ‘warn_static’ was not declared in this scope
warn_static("replace by loadConfiguration({});")
^~~~~~~~~~~
ui/main_dlg.cpp:3027:5: note: suggested alternative: ‘static’
warn_static("replace by loadConfiguration({});")
^~~~~~~~~~~
static
ui/main_dlg.cpp: In member function ‘void MainDialog::onCfgGridSelection(zen::GridSelectEvent&)’:
ui/main_dlg.cpp:3067:5: error: ‘warn_static’ was not declared in this scope
warn_static("support the last one??? does NOT support newConfig.mainCfg.globalFilter.excludeFilter!!!")
^~~~~~~~~~~
ui/main_dlg.cpp:3067:5: note: suggested alternative: ‘static’
warn_static("support the last one??? does NOT support newConfig.mainCfg.globalFilter.excludeFilter!!!")
^~~~~~~~~~~
static
/usr/local/include/c++/7.2.0/bits/stl_map.h:516: confused by earlier errors, bailing out
make: *** [../Obj/FFS_GCC_Make_Release/ffs/src/ui/main_dlg.o] Error 1

Related thread: viewtopic.php?t=4014
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

UPDATE: in my long long long process of trying to resolve dependencies and get things compiled (including gcc) so that I can compile FreeFileSync, I think I may have some bad object files or something as remnants of a previous `make` attempt sitting in my FreeFileSync build folder.

So....I removed it, extracted the source code anew, ran `make` again, and now have these errors instead (especially see bold part below):

$ make
mkdir -p ../Obj/FFS_GCC_Make_Release/ffs/src/ui/
g++ -std=c++14 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -Wall -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags gtk+-2.0` `pkg-config --cflags unity` -DHAVE_UBUNTU_UNITY -c ui/main_dlg.cpp -o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/main_dlg.o
ui/main_dlg.cpp: In member function ‘xmlAccess::XmlGlobalSettings MainDialog::getGlobalCfgBeforeExit()’:
ui/main_dlg.cpp:1059:68: error: ‘class wxListBox’ has no member named ‘GetTopItem’; did you mean ‘GetCount’?
globalSettings.gui.cfgFileHistFirstItemPos = m_listBoxHistory->GetTopItem();
^~~~~~~~~~
GetCount
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

Next problem possibly found. I need to update wxWidgets from 3.0.3 to 3.1.0.

http://docs.wxwidgets.org/3.0.3/classwx_list_box.html - notice class wxListBox does NOT have the GetTopItem() public method, but version 3.1.0 does: http://docs.wxwidgets.org/3.1.0/classwx_list_box.html
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

wxWidgets 3.1.0 installed. Now I'm back to getting the original "warn_static not declared" errors as indicated above in my 1st post.
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

Getting this too:

$ make
mkdir -p ../Obj/FFS_GCC_Make_Release/ffs/src/
g++ -std=c++14 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -Wall -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags gtk+-2.0` `pkg-config --cflags unity` -DHAVE_UBUNTU_UNITY -c algorithm.cpp -o ../Obj/FFS_GCC_Make_Release/ffs/src/algorithm.o
In file included from /usr/local/include/c++/7.2.0/bits/stl_algobase.h:64:0,
from /usr/local/include/c++/7.2.0/bits/char_traits.h:39,
from /usr/local/include/c++/7.2.0/string:40,
from ../../zen/i18n.h:10,
from <command-line>:0:
/usr/local/include/c++/7.2.0/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = zen::FixedList<zen::XmlElement>::FixedIterator<const zen::FixedList<zen::XmlElement>::Node, const zen::XmlElement>; _T2 = zen::FixedList<zen::XmlElement>::FixedIterator<const zen::FixedList<zen::XmlElement>::Node, const zen::XmlElement>; typename std::__decay_and_strip<_T2>::__type = zen::FixedList<zen::XmlElement>::FixedIterator<const zen::FixedList<zen::XmlElement>::Node, const zen::XmlElement>; typename std::__decay_and_strip<_Tp>::__type = zen::FixedList<zen::XmlElement>::FixedIterator<const zen::FixedList<zen::XmlElement>::Node, const zen::XmlElement>]’:
../../zenXml/zenxml/dom.h:186:133: required from here
/usr/local/include/c++/7.2.0/bits/stl_pair.h:525:5: internal compiler error: Segmentation fault
}

^
0xad5c5f crash_signal
../.././gcc/toplev.c:337
0x73eb23 lookup_page_table_entry
../.././gcc/ggc-page.c:635
0x73eb23 ggc_set_mark(void const*)
../.././gcc/ggc-page.c:1532
0x697dc1 gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:133
0x699ab9 gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:462
0x699703 gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:445
0x699b63 gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:350
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x6995fb gt_ggc_mx_lang_tree_node(void*)
./gt-cp-tree.h:499
0x8eb3a3 gt_ggc_mx_tree_statement_list_node(void*)
/home/gabriel/Downloads/Install_Files/gcc_source/gcc-7.2.0/host-x86_64-pc-linux-gnu/gcc/gtype-desc.c:1860
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [../Obj/FFS_GCC_Make_Release/ffs/src/algorithm.o] Error 1
Posts: 306
Joined: 7 Jan 2018

bgstack15

I have been trying to compile on Fedora 27, so my experience is a little different. Maybe curly braces either in the FreeFileSync code are not perfectly balanced (as suggested by your bold sections of output), or maybe even in your gcc implementation. It looks like you've got the gcc source code there.

About warn_static, I found a solution in the patch at file https://github.com/flathub/org.freefilesync.FreeFileSync/blob/master/patch01-build.patch. In brief, you should add
#include <zen/warn_static.h>
to a few files, including ../../zen/file_io.cpp, ../../zen/shell_execute.h, ui/progress_indicator.cpp, and lib/versioning.cpp.

Perusing how other people have prepared their compilations of FreeFileSync might help: https://github.com/search?o=desc&q=freefilesync+warn_static&s=indexed&type=Code&utf8=%E2%9C%93

edit: add more content

Regarding the "globalSettings.gui.cfgFileHistFirstItemPos = m_listBoxHistory->GetTopItem();" problem, I've seen implementations that replace it with this sed:
sed 's/m_listBoxHistory->GetTopItem()/0/g' -i %{pname}/Source/ui/main_dlg.cpp
Which makes the whole line:
globalSettings.gui.cfgFileHistFirstItemPos = 0;
Reference: https://github.com/PhantomX/chinforpms/blob/eaabb9d30d509adc86e7217815dfaad235bb1f59/freefilesync/freefilesync.spec
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

Thanks for your help! That info about adding the #include was very helpful. I made several minor changes to the source code, following that example you sent me, and I got it to fully build.

See my executable here now for FreeFileSync 9.7 in Ubuntu 14.04: https://github.com/ElectricRCAircraftGuy/FreeFileSync/tree/master/FreeFileSync_9.7_Source/FreeFileSync/Build

But....I can only get it to run now if I do the following each time I boot up:
LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
Source: https://stackoverflow.com/a/20357035/4561887

Otherwise I get the following errors. How can I fix this now?
gabriel@gabriel-MacBook:/$ FreeFileSync
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by FreeFileSync)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by FreeFileSync)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by FreeFileSync)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by FreeFileSync)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by FreeFileSync)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_aui-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_aui-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/lib/libwx_gtk2u_xrc-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_xrc-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_xrc-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/lib/libwx_gtk2u_html-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_html-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_html-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libwx_gtk2u_html-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_qa-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_qa-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/lib/libwx_gtk2u_adv-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_adv-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libwx_gtk2u_adv-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_adv-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/lib/libwx_gtk2u_core-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_gtk2u_core-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libwx_gtk2u_core-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_gtk2u_core-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_baseu_xml-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_baseu_xml-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libwx_baseu_net-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_baseu_net-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_baseu_net-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/lib/libwx_baseu-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/lib/libwx_baseu-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/lib/libwx_baseu-3.1.so.0)
FreeFileSync: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/libwx_baseu-3.1.so.0)
gabriel@gabriel-MacBook:/media/gabriel/GS_Storage/Install_Files-Edubuntu_14_04/FreeFileSync$
Posts: 22
Joined: 31 Jul 2016

eRCaGuy

Note: I'm asking around on this one. I really just want FreeFileSync 9.7 to run in Ubuntu 14.04. I don't care how I get it done.
https://askubuntu.com/questions/1000519/how-do-i-get-the-latest-version-of-freefilesync-currently-9-7-to-run-in-ubuntu