Compile FreeFileSync 10.1 on Fedora

How to compile FreeFileSync 10.1 on Fedora

Tested on Fedora 28

1. Install build dependencies.

dnf install -y boost-devel compat-wxGTK3-gtk2-devel gcc-c++ gtk+-devel gtk3-devel wxGTK-devel wxGTK3-devel

2. Fetch and extract source

wget --user-agent 'Firefox 60.0 (GNU/Linux) X11' -L https://www.freefilesync.org/download/FreeFileSync_10.1_Source.zip
mkdir 10.1
pushd 10.1; unzip ../FreeFileSync_10.1_Source.zip; popd

3. Prepare patch required to compile on Fedora.

pfile=FreeFileSync-10.1-1.fc28.patch
cat <<'EOF' > "${pfile}"
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/Makefile 10.1-0/FreeFileSync/Source/Makefile
--- 10.1/FreeFileSync/Source/Makefile	2018-06-03 04:27:00.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/Makefile	2018-06-07 22:44:44.919899060 -0400
@@ -5,15 +5,15 @@
 APPSHAREDIR = $(SHAREDIR)/$(APPNAME)
 DOCSHAREDIR = $(SHAREDIR)/doc/$(APPNAME)
 
-CXXFLAGS  = -std=c++17 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -isystem../../boost -include "zen/i18n.h" -include "zen/warn_static.h" \
+CXXFLAGS  = -std=c++17 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -isystem/usr/include/boost -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
 
-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread
 
 #Gtk - support recycler/icon loading/no button border/grid scrolling
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 #support for SELinux (optional)
 SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)
@@ -125,5 +125,5 @@
 	$(APPSHAREDIR)
 
 	mkdir -p $(DOCSHAREDIR)
-	cp ../Build/Changelog.txt $(DOCSHAREDIR)/changelog
+	cp ../../Changelog.txt $(DOCSHAREDIR)/changelog
 	gzip $(DOCSHAREDIR)/changelog
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/RealTimeSync/Makefile 10.1-0/FreeFileSync/Source/RealTimeSync/Makefile
--- 10.1/FreeFileSync/Source/RealTimeSync/Makefile	2018-06-03 04:27:00.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/RealTimeSync/Makefile	2018-06-07 22:20:59.043383931 -0400
@@ -6,11 +6,11 @@
 -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor \
 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread
 
-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread
 
 #Gtk - support "no button border"
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 CPP_FILES=
 CPP_FILES+=application.cpp
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/main_dlg.cpp 10.1-0/FreeFileSync/Source/ui/main_dlg.cpp
--- 10.1/FreeFileSync/Source/ui/main_dlg.cpp	2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/main_dlg.cpp	2018-06-07 22:25:32.856972097 -0400
@@ -11,6 +11,7 @@
 #include <zen/thread.h>
 #include <zen/shell_execute.h>
 #include <zen/perf.h>
+/* #include <zen/warn_static.h>  REMOVED FOR TESTING. Add back on any failures. */
 #include <wx/clipbrd.h>
 #include <wx/wupdlock.h>
 #include <wx/sound.h>
@@ -4844,7 +4845,7 @@
         globalCfg_.gui.lastUpdateCheck = 0; //reset to GlobalSettings.xml default value!
 
     m_menuItemCheckVersionAuto->Check(updateCheckActive(globalCfg_.gui.lastUpdateCheck));
-
+    /*
     if (shouldRunAutomaticUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4852,6 +4853,7 @@
         automaticUpdateCheckEval(this, globalCfg_.gui.lastUpdateCheck, globalCfg_.gui.lastOnlineVersion,
                                  automaticUpdateCheckRunAsync(automaticUpdateCheckPrepare().get()).get());
     }
+    */
 }
 
 
@@ -4859,7 +4861,7 @@
 {
     //execute just once per startup!
     Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnRegularUpdateCheck), nullptr, this);
