Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

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

Comments