meganz / MEGAsync

Easy automated syncing between your computers and your MEGA Cloud Drive
Other
1.62k stars 277 forks source link

Linux Compilation Fails #217

Open davewiard opened 6 years ago

davewiard commented 6 years ago

I have been using a pre-compiled binary version of megasync on Linux for quite some time and recently my distro (Gentoo) deprecated Qt 4 and marked it for removal from their repository as it is no longer maintained. I decided to just go ahead and remove it instead of battling to keep it installed and pinned at the current version. This, obviously, caused megasync to no longer function so I am now trying to compile from a fresh clone of the MEGAsync repo. I followed the compilation steps and almost immediately after issuing "make" the compilation fails with the following. Prior to these `make' results there were no errors or warnings.

[1] ~/Git/MEGAsync/src: make
cd MEGASync/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake -o Makefile /home/kamehameha/Git/MEGAsync/src/MEGASync/MEGASync.pro ) && make -f Makefile 
make[1]: Entering directory '/home/kamehameha/Git/MEGAsync/src/MEGASync'
g++ -c -pipe -g -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DISABLE_DEPRECATED_BEFORE=0x000000 -DHAVE_LIBUV -DUSE_SQLITE -DUSE_CRYPTOPP -DUSE_QT -DMEGA_QT_LOGGING -DENABLE_SYNC -DENABLE_CHAT -DNDEBUG -DUSE_DBUS -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_CORE_LIB -I. -Igui -Igui/linux -I/home/kamehameha/Git/MEGAsync/src/MEGASync/mega/bindings/qt/../..//bindings/qt/3rdparty/include/libuv -Imega/include -Imega/bindings/qt -Imega/bindings/qt/3rdparty/include -Imega/include/mega/posix -Icontrol -Iplatform -Igoogle_breakpad -Iqtlockedfile -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtDBus -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o SettingsDialog.o gui/SettingsDialog.cpp
In file included from ./gui/LocalCleanScheduler.h:5:0,
                 from ./gui/SettingsDialog.h:17,
                 from ./gui/InfoDialog.h:10,
                 from ./MegaApplication.h:18,
                 from gui/SettingsDialog.cpp:13:
./gui/QMegaMessageBox.h: In constructor ‘QMegaMessageBox::QMegaMessageBox(QWidget*)’:
./gui/QMegaMessageBox.h:9:48: warning: unused parameter ‘parent’ [-Wunused-parameter]
     explicit QMegaMessageBox(QWidget *parent = 0) {};
                                                ^
gui/SettingsDialog.cpp: In member function ‘int SettingsDialog::saveSettings()’:
gui/SettingsDialog.cpp:1500:22: error: ‘class mega::MegaApi’ has no member named ‘setFileVersionsOption’
             megaApi->setFileVersionsOption(ui->cDisableFileVersioning->isChecked());
                      ^~~~~~~~~~~~~~~~~~~~~
gui/SettingsDialog.cpp:1643:59: warning: statement has no effect [-Wunused-value]
         QT_TR_NOOP("Do you want to restart MEGAsync now?");
                                                           ^
gui/SettingsDialog.cpp: In member function ‘void SettingsDialog::on_bClearFileVersions_clicked()’:
gui/SettingsDialog.cpp:2286:14: error: ‘class mega::MegaApi’ has no member named ‘removeVersions’; did you mean ‘removeVersion’?
     megaApi->removeVersions();
              ^~~~~~~~~~~~~~
make[1]: *** [Makefile:2377: SettingsDialog.o] Error 1
make[1]: Leaving directory '/home/kamehameha/Git/MEGAsync/src/MEGASync'
make: *** [Makefile:45: sub-MEGASync-make_first] Error 2

I am not at all familiar with the inner workings of this code yet but the fact that it's referencing two non-existent class member methods seems wrong. The removeVersions() looks like a typo on the surface until you note that removeVersion() takes a required "node" parameter. And I have yet to figure out anything at all about what setFileVersionsOption() is supposed to be doing.

These errors can't be directly related to the fact I'm compiling against Qt 5 because these methods are supposed to be defined by "class::mega MegaApi".

Has anyone else seen this or know what's going on here?

polmr commented 6 years ago

Seems that you might not have the sdk submodule updated. Please try to do so:

git submodule update
davewiard commented 6 years ago

@polmr Thanks. This got me further into the compile process but the compile still fails with the following errors:

MEGAsync/src/MEGASync/mega/src/gfx/qt.cpp:367: undefined reference to av_register_all

I manually fixed this by adding the following to the LIBS variable in MEGAsync/src/MEGASync/Makefile:

-lavcodec -lavformat -lavutil -lswscale

I know manually adding this to the Makefile is not a good solution but it did get the job done. I don't know why these libraries were not included in the LIBS variable automatically. The configure step detected and configured HAVE_FFMPEG correctly.

polmr commented 6 years ago

Happy to hear that. In the end there are 2 building mechanisms involved here: one via autotools, one via QT. the former performs several tests to determine if ffmpeg is available. Then, the QT compilation tries to determine which flags should be used to effectively link the proper libraries. We will try to reproduce the compilation in ArchLinux to figure out if we are missing some path test in sdk.pri. Thanks for reporting though.