-
+    /*
     if (shouldRunAutomaticUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4873,6 +4875,7 @@
                                      resultAsync.get()); //run on main thread:
         });
     }
+    */
 }
 
 
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/small_dlgs.cpp 10.1-0/FreeFileSync/Source/ui/small_dlgs.cpp
--- 10.1/FreeFileSync/Source/ui/small_dlgs.cpp	2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/small_dlgs.cpp	2018-06-07 22:20:59.050384125 -0400
@@ -970,7 +970,8 @@
     //setMainInstructionFont(*m_staticTextMain);
 
     m_bitmapActivation->SetBitmap(getResourceImage(L"website"));
-    m_textCtrlOfflineActivationKey->ForceUpper();
+    // Fedora 27 does not have wxWidgets 3.1.1 yet. https://github.com/wxWidgets/wxWidgets/commit/69b66e9e2e2b8e49e3816acdde079686ce9b0da1
+    //m_textCtrlOfflineActivationKey->ForceUpper();
 
     m_textCtrlLastError           ->ChangeValue(lastErrorMsg);
     m_textCtrlManualActivationUrl ->ChangeValue(manualActivationUrl);
diff -x '*.orig' -x '*.rej' -Naur 10.1/FreeFileSync/Source/ui/version_check_impl.h 10.1-0/FreeFileSync/Source/ui/version_check_impl.h
--- 10.1/FreeFileSync/Source/ui/version_check_impl.h	2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/FreeFileSync/Source/ui/version_check_impl.h	2018-06-07 22:20:59.051384152 -0400
@@ -14,7 +14,7 @@
 
 namespace fff
 {
-inline
+
 time_t getVersionCheckInactiveId()
 {
     //use current version to calculate a changing number for the inactive state near UTC begin, in order to always check for updates after installing a new version
@@ -38,7 +38,6 @@
 }
 
 
-inline
 time_t getVersionCheckCurrentTime()
 {
     return std::time(nullptr);
diff -x '*.orig' -x '*.rej' -Naur 10.1/wx+/grid.cpp 10.1-0/wx+/grid.cpp
--- 10.1/wx+/grid.cpp	2018-06-03 04:27:02.000000000 -0400
+++ 10.1-0/wx+/grid.cpp	2018-06-07 22:30:02.202436428 -0400
@@ -1169,7 +1169,9 @@
             {
                 if (overlapPix != 0)
                 {
-                    const double scrollSpeed = wnd_.ToDIP(overlapPix) * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
+                    // Fedora 28 does not have wxGTK 3.1.1 yet. This probably breaks HiDPI usage
+                    //const double scrollSpeed = wnd_.ToDIP(overlapPix) * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
+                    const double scrollSpeed = overlapPix * mouseDragSpeedIncScrollU; //unit: [scroll units / sec]
                     toScroll += scrollSpeed * deltaSecs;
                 }
                 else
EOF

A summary of what this patch does:

  • Ensure using the system boost library. It appears the source looks for a locally-bundled boost lib, which was not included with the 10.1 code.
  • Link to zlib because previous versions use to, and without I could not compile.
  • Compile against gtk+3 instead of gtk+2 because I could not get it to compile against gtk2.
  • Place the changelog text file where the Makefile expects.
  • Disable the check for updates and lines related to activation, particularly a few based on a newer version of wxWidgets which Fedora 28 does not have yet (wxWidgets 3.1.1).
  • Revert to an older version of the scrollSpeed calculation because wxWidgets 3.1.1 is not in Fedora yet.

4. Apply patch

cd 10.1
patch -p1 < ../FreeFileSync-10.1-1.fc28.patch

5. Compile and install

cd FreeFileSync/Source
make && sudo make install

Next steps

Build an rpm for FreeFileSync (gitlab)

References

Weblinks

  1. How-to: Build 10.* from Source (Linux Mint) (FreeFileSync forum)
  2. Compiling FreeFileSync 10.0 on Fedora (this blog)
  3. Compiling FreeFileSync on Fedora (this blog)
  4. AUR (en) – freefilesync
Advertisements

Compiling FreeFileSync 10.0 on Fedora

When compiling the latest release of FreeFileSync, I came across this error (after applying my basic Fedora patches):

cc1plus: warning: ../../boost: No such file or directory [-Wmissing-include-dirs]
g++ -o ../Build/FreeFileSync ../Obj/FFS_GCC_Make_Release/ffs/src/algorithm.o ../Obj/FFS_GCC_Make_Release/ffs/src/application.o ../Obj/FFS_GCC_Make_Release/ffs/src/comparison.o ../Obj/FFS_GCC_Make_Release/ffs/src/structures.o ../Obj/FFS_GCC_Make_Release/ffs/src/synchronization.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/abstract.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/concrete.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/native.o ../Obj/FFS_GCC_Make_Release/ffs/src/file_hierarchy.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/batch_config.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/batch_status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/cfg_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/command_box.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/folder_history_box.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/folder_selector.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/file_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/file_view.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/tree_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/gui_generated.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/gui_status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/main_dlg.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/progress_indicator.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/search.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/small_dlgs.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/sync_cfg.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/taskbar.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/tray_icon.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/triple_splitter.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/version_check.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/binary.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/db_file.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/dir_lock.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/ffs_paths.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/generate_logfile.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/hard_filter.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/icon_buffer.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/icon_loader.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/localization.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/parallel_scan.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/process_xml.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/resolve_path.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/perf_check.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/versioning.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/xml_io.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/recycler.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_access.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_io.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_traverser.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/zstring.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/format_unit.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/process_priority.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/shutdown.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/file_drop.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/image_tools.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/graph.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/http.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/tooltip.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/image_resources.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/popup_dlg.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/popup_dlg_generated.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/zlib_wrap.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../xBRZ/src/xbrz.o -s -no-pie `wx-config --libs std, aui --debug=no` -pthread `pkg-config --libs   gtk+-3.0` `pkg-config --libs libselinux`
/usr/bin/ld: ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/zlib_wrap.o: undefined reference to symbol 'compressBound@@ZLIB_1.2.0'
//usr/lib64/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:103: ../Build/FreeFileSync] Error 1

After some Internet searches, I found the answer!

All you have to do is fix the linking to include the -lz flag. In fact, previous versions of the software included the -lz flag in the makefile. It was probably removed as an oversight, but it compiled and operated on Fedora GNU/Linux once I added back in the linking flag. I guess omitting the z library prevents the binary from building successfully! Who’da thunk it?

Here is the diff:

--- 10.0-0/FreeFileSync/Source/Makefile	2018-04-26 16:57:13.000000000 -0400
+++ 10.0-1/FreeFileSync/Source/Makefile	2018-05-01 07:13:57.430369158 -0400
@@ -9,11 +9,11 @@
 -Wall -Wfatal-errors  -Winit-self -Wmissing-include-dirs -Wswitch-enum -Wmain -Wnon-virtual-dtor -Wcast-align -Wshadow -Wno-deprecated-declarations \
 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread
 
-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread
 
 #Gtk - support recycler/icon loading/no button border/grid scrolling
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 #support for SELinux (optional)
 SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)

References

Weblinks

  1. https://stackoverflow.com/questions/19901934/strange-linking-error-dso-missing-from-command-line/20206371#20206371
  2. Discussion about linking to a lib in general https://github.com/JuliaLang/julia/issues/4742

Compiling FreeFileSync on Fedora

FreeFileSync is a great open source GUI application. Think of it as the GUI for rsync.

The Freefilesync team does not provide an rpm of the software, but they do provide the source code. Now, the team does not allow direct linking, so that link has a HMTL5 rel=”noreferrer” which might make it work for you.

Update:

I finally got a scriptlet to work with download the source code! Use this:

wget --referer "https://www.freefilesync.org/download/FreeFileSync_9.4_Source.zip" --user-agent "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" https://www.freefilesync.org/download/FreeFileSync_9.4_Source.zip

So, once you open up the zip file of the source code, you need to modify a few things. Please examine the patch I wrote: http://albion320.no-ip.biz/smith122/repo/patch/freefilesync/FreeFileSync_9.4.fc25.patch

Here is the text, in case my home server is down:

diff -Naur FreeFileSync/Source/Makefile FreeFileSync.fc25/Source/Makefile
--- FreeFileSync/Source/Makefile	2017-10-05 09:54:58.000000000 -0400
+++ FreeFileSync.fc25/Source/Makefile	2017-10-22 21:33:01.445470939 -0400
@@ -10,8 +10,8 @@
 LINKFLAGS = -s `wx-config --libs std, aui --debug=no` -lboost_thread -lboost_chrono -lboost_system -lz -pthread
 
 #Gtk - support recycler/icon loading/no button border/grid scrolling
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 #support for SELinux (optional)
 SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)
diff -Naur FreeFileSync/Source/RealTimeSync/Makefile FreeFileSync.fc25/Source/RealTimeSync/Makefile
--- FreeFileSync/Source/RealTimeSync/Makefile	2017-10-05 09:54:58.000000000 -0400
+++ FreeFileSync.fc25/Source/RealTimeSync/Makefile	2017-10-22 21:33:19.853796285 -0400
@@ -7,8 +7,8 @@
 LINKFLAGS = -s `wx-config --libs std, aui --debug=no` -lboost_thread -lboost_chrono -lboost_system -lz -pthread
 
 #Gtk - support "no button border"
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 CPP_LIST=
 CPP_LIST+=application.cpp
diff -Naur FreeFileSync/Source/ui/main_dlg.cpp source.fc25/FreeFileSync/Source/ui/main_dlg.cpp
--- FreeFileSync/Source/ui/main_dlg.cpp	2017-10-05 09:54:58.000000000 -0400
+++ FreeFileSync.fc25/Source/ui/main_dlg.cpp	2017-10-22 21:33:01.446470957 -0400
@@ -1024,7 +1024,7 @@
         history.resize(globalSettings.gui.cfgFileHistMax);
 
     globalSettings.gui.cfgFileHistory = history;
-    globalSettings.gui.cfgFileHistFirstItemPos = m_listBoxHistory->GetTopItem();
+    //globalSettings.gui.cfgFileHistFirstItemPos = m_listBoxHistory-gt;GetTopItem();
     //--------------------------------------------------------------------------------
     globalSettings.gui.lastUsedConfigFiles.clear();
     for (const Zstring& cfgFilePath : activeConfigFiles_)
@@ -4862,6 +4862,7 @@
 
     m_menuItemCheckVersionAuto->Check(updateCheckActive(globalCfg_.gui.lastUpdateCheck));
 
+    /*
     if (shouldRunPeriodicUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4869,6 +4870,7 @@
         periodicUpdateCheckEval(this, globalCfg_.gui.lastUpdateCheck, globalCfg_.gui.lastOnlineVersion,
                                 periodicUpdateCheckRunAsync(periodicUpdateCheckPrepare().get()).get());
     }
+    */
 }
 
 
@@ -4877,6 +4879,7 @@
     //execute just once per startup!
     Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnRegularUpdateCheck), nullptr, this);
 
+    /*
     if (shouldRunPeriodicUpdateCheck(globalCfg_.gui.lastUpdateCheck))
     {
         flashStatusInformation(_("Searching for program updates..."));
@@ -4890,6 +4893,7 @@
                                     resultAsync.get()); //run on main thread:
         });
     }
+    */
 }
 
 

You will need a set of packages installed to compile:

dnf install -y boost-devel compat-wxGTK3-gtk2-devel gcc-c++ gtk+-devel gtk3-devel wxGTK-devel wxGTK3-devel