Getting the source


  root@debian32:~# cd /tmp
  root@debian32:/tmp# git clone https://github.com/meganz/MEGAcmd.git
  Cloning into 'MEGAcmd'...
  remote: Enumerating objects: 6678, done.
  remote: Counting objects: 100% (1504/1504), done.
  remote: Compressing objects: 100% (474/474), done.
  remote: Total 6678 (delta 985), reused 1490 (delta 974), pack-reused 5174
  Receiving objects: 100% (6678/6678), 4.43 MiB | 15.76 MiB/s, done.
  Resolving deltas: 100% (4527/4527), done.
  root@debian32:/tmp#
  root@debian32:/tmp# cd MEGAcmd && git submodule update --init --recursive
  Submodule 'sdk' (https://github.com/meganz/sdk.git) registered for path 'sdk'
  Cloning into '/tmp/MEGAcmd/sdk'...
  Submodule path 'sdk': checked out '849aea4d49e2bf24e06d1a3451823e02abd76f39'
  root@debian32:/tmp/MEGAcmd#
  

Building and installing


  root@debian32:/tmp/MEGAcmd# sh autogen.sh
  autoreconf: Entering directory `.'
  autoreconf: configure.ac: not using Gettext
  autoreconf: running: aclocal --force -I m4
  aclocal: warning: couldn't open directory 'm4': No such file or directory
  autoreconf: configure.ac: tracing
  autoreconf: configure.ac: adding subdirectory sdk to autoreconf
  autoreconf: Entering directory `sdk'
  autoreconf: running: libtoolize --copy --force
  libtoolize: putting auxiliary files in '.'.
  libtoolize: copying file './ltmain.sh'
  libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
  libtoolize: copying file 'm4/libtool.m4'
  libtoolize: copying file 'm4/ltoptions.m4'
  libtoolize: copying file 'm4/ltsugar.m4'
  libtoolize: copying file 'm4/ltversion.m4'
  libtoolize: copying file 'm4/lt~obsolete.m4'
  autoreconf: running: /usr/bin/autoconf --force
  autoreconf: running: /usr/bin/autoheader --force
  autoreconf: running: automake --add-missing --copy --force-missing
  configure.ac:54: installing './compile'
  configure.ac:58: installing './config.guess'
  configure.ac:58: installing './config.sub'
  configure.ac:56: installing './install-sh'
  configure.ac:56: installing './missing'
  Makefile.am: installing './depcomp'
  bindings/python/include.am:2: installing './py-compile'
  Makefile.am:63:   'bindings/python/include.am' included from here
  parallel-tests: installing './test-driver'
  autoreconf: Leaving directory `sdk'
  libtoolize: putting auxiliary files in '.'.
  libtoolize: copying file './ltmain.sh'
  libtoolize: putting macros in 'm4'.
  libtoolize: copying file 'm4/libtool.m4'
  libtoolize: copying file 'm4/ltoptions.m4'
  libtoolize: copying file 'm4/ltsugar.m4'
  libtoolize: copying file 'm4/ltversion.m4'
  libtoolize: copying file 'm4/lt~obsolete.m4'
  libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
  libtoolize: and rerunning libtoolize and aclocal.
  configure.ac:41: installing './compile'
  configure.ac:55: installing './config.guess'
  configure.ac:55: installing './config.sub'
  configure.ac:52: installing './install-sh'
  configure.ac:52: installing './missing'
  Makefile.am: installing './depcomp'
  autoreconf: Leaving directory `.'
  root@debian32:/tmp/MEGAcmd#
  

Past few attempts on sh autogen.sh, encountered the following errors:

Error #1
  root@debian32:/tmp/MEGAcmd# sh autogen.sh
  autogen.sh: 2: autoreconf: not found
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install autoconf

Error #2
  root@debian32:/tmp/MEGAcmd# sh autogen.sh
  autoreconf: Entering directory `.'
  autoreconf: configure.ac: not using Gettext
  autoreconf: running: aclocal --force -I m4
  aclocal: warning: couldn't open directory 'm4': No such file or directory
  autoreconf: configure.ac: tracing
  autoreconf: configure.ac: adding subdirectory sdk to autoreconf
  autoreconf: Entering directory `sdk'
  autoreconf: configure.ac: not using Libtool
  autoreconf: running: /usr/bin/autoconf --force
  configure.ac:99: error: possibly undefined macro: AC_PROG_LIBTOOL
        If this token and others are legitimate, please use m4_pattern_allow.
        See the Autoconf documentation.
  autoreconf: /usr/bin/autoconf failed with exit status: 1
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libtool


  root@debian32:/tmp/MEGAcmd# ./configure
  checking for gcc... gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking whether gcc understands -c and -o together... yes
  configure: creating ./config.status
  config.status: creating Makefile
  checking how to run the C preprocessor... gcc -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking minix/config.h usability... no
  checking minix/config.h presence... no
  checking for minix/config.h... no
  checking whether it is safe to define __EXTENSIONS__... yes
  checking for a BSD-compatible install... /usr/bin/install -c
  ...snip..
  configure: Configured to build Mega SDK:
  
    SDK version:      3.9.11
    Host setup:       i686-pc-linux-gnu
    Install prefix:   /usr/local
    Compiler:         g++
    CXXFLAGS:         -g -O2 -DNDEBUG=1 -fPIC -DMEGA_USE_C_ARES
    LDFLAGS:          -lstdc++fs -lrt -pthread
    gcc hardening:    no
    debug:            no
    static:           no
    sync subsystem:   yes
    chat:             no
    MEGA API          yes
    MEGA API RPC      no
    example apps:     yes
    Rot Perf Logger:  no
    Drive Notif:      no
    MEGA_USE_C_ARES:  yes
  
    inotify:          yes
    posix threads:    yes
  
    Python bindings:  no
    Python3 bindings: no
    PHP bindings:     no
    SWIG_FLAGS_PHP:
  
    Java bindings:    no
  
    OpenSSL:            -lssl -lcrypto
    Crypto++:           -lcryptopp
    Sodium:             -lsodium
    Zlib:               -lz
    SQLite3:            -lsqlite3
    c-ares:             -lcares
    cURL:              -lcurl
    FreeImage:          -lfreeimage
    PDFium:
    Readline:           -lreadline
    Termcap:            -ltermcap
    PCRE:
    LIBUV:
    LIBRAW:
    LIBMEDIAINFO:       -DUNICODE -lmediainfo -lzen
    FFMPEG:             -lavcodec -lavformat -lavutil -lswscale
  
  
  configure: MEGAcmd configuration:
  
    MEGACMD version:      1.5.0
    Install prefix:   /usr/local
    Compiler:         g++
    CXXFLAGS:         -g -O2 -DNDEBUG=1 -fPIC -DENABLE_BACKUPS=1
    CPPFLAGS:
    LDFLAGS:          -pthread
    debug:            no
    static:           no
    posix threads:    yes
  
    Readline:           -lreadline
    Termcap:            -ltermcap
    PCRE:               -lpcrecpp -lpcre
    SDK includes:     -I. -I./include -I./include/mega -I./include/mega/posix -I./third_party/utf8proc
  
  root@debian32:/tmp/MEGAcmd#
  

Past few attempts on ./configure, encountered the following errors:

Error #1
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking whether we are using the GNU C++ compiler... no
  checking whether g++ accepts -g... no
  checking dependency style of g++... none
  configure: error: C++ compiler not found !
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install g++

Error #2
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking readline/readline.h usability... no
  checking readline/readline.h presence... no
  checking for readline/readline.h... no
  configure: error: readline/readline.h header not found or not usable
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libreadline-dev

Error #3
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking sqlite3.h usability... no
  checking sqlite3.h presence... no
  checking for sqlite3.h... no
  configure: error: sqlite3.h header not found or not usable
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libsqlite3-dev

Error #4
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  config.status: error: Something went wrong bootstrapping makefile fragments
      for automatic dependency tracking.  If GNU make was not used, consider
      re-running the configure script with MAKE="gmake" (or whatever is
      necessary).  You can also try re-running configure with the
      '--disable-dependency-tracking' option to at least be able to build
      the package (albeit without support for automatic dependency tracking).
  See `config.log' for more details
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# ./configure --disable-dependency-tracking

Error #5
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking cryptopp/cryptlib.h usability... no
  checking cryptopp/cryptlib.h presence... no
  checking for cryptopp/cryptlib.h... no
  configure: error: cryptopp/cryptlib.h header not found or not usable
  configure: error: ./configure failed for sdk
  root@debian32:/tmp/MEGAcmd# 
  This error related to libcrypto++ shown in ealier section 
Solution: googled & found the need to download cryptopp565.zip; after downloading continue with the following:
root@debian32:/root/Downloads# unzip cryptopp565.zip Archive: cryptopp565.zip inflating: 3way.cpp inflating: 3way.h inflating: adhoc.cpp.proto inflating: adler32.cpp inflating: adler32.h ...snip.. inflating: TestVectors/ttmac.txt inflating: TestVectors/vmac.txt inflating: TestVectors/wake.txt inflating: TestVectors/whrlpool.txt root@debian32:/root/Downloads# make libcryptopp.a libcryptopp.so cryptest.exe g++ -DNDEBUG -g2 -O2 -m32 -pipe -c cryptlib.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c cpu.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c integer.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c 3way.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c adler32.cpp ...snip.. g++ -DNDEBUG -g2 -O2 -m32 -pipe -c adhoc.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c datatest.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c regtest.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c fipsalgt.cpp g++ -DNDEBUG -g2 -O2 -m32 -pipe -c dlltest.cpp g++ -o cryptest.exe -DNDEBUG -g2 -O2 -m32 -pipe test.o bench1.o bench2.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a -pthread root@debian32:/home/guru/Downloads# ./cryptest.exe v Using seed: 1655006910 Testing Settings... passed: Your machine is little endian. ...snip.. All tests passed! Test ended at Sat Jun 11 21:08:33 2022 Seed used was: 1655006910 root@debian32:/home/guru/Downloads# ./cryptest.exe tv all Using seed: 1655006933 Testing FileList algorithm all.txt collection. Testing SymmetricCipher algorithm TEA/ECB. ...snip.. Tests complete. Total tests = 5248. Failed tests = 0. root@debian32:/home/guru/Downloads#
Error #6
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking openssl/ssl.h usability... no
  checking openssl/ssl.h presence... no
  checking for openssl/ssl.h... no
  configure: error: ssl.h header not found or not usable
  configure: error: ./configure failed for sdk
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libssl-dev

Error #7
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking ares.h usability... no
  checking ares.h presence... no
  checking for ares.h... no
  configure: error: ares.h header not found or not usable
  configure: error: ./configure failed for sdk
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libc-ares-dev

Error #8
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking curl/curl.h usability... no
  checking curl/curl.h presence... no
  checking for curl/curl.h... no
  configure: error: curl.h header not found or not usable
  configure: error: ./configure failed for sdk
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libcurl4-gnutls-dev

Error #9
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  checking FreeImage.h usability... no
  checking FreeImage.h presence... no
  checking for FreeImage.h... no
  configure: error: FreeImage.h header not found or not usable
  configure: error: ./configure failed for sdk
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libfreeimage-dev


  root@debian32:/tmp/MEGAcmd# make
  make  all-recursive
  make[1]: Entering directory '/tmp/MEGAcmd'
  Making all in sdk
  make[2]: Entering directory '/tmp/MEGAcmd/sdk'
  make  all-recursive
  make[3]: Entering directory '/tmp/MEGAcmd/sdk'
  Making all in include
  ...snip..
  libtool: install: /usr/bin/install -c mega-cmd /usr/local/bin/mega-cmd
  libtool: install: /usr/bin/install -c mega-exec /usr/local/bin/mega-exec
  libtool: install: /usr/bin/install -c .libs/mega-cmd-server /usr/local/bin/mega-cmd-server
   /usr/bin/mkdir -p '/usr/local/etc/bash_completion.d/'
   /usr/bin/install -c -m 644 src/client/megacmd_completion.sh '/usr/local/etc/bash_completion.d/'
   /usr/bin/mkdir -p '/usr/local/bin'
   /usr/bin/install -c src/client/mega-attr src/client/mega-cd src/client/mega-confirm src/client/mega-cp src/client/mega-debug src/client/mega-du src/client/mega-df src/client/mega-proxy 
                       src/client/mega-export src/client/mega-find src/client/mega-get src/client/mega-help src/client/mega-https src/client/mega-webdav src/client/mega-permissions 
                       src/client/mega-deleteversions src/client/mega-transfers src/client/mega-import src/client/mega-invite src/client/mega-ipc src/client/mega-killsession src/client/mega-lcd 
                       src/client/mega-log src/client/mega-login src/client/mega-logout src/client/mega-lpwd src/client/mega-ls src/client/mega-backup src/client/mega-mkdir src/client/mega-mount 
                       src/client/mega-mv src/client/mega-passwd src/client/mega-preview src/client/mega-put src/client/mega-speedlimit src/client/mega-pwd src/client/mega-quit src/client/mega-reload 
                       src/client/mega-rm src/client/mega-session '/usr/local/bin'
   /usr/bin/install -c src/client/mega-share src/client/mega-showpcr src/client/mega-signup src/client/mega-sync src/client/mega-exclude src/client/mega-thumbnail src/client/mega-userattr 
                       src/client/mega-users src/client/mega-version src/client/mega-whoami src/client/mega-cat src/client/mega-tree src/client/mega-mediainfo src/client/mega-graphics 
                       src/client/mega-ftp src/client/mega-cancel src/client/mega-confirmcancel src/client/mega-errorcode '/usr/local/bin'
  make[3]: Leaving directory '/tmp/MEGAcmd'
  make[2]: Leaving directory '/tmp/MEGAcmd'
  make[1]: Leaving directory '/tmp/MEGAcmd'
  root@debian32:/tmp/MEGAcmd# 
  

Past few attempts on make, encountered the following errors:

Error #1
  root@debian32:/tmp/MEGAcmd# make
  bash: make: command not found
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install --reinstall build-essential
  ...snip..

Error #2
  root@debian32:/tmp/MEGAcmd# make
  ...snip..
  ./include/mega/crypto/sodium.h:25:10:fatal error: sodium.h: No such file or directory
     25 | #include 
        |          ^~~~~~~~~~
  compilation terminated.
  make[4]: *** [Makefile:2831: examples/megacli-megacli.o] Error 1
  make[4]: Leaving directory '/tmp/MEGAcmd/sdk'
  make[3]: *** [Makefile:3383: all-recursive] Error 1
  make[3]: Leaving directory '/tmp/MEGAcmd/sdk'
  make[2]: *** [Makefile:1534: all] Error 2
  make[2]: Leaving directory '/tmp/MEGAcmd/sdk'
  make[1]: *** [Makefile:1471: all-recursive] Error 1
  make[1]: Leaving directory '/tmp/MEGAcmd'
  make: *** [Makefile:707: all] Error 2
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# apt install libboost-all-dev
  ...snip..
  root@debian32:/tmp/MEGAcmd# apt install libsodium-dev
  ...snip..
  root@debian32:/tmp/MEGAcmd# ./configure
  ...snip..
  root@debian32:/tmp/MEGAcmd# make
  ...snip..


  root@debian32:/tmp/MEGAcmd# make install
  make  install-recursive
  make[1]: Entering directory '/tmp/MEGAcmd'
  Making install in sdk
  make[2]: Entering directory '/tmp/MEGAcmd/sdk'
  make  install-recursive
  make[3]: Entering directory '/tmp/MEGAcmd/sdk'
  Making install in include
    ...snip..
  libtool: install: /usr/bin/install -c .libs/mega-cmd-server /usr/local/bin/mega-cmd-server
   /usr/bin/mkdir -p '/usr/local/etc/bash_completion.d/'
   /usr/bin/install -c -m 644 src/client/megacmd_completion.sh '/usr/local/etc/bash_completion.d/'
   /usr/bin/mkdir -p '/usr/local/bin'
   /usr/bin/install -c src/client/mega-attr src/client/mega-cd src/client/mega-confirm src/client/mega-cp src/client/mega-debug src/client/mega-du src/client/mega-df src/client/mega-proxy 
                       src/client/mega-export src/client/mega-find src/client/mega-get src/client/mega-help src/client/mega-https src/client/mega-webdav src/client/mega-permissions 
                       src/client/mega-deleteversions src/client/mega-transfers src/client/mega-import src/client/mega-invite src/client/mega-ipc src/client/mega-killsession src/client/mega-lcd 
                       src/client/mega-log src/client/mega-login src/client/mega-logout src/client/mega-lpwd src/client/mega-ls src/client/mega-backup src/client/mega-mkdir src/client/mega-mount 
                       src/client/mega-mv src/client/mega-passwd src/client/mega-preview src/client/mega-put src/client/mega-speedlimit src/client/mega-pwd src/client/mega-quit 
                       src/client/mega-reload src/client/mega-rm src/client/mega-session '/usr/local/bin'
   /usr/bin/install -c src/client/mega-share src/client/mega-showpcr src/client/mega-signup src/client/mega-sync src/client/mega-exclude src/client/mega-thumbnail src/client/mega-userattr 
                       src/client/mega-users src/client/mega-version src/client/mega-whoami src/client/mega-cat src/client/mega-tree src/client/mega-mediainfo src/client/mega-graphics 
                       src/client/mega-ftp src/client/mega-cancel src/client/mega-confirmcancel src/client/mega-errorcode '/usr/local/bin'
  make[3]: Leaving directory '/tmp/MEGAcmd'
  make[2]: Leaving directory '/tmp/MEGAcmd'
  make[1]: Leaving directory '/tmp/MEGAcmd'
  root@debian32:/tmp/MEGAcmd# 
  

At this point, I had successfully compiled MEGAcmd on Debian 11. However, when executing mega-cmd-server, there was still error.

Test results:
  root@debian32:/tmp/MEGAcmd# mega-cmd-server 
  
  mega-cmd-server: error while loading shared libraries: libmega.so.30911: cannot open shared object file: No such file or directory
  root@debian32:/tmp/MEGAcmd# 
  Solution:
  root@debian32:/tmp/MEGAcmd# /usr/sbin/ldconfig
  root@debian32:/tmp/MEGAcmd# 
  root@debian32:/tmp/MEGAcmd# mega-cmd-server 
  .==============================================================================================================================================================.
  |                                                   __  __ _____ ____    _                      _                                                              |
  |                                                  |  \/  | ___|/ ___|  / \   ___ _ __ ___   __| |                                                             |
  |                                                  | |\/| | \  / |  _  / _ \ / __| '_ ` _ \ / _` |                                                             |
  |                                                  | |  | | /__\ |_| |/ ___ \ (__| | | | | | (_| |                                                             |
  |                                                  |_|  |_|____|\____/_/   \_\___|_| |_| |_|\__,_|                                                             |
  |                                                                                                                                                              |
  |                                                                      SERVER                                                                                  |
  `==============================================================================================================================================================´
  
  [Initiating MEGAcmd server in background. Log: /root/.megaCmd/megacmdserver.log]
  MEGA CMD> 

<< Previous :: Index