This guide provides a step-by-step process for downloading, compiling and installing MegaCMD (the cloud storage solution) on DietPi OS for the Orange Pi 5. The same instructions would likely work for a Raspberry Pi, but this has not been tested.
Versions
OrangePi: 5 (aarch64)
DietPi: 9.4.2
MegaCMD: 1.7.0.0: code 1070000
FFmpeg: 5.1.4-0+deb12u1
Installation
- Install package dependencies required for MegaCMD.
sudo apt install -y libcrypto++8 libpcrecpp0v5 libc-ares-dev zlib1g-dev libuv1 libssl-dev libsodium-dev readline-common sqlite3 curl autoconf libtool g++ libcrypto++-dev libz-dev libsqlite3-dev libssl-dev libcurl4-gnutls-dev libreadline-dev libpcre3-dev libsodium-dev libc-ares-dev libfreeimage-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev libzen-dev libicu-dev git
- install the necessary build tools.
sudo apt install -y automake make cmake build-essential libuv1-dev libssl-dev libhwloc-dev
- Clone the MegaCMD repository from GitHub to fetch all submodules.
git clone https://github.com/meganz/MEGAcmd.git
cd MEGAcmd && git submodule update --init --recursive
- Run the MegaCMD configuration script.
sh autogen.sh
./configure
- Build and Install MegaCMD.
make
sudo make install
sudo ldconfig
- Login to MegaCMD.
mega-login test@example.com "password"
- Enable MegaCMD to restart automatically using CRON.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot mega-sync
Updating MegaCMD
If you need to update MegaCMD, delete the $HOME/.megaCmd
folder and re-run the steps above. You will have to login again, but your data will be preserved.
Troubleshooting
๐ Can't build with FFMpeg 6.0
You may encounter the following error related to FFmpeg:
FFMpeg removed AV_CODEC_CAP_TRUNCATED and CODEC_CAP_TRUNCATED definitions and now I can't build MegaSync with this error:
mega/src/gfx/freeimage.cpp: In member function 'bool mega::GfxProviderFreeImage::readbitmapFfmpeg(mega::FileSystemAccess*, const mega::LocalPath&, int)':
mega/src/gfx/freeimage.cpp:215:23: error: 'CODEC_CAP_TRUNCATED' was not declared in this scope; did you mean 'CAP_TRUNCATED'?
215 | #define CAP_TRUNCATED CODEC_CAP_TRUNCATED
| ^~~~~~~~~~~~~~~~~~~
mega/src/gfx/freeimage.cpp:334:33: note: in expansion of macro 'CAP_TRUNCATED'
334 | if (decoder->capabilities & CAP_TRUNCATED)
| ^~~~~~~~~~~~~
mega/src/gfx/freeimage.cpp:406:19: warning: 'void av_init_packet(AVPacket*)' is deprecated [-Wdeprecated-declarations]
406 | av_init_packet(&packet);
| ~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/ffmpeg/libavformat/avformat.h:316:
/usr/include/ffmpeg/libavcodec/packet.h:512:6: note: declared here
512 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
make[1]: *** [Makefile:13285: freeimage.o] Error 1
Solution
Update the code in ./sdk/src/gfx/freeimage.cpp
to make it compatible with FFmpeg >= 5. You can find the necessary changes in the following pull request: Fix build with FFMPEG 5 #2614.
For more information, see this GitHub issue: Can't build with FFMpeg 6.0 #2635.