trying to compile for raspberrypi

Get help for specific problems
Posts: 5
Joined: 15 Mar 2019

Gustutu

Hello,

I'm trying to compile freefilesync for raspberrypi but get following error

~/Downloads/ffsync/FreeFileSync/Source $ make

mkdir -p /tmp/FreeFileSync_armv7l_Make/ffs/src/base/
g++ -std=c++17 -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+-2.0` -isystem/usr/include/gtk-2.0 -c base/algorithm.cpp -o /tmp/FreeFileSync_armv7l_Make/ffs/src/base/algorithm.cpp.o
/bin/sh: 1: wx-config: not found
In file included from ../../zen/string_tools.h:18:0,
from ../../zen/i18n.h:13,
from <command-line>:0:
../../zen/stl_tools.h:16:20: fatal error: optional: Aucun fichier ou dossier de ce type

^
compilation terminated.
Makefile:127 : la recette pour la cible « /tmp/FreeFileSync_armv7l_Make/ffs/src/base/algorithm.cpp.o » a échouée
make: *** [/tmp/FreeFileSync_armv7l_Make/ffs/src/base/algorithm.cpp.o] Erreur 1
Posts: 5
Joined: 15 Mar 2019

Gustutu

could you help please :)
Posts: 21
Joined: 5 Oct 2018

jmsxl

It appears that you don't have dependency wxWidgets installed ("wx-config: not found")
Posts: 1
Joined: 9 Jul 2019

cjmssmd

I'm curious, did you ever get this to work?
Posts: 21
Joined: 5 Oct 2018

jmsxl

Here's a web page that shows the steps to build on Linux: https://github.com/jeffli678/build-FreeFileSync

That page references another page https://solarianprogrammer.com/2016/10/07/building-gcc-ubuntu-linux/ that shows how to build a newer version of gcc, which you'll likely need to do as well. When building gcc on the Pi, here are the configure options I used:
../gcc-9.1.0/configure -v --prefix=/usr/local/gcc-9.1 --program-suffix=-9.1 --enable-languages=c,c++ --disable-multilib --without-included-gettext --enable-threads=posix --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release
Many of those are probably the build defaults for gcc but I included them based on the output of the older gcc already installed with raspbian ("gcc -v") just to be sure. Building gcc on the Pi takes a long time.
Posts: 309
Joined: 7 Jan 2018

bgstack15

So, once you have all the build dependencies in place, FreeFileSync builds and runs correctly on the ARMv7 architecture? This is good news!
Posts: 21
Joined: 5 Oct 2018

jmsxl

So, once you have all the build dependencies in place, FreeFileSync builds and runs correctly on the ARMv7 architecture? bgstack15
Yes. I recently built FFS v10.14 on a Raspberry Pi 3B+ running Raspbian released July, 2019 based on Debian Buster.

No exhaustive testing, but an interactive mirror sync from the Pi to a Samba share works just fine. RealTimeSync not tested.

Following the recipes given in the links above, packages I installed:

# apt install build-essential libgtk-3-dev libboost-dev libssl-dev libcurl4-openssl-dev libssh2-1-dev

Then:
Build and install gcc v9.1.0
Build and install wxWidgets v3.1.2
In the FFS Makefile, change gtk+-2.0 to gtk+-3.0 and add "-latomic" to the end of LINKFLAGS

Required ~ 4GB of space to build everything (gcc is huge) But not so much when installed.

Really hammered the uSD card. Next time I would build everything on an attached USB external (magnetic) drive.
Posts: 7
Joined: 28 Jul 2018

jper

I tried to build gcc v9.1.0 per your instructions. However after executing "make -j 2", the compiling terminated with error after less than an hour. Sad. I would have loved to use freefilesync on raspberry pi 3 as my workhorse to upload my gigabytes of home video production to my google cloud and leave my i7 computer to authoring the video. Is it possible to get your binary executable?
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Have you tried simply running the precompiled FreeFileSync version on Raspbian? It's Debian-based so I'd say chances are good it might just work.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Have you tried simply running the precompiled FreeFileSync version on Raspbian? It's Debian-based so I'd say chances are good it might just work. Zenju, 09 Nov 2019, 08:31
Ah forget my remark, it's ARM architecture not x86.
Posts: 21
Joined: 5 Oct 2018

jmsxl

Is it possible to get your binary executable? jper, 09 Nov 2019, 00:50
Sure. Message me jmsxl19307 at gmail dot com . Assuming I can find a drop zone that can handle ~90MB because you'll need the gcc shared libs too.
Posts: 7
Joined: 28 Jul 2018

jper

https://solarianprogrammer.com had a new update to install gcc 9.1 which did not require a build. I did that and everything else worked except FreeFileSync. I tried 10.17 source, but it would not work with gtk 3; so I installed gtk 2 but that crashed with /usr/include/gtk-2.0/gdk/gdktypes.h:114:39: error: conflicting declaration ‘typedef struct _GdkDrawable GdkWindow’ 114 | typedef struct _GdkDrawable GdkWindow;. Is there a way to get the older source? In any case, I will email you.
Posts: 7
Joined: 28 Jul 2018

jper

Thanks to jmsxl I was able to create an executable FreeFileSync using 10.14 source.

The 10.17 has hooks in it that prevent you from using gtk 3.0, since it is still at gtk 2.0. I have not fully tried FFS, but it did execute with lots of gtk and glib warnings and errors.

I followed the steps in the below link (he updated it in June) to get gcc-9.1 working within an hour or so.
https://solarianprogrammer.com/2017/12/08/raspberry-pi-raspbian-install-gcc-compile-cpp-17-programs/

then installed software:
sudo apt install build-essential libgtk-3-dev libboost-dev libssl-dev libcurl4-openssl-dev libssh2-1-dev

next installed wxWidgets per https://github.com/jeffli678/build-FreeFileSync
wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.2/wxWidgets-3.1.2.tar.bz2
tar xf wxWidgets-3.1.2.tar.bz2
cd wxWidgets-3.1.2/
mkdir gtk-build # or any other name you like
cd gtk-build
../configure --disable-shared --enable-unicode
make
sudo make install # use sudo if necessary

taking the FFS source 10.14 which jmsxl provide for me. I make the following changes:

The Makefile is at FreeFileSync_10.14_Source/FreeFileSync/Source/Makefile. We need to change all occurrances (there should be two) of "g++" to "g++-9.1" .
also per jmsxl you need to: change gtk+-2.0 to gtk+-3.0 and add "-latomic" to the end of LINKFLAGS

In "afs/sftp.cpp", add at line 58:
#define MAX_SFTP_OUTGOING_SIZE 30000
#define MAX_SFTP_READ_SIZE 30000
also In "afs/sftp.cpp", add at line 1662 (just before the #if)
#define LIBSSH2_SFTP_DEFAULT_MODE -1

Run "make" in folder FreeFileSync_10.14_Source/FreeFileSync/Source. It will take roughly hour plus.

The binary should be waiting for you in FreeFileSync_10.14_Source/FreeFileSync/Build/Bin.
I opened it in a terminal and executed: ./FreeFileSync_armv7l
Posts: 7
Joined: 28 Jul 2018

jper

I tried 10.15 and 10.16 (and 10.17 before) and both failed for different reasons. So 10.14 is the latest one that works with the current hooks. But the ability to access Google Drive fails, because client-id is not specified.
As I stated before, it would great to a have raspbian version of FFS to able to use a very cheap computer to be the workhorse in uploading files to cloud and and updating other harddrives; while using the expensive computers to do productive work.
Posts: 21
Joined: 5 Oct 2018

jmsxl

Thanks much for the update. Hopefully we can get the current sources running on the Pi soon, and keep things working. The Pi 4 is a mighty little beast and would be a great platform for FFS.
Posts: 7
Joined: 28 Jul 2018

jper

It has been 6 months and would like to know if there is any consideration to create a version of FFS for the ARM structure (i.e. Raspberry Pi).
Posts: 309
Joined: 7 Jan 2018

bgstack15

Somebody has a CI tool building FreeFileSync for the armv7l architecture: https://build.opensuse.org/package/show/network/FreeFileSync. Perhaps you just need to examine the build instructions there to learn how they are doing it.
Posts: 1
Joined: 5 Jul 2020

Subere

I found a tutorial for FreeFileSync 10.22 on Github and updated it to FreeFileSync 10.25. It takes a really long time to build the dependencies from source (about 5-6 hours on the RPi 4, especially gcc takes about 4 hours)!

After the first test FreeFileSync seems to work with some errors:

1) After the start I get an error in the console and the icons are way to big (my resolution is 1920 x 1080)
(FreeFileSync_armv7l:8129): Gtk-CRITICAL **: 10:48:02.030: IA__gtk_widget_set_size_request: assertion 'width >= -1' failed
Image


2) After the start I also get a dialog with this error message
Cannot find current FreeFileSync version number online. A newer version is lekely available. Check manually now?
Error code 335544614: error:14000126:SSL routines::unexpected eof while reading [SSL_read_ex] SSL_ERROR_SSL
This error was already adressed in this forum: viewtopic.php?t=7094
Posts: 21
Joined: 5 Oct 2018

jmsxl

Excellent resource -- thank you!
Posts: 8
Joined: 19 Jul 2020

pmkees2

Many thanks, Subere.
GCC compilation is a beast but FFS 10.25 is up-and-running on my RPi 3B+
Posts: 3
Joined: 29 Sep 2020

travo101

I gave this a good shot but haven't been able to get it to work. Any chance you are able to share the final zip file?
Posts: 5
Joined: 15 Mar 2019

Gustutu

Hi everybody,

For information :
To sync distant server fpt to my local filesystem i finaly used the following script with a cron job.
It work perfectly for me. The lock file part is used to avoid running multiple script if the previous one as not yet ended.

I'm pretty sure wget allow you to do opposite (sync local files to ftp server).



LOCKFILE=/tmp/lock.txt
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
    echo "already running"
    exit
fi


trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}


wget --timeout=1 -a /var/log/user/1000/syncFtp/syncFtp.log --tries=2 --ftp-password='' --ftp-user=user -m ftp://192.168.10.1 -P /home/user/myDirectory

rm -f ${LOCKFILE}
Posts: 2
Joined: 22 Aug 2020

MrNago

Hi all,

I am using the program Grsync which I found on the Pi's app store thing. It works fairly well as an alternative. However it's no match to FreeFileSync.

If anyone could share a compiled zip?
I'd even pay for it, heck.
Posts: 6
Joined: 17 Nov 2020

olvin

Made all in accordance with instruction. Please find ZIP file for Raspberry Pi4.
https://yadi.sk/d/ZkyQzTwjdBBHfA
Not sure if everything is correct but may be it will help. I successfully ran it on another RPI4.
Posts: 3
Joined: 29 Sep 2020

travo101

Thanks olvin. You are a legend.
Posts: 8
Joined: 19 Jul 2020

pmkees2

I was inspired by olvin's effort so I forked Subere's Raspbian build instructions and updated it for v11.3 (current FreeFileSync version as of this writing). It's at:
https://github.com/pmkees/build-FreeFileSync-on-raspberry-pi

Probably worth a full review after the next major upgrade of Raspbian/Raspberry Pi OS whenever that happens.

Thanks to Subere for updating the instructions for v10.25 and posting in here in this forum (jmsxl provided similar details earlier proving it could be done!)
Thanks to YingchunLi2020 for making the instructions Raspbian-specific
...and thanks to jeffli678 who started it all when writing up the instructions for an Ubuntu release.

-pmkees2
Posts: 6
Joined: 17 Nov 2020

olvin

I was inspired by olvin's effort so I forked Subere's Raspbian build instructions and updated it for v11.3 (current FreeFileSync version as of this writing). It's at:
https://github.com/pmkees/build-FreeFileSync-on-raspberry-pi pmkees2, 20 Nov 2020, 18:38
Thanx pmkees2,
I am so glad i inspired you. I will follow your instructions fo make another zip file, will compiled v11.3.!
I actually tried to make it from the first try, but i end out with error.

How can we make it so that it will be in Raspbian repository?
Posts: 6
Joined: 17 Nov 2020

olvin

I think i made all as you described. But on final stage of making file i got following error.
I used clean updated Raspberry PI OS. Acrualy i got same error last time. I actidently tried to compile last version of FFS, instead of 10.25.

pi@raspberrypi:~/FFS/FreeFileSync/Source $ make
mkdir -p /tmp/FreeFileSync_armv7l_Make/ffs/src/
g++ -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 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags openssl` `pkg-config --cflags libcurl` `pkg-config --cflags libssh2` `pkg-config --cflags gtk+-2.0` -isystem/usr/include/gtk-2.0 `pkg-config --cflags libselinux` -DHAVE_SELINUX -c application.cpp -o /tmp/FreeFileSync_armv7l_Make/ffs/src/application.cpp.o
In file included from ui/../ui/file_grid_attr.h:12,
                 from ui/../config.h:13,
                 from ui/progress_indicator.h:14,
                 from ui/batch_status_handler.h:12,
                 from application.cpp:24:
../../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.
make: *** [Makefile:124: /tmp/FreeFileSync_armv7l_Make/ffs/src/application.cpp.o] Error 1
Posts: 6
Joined: 17 Nov 2020

olvin

Inside WX WIDGET file i seem to find solution...
But i can not implement it. I am not as experienced and know nothing about C++.
inline
int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered)
{
#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS
#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
#endif
    //GTK2 doesn't properly support high DPI: https://freefilesync.org/forum/viewtopic.php?t=6114
    //=> requires general fix at wxWidgets-level

    //https://github.com/wxWidgets/wxWidgets/blob/d9d05c2bb201078f5e762c42458ca2f74af5b322/include/wx/window.h#L2060
    return d; //e.g. macOS, GTK3
}
Posts: 8
Joined: 19 Jul 2020

pmkees2

Hi olvin-

My bad.

There seems to be a known problem with GTK2 supporting high-DPI monitors.
I'm not particularly smart or experienced here so I'm pretty sure what I did is not the the correct way to handle things, but since I don't have a high DPI monitor, I just commented out that check in the dc.h file.

Before:
#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS
#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
#endif
After:
/*
#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS
#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
#endif
*/
Let me know how it goes - if it works for you too, I'll update the instructions.

-pmkees2