How to build 11.1 from source on Ubuntu?

Discuss new features and functions
Posts: 5
Joined: 1 Oct 2020

genom

Hi,
I am trying to build FFS 11.1 from source on Ubuntu but make fails with
mkdir -p /FreeFileSync_x86_64_Make/ffs/src/
mkdir: cannot create directory ‘/FreeFileSync_x86_64_Make’: Permission denied
Makefile:120: recipe for target '/FreeFileSync_x86_64_Make/ffs/src/application.cpp.o' failed
make: *** [/FreeFileSync_x86_64_Make/ffs/src/application.cpp.o] Error 1

Somehow, it tries to generate folder in the root folder. I wonder, what I am doing wrong.
PS: I was able to build 10.2.
User avatar
Site Admin
Posts: 7040
Joined: 9 Dec 2007

Zenju

That's a problem due to missing TMPDIR environment variable. Fixed for the next release.
Posts: 5
Joined: 1 Oct 2020

genom

Thanks! I will set it and try :)
Posts: 5
Joined: 1 Oct 2020

genom

Hi, there seems to be another issue with span library not found.
base/algorithm.h:11:10: fatal error: span: No such file or directory
11 | #include <span>
| ^~~~~~
compilation terminated.
Any idea why?
Posts: 305
Joined: 7 Jan 2018

bgstack15

The span library was only added in C++20 standard, which is a spec only available to g++-10 (part of gcc 10). You don't indicate which version of Ubuntu you are working in, but I'm guessing you aren't using g++10. You can investigate getting package "g++-10" (that's the Debian package name, so probably same for Ubuntu) or you might need to switch to a release of Ubuntu that has that package available.
Also, you will want to make sure that your Makefile calls g++-10. I accomplish this with a patch.
diff -aur 11.2-1/FreeFileSync/Source/Makefile 11.2-2/FreeFileSync/Source/Makefile
--- 11.2-1/FreeFileSync/Source/Makefile   2020-10-02 14:59:35.816639878 -0400
+++ 11.2-2/FreeFileSync/Source/Makefile   2020-10-02 14:59:54.220866929 -0400
@@ -1,4 +1,5 @@
 exeName = FreeFileSync
+CXX=g++-10

 cxxFlags += -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" \
            -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wnon-virtual-dtor -Wno-unused-function -Wshadow -Wno-maybe-uninitialized \
@@ -115,11 +116,11 @@

 ../Build/Bin/$(exeName): $(objFiles)
   mkdir -p $(dir $@)
-  g++ -o $@ $^ $(linkFlags)
+  $(CXX) -o $@ $^ $(linkFlags)

 $(tmpPath)/ffs/src/%.o : %
   mkdir -p $(dir $@)
-  g++ $(cxxFlags) -c $< -o $@
+  $(CXX) $(cxxFlags) -c $< -o $@

 clean:
   rm -rf $(tmpPath)
diff -aur 11.2-1/FreeFileSync/Source/RealTimeSync/Makefile 11.2-2/FreeFileSync/Source/RealTimeSync/Makefile
--- 11.2-1/FreeFileSync/Source/RealTimeSync/Makefile  2020-10-02 14:59:35.820639928 -0400
+++ 11.2-2/FreeFileSync/Source/RealTimeSync/Makefile  2020-10-02 14:59:54.220866929 -0400
@@ -1,4 +1,5 @@
 exeName = RealTimeSync
+CXX=g++-10

 cxxFlags += -std=c++2a -pipe -DWXINTL_NO_GETTEXT_MACRO -I../../.. -I../../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" \
            -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wnon-virtual-dtor -Wno-unused-function -Wshadow -Wno-maybe-uninitialized \
@@ -54,11 +55,11 @@

 ../../Build/Bin/$(exeName): $(objFiles)
   mkdir -p $(dir $@)
-  g++ -o $@ $^ $(linkFlags)
+  $(CXX) -o $@ $^ $(linkFlags)

 $(tmpPath)/ffs/src/rts/%.o : %
   mkdir -p $(dir $@)
-  g++ $(cxxFlags) -c $< -o $@
+  $(CXX) $(cxxFlags) -c $< -o $@

 clean:
   rm -rf $(tmpPath)
The Debian family, which includes Ubuntu, has way better multi-version compiler support than Fedora. In Fedora 31, you get gcc 9. That's it. In Devuan Ceres (Debian Sid), I see gcc-6-base up through gcc-10.
Posts: 5
Joined: 1 Oct 2020

genom

You are right! I was using g++-9.1
With g++-10 I passed that error.

However now I get this error:
../../wx+/dc.h:72:2: error: #error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
72 | #error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
| ^~~~~
compilation terminated due to -Wfatal-errors.
I have installed most recent wxWidgets release. I guess it is due to gtk-2?
cxxFlags += `pkg-config --cflags gtk+-2.0`
#treat as system headers so that warnings are hidden:
cxxFlags += -isystem/usr/include/gtk-2.0
Posts: 305
Joined: 7 Jan 2018

bgstack15

Zenju uses one of the newer versions of wxWidgets, but Devuan Ceres doesn't package anything quite so new:
$ apt-cache policy libwxgtk3.0-0v5 | head
libwxgtk3.0-0v5:
  Installed: (none)
  Candidate: 3.0.4+dfsg-14
  Version table:
     3.0.4+dfsg-14 700
        700 http://storage1.ipa.example.com:180/example/repo/devuan-archive  Packages
Keep looking at the patches from that gitlab link earlier. There's one in there reverting to use older wxwidgets objects, but you might also need the "revert upstreamisms" patch.
Posts: 5
Joined: 1 Oct 2020

genom

I see. I have the 3.1.4 version. But the same command tells me this:
$ apt-cache policy libwxgtk3.0-0v5
libwxgtk3.0-0v5:
  Installed: 3.0.4+dfsg-3
  Candidate: 3.0.4+dfsg-3
  Version table:
 *** 3.0.4+dfsg-3 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status
Now checking the other patches.