MEGAsync icon indicating copy to clipboard operation
MEGAsync copied to clipboard

[MEGAShellExtDolphin] fail build

Open sl1pkn07 opened this issue 8 years ago • 13 comments

when try build MEGAShellExtDolphin with KF5 (5.37.0)

[ 50%] Linking CXX shared module megasyncplugin.so
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0x21): undefined reference to `vtable for MEGASyncPluginFactory'
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::~MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0xb3): undefined reference to `vtable for MEGASyncPluginFactory'
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::~MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0xd3): undefined reference to `vtable for MEGASyncPluginFactory'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/megasyncplugin.dir/build.make:121: megasyncplugin.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/megasyncplugin.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

mega SDK v3.1.4.0.3.g2dcb710b-1 (from git) gcc 7.2.0 cmake 3.9.1

sl1pkn07 avatar Aug 19 '17 20:08 sl1pkn07

What are the steps you follow to try and compile it? This should do:

cd src/MEGAShellExtDolphin/
mv CMakeLists_kde5.txt CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX="`kf5-config --prefix`" $PWD 
make

Notice there are two CMakeLists, one for KDE4 and another for KDE5 (you need to replace the default CMakeList.txt by the one for KDE5). Also, use another install prefix if you do not wish make install to have it installed the path KDE will look for.

polmr avatar Aug 21 '17 07:08 polmr

Yes, that`s i do

sl1pkn07 avatar Aug 21 '17 09:08 sl1pkn07

In case you can spot any difference:

cmake -DCMAKE_INSTALL_PREFIX="kf5-config --prefix" $PWD

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found KF5CoreAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.18.0") 
-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.18.0") 
-- Found KF5: success (found suitable version "5.18.0", minimum required is "5.0.0") found components:  CoreAddons KIO 
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Configuring done
-- Generating done
-- Build files have been written to: $PWD/src/MEGAShellExtDolphin

make

Scanning dependencies of target megasyncplugin_automoc
[ 12%] Automatic moc for target megasyncplugin
Generating megasync-plugin.moc
Generating moc_megasync-plugin.cpp
[ 12%] Built target megasyncplugin_automoc
Scanning dependencies of target megasyncplugin
[ 25%] Building CXX object CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o
[ 37%] Building CXX object CMakeFiles/megasyncplugin.dir/megasyncplugin_automoc.cpp.o
[ 50%] Linking CXX shared module megasyncplugin.so
[ 50%] Built target megasyncplugin
Scanning dependencies of target megasyncdolphinoverlayplugin_automoc
[ 62%] Automatic moc for target megasyncdolphinoverlayplugin
Generating megasync-plugin-overlay.moc
[ 62%] Built target megasyncdolphinoverlayplugin_automoc
Scanning dependencies of target megasyncdolphinoverlayplugin
[ 75%] Building CXX object CMakeFiles/megasyncdolphinoverlayplugin.dir/megasync-plugin-overlay.cpp.o
[ 87%] Building CXX object CMakeFiles/megasyncdolphinoverlayplugin.dir/megasyncdolphinoverlayplugin_automoc.cpp.o
[100%] Linking CXX shared module megasyncdolphinoverlayplugin.so
[100%] Built target megasyncdolphinoverlayplugin

polmr avatar Aug 21 '17 11:08 polmr

Kf5 5.18 os too old, my problem is with 5.37 (when back to home i'll upload the full output)

sl1pkn07 avatar Aug 21 '17 12:08 sl1pkn07

steps:

  mkdir -p build
  git clone https://github.com/meganz/MEGAsync.git
  mv MEGAsync/src/MEGAShellExtDolphin/CMakeLists.txt MEGAsync/src/MEGAShellExtDolphin/CMakeLists.txt.old
  mv MEGAsync/src/MEGAShellExtDolphin/CMakeLists_kde5.txt MEGAsync/src/MEGAShellExtDolphin/CMakeLists.txt

  cd build
  cmake ../MEGAsync/src/MEGAShellExtDolphin \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr

  LC_ALL=C make -j1
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found KF5CoreAddons: /usr/lib64/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.37.0") 
-- Found KF5KIO: /usr/lib64/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.37.0") 
-- Found KF5: success (found suitable version "5.37.0", minimum required is "5.0.0") found components:  CoreAddons KIO 
-- Installing in the same prefix as Qt, adopting their path scheme.
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sl1pkn07/aplicaciones/dolphin-megasync-git/build
Scanning dependencies of target megasyncplugin_autogen
[ 12%] Automatic MOC for target megasyncplugin
AutoMoc: Warning: "/home/sl1pkn07/aplicaciones/dolphin-megasync-git/MEGAsync/src/MEGAShellExtDolphin/megasync-plugin.cpp"
The file includes the moc file "megasync-plugin.moc", but does not contain a Q_OBJECT or Q_GADGET macro.

Generating MOC predefs moc_predefs.h
Generating MOC source include/megasync-plugin.moc
Generating MOC source EWIEGA46WW/moc_megasync-plugin.cpp
Generating MOC compilation mocs_compilation.cpp
[ 12%] Built target megasyncplugin_autogen
Scanning dependencies of target megasyncplugin
[ 25%] Building CXX object CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o
/home/sl1pkn07/aplicaciones/dolphin-megasync-git/MEGAShellExtDolphin/megasync-plugin.cpp: In member function 'virtual QList<QAction*> MEGASyncPlugin::actions(const KFileItemListProperties&, QWidget*)':
/home/sl1pkn07/aplicaciones/dolphin-megasync-git/MEGAShellExtDolphin/megasync-plugin.cpp:142:9: warning: 'state' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (state == FILE_SYNCED)
         ^~
[ 37%] Building CXX object CMakeFiles/megasyncplugin.dir/megasyncplugin_autogen/mocs_compilation.cpp.o
[ 50%] Linking CXX shared module megasyncplugin.so
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0x21): undefined reference to `vtable for MEGASyncPluginFactory'
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::~MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0xb3): undefined reference to `vtable for MEGASyncPluginFactory'
CMakeFiles/megasyncplugin.dir/megasync-plugin.cpp.o: In function `MEGASyncPluginFactory::~MEGASyncPluginFactory()':
megasync-plugin.cpp:(.text+0xd3): undefined reference to `vtable for MEGASyncPluginFactory'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/megasyncplugin.dir/build.make:121: megasyncplugin.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/megasyncplugin.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

sl1pkn07 avatar Aug 21 '17 13:08 sl1pkn07

same output if

#set(KF5_MIN_VERSION "5.0.0")
set(KF5_MIN_VERSION "5.16.0")

sl1pkn07 avatar Aug 21 '17 15:08 sl1pkn07

Try to remove megasync-plugin.moc before proceeding. I've seen it succeed with KF5 up to 3.32.0.

polmr avatar Aug 21 '17 16:08 polmr

yep. removing that file now build

but fail in install step (seems missing .dektop file)

https://github.com/meganz/MEGAsync/blob/master/src/MEGAShellExtDolphin/CMakeLists_kde5.txt#L63

CMake Error at cmake_install.cmake:84 (file):
  file INSTALL cannot find
  "/tmp/makepkg/dolphin-megasync-git/src/build/megasync-plugin.desktop".


make: *** [Makefile:74: install] Error 1

sl1pkn07 avatar Aug 21 '17 17:08 sl1pkn07

It's because your a building in a different location that the one expected. You can simply copy the file to your build folder:

cp ../desktop_dolphplugin/src/MEGAShellExtDolphin/megasync-plugin.desktop ./

polmr avatar Aug 21 '17 17:08 polmr

or

diff --git a/MEGAsync/src/MEGAShellExtDolphin/CMakeLists_kde5.txt b/MEGAsync/src/MEGAShellExtDolphin/CMakeLists_kde5.txt
index 83224966..3814d073 100644
--- a/MEGAsync/src/MEGAShellExtDolphin/CMakeLists_kde5.txt
+++ b/MEGAsync/src/MEGAShellExtDolphin/CMakeLists_kde5.txt
@@ -38,7 +38,6 @@ add_definitions(-DWITH_KF5)
 if (KF5_VERSION)
 	if (NOT KF5_VERSION VERSION_LESS 5.16.0)
 		set(MEGASYNCDOLPHINOVERLAYPLUGIN megasyncdolphinoverlayplugin)
-		set(PLUGIN_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/plugins) #so that kcoreaddons install in the right path (see https://github.com/KDE/kcoreaddons/blob/master/KF5CoreAddonsMacros.cmake)
 		kcoreaddons_add_plugin(${MEGASYNCDOLPHINOVERLAYPLUGIN} INSTALL_NAMESPACE "kf5/overlayicon"
 							   JSON megasync-plugin-overlay.json SOURCES megasync-plugin-overlay.cpp)
 		#target_link_libraries(${MEGASYNCDOLPHINOVERLAYPLUGIN} KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets ${MEGASYNCDOLPHINHELPER})
@@ -60,6 +59,6 @@ add_library(${MEGASYNCPLUGIN} MODULE megasync-plugin.cpp)
 target_link_libraries(${MEGASYNCPLUGIN} KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets)
 #configure_file(megasync-plugin.desktop.in ${MEGASYNCPLUGIN}.desktop ESCAPE_QUOTES @ONLY)
 
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/megasync-plugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
-install(TARGETS ${MEGASYNCPLUGIN} DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt5/plugins)
+install(FILES megasync-plugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
+install(TARGETS ${MEGASYNCPLUGIN} DESTINATION ${PLUGIN_INSTALL_DIR})
 

? (i thik is better. all kf5 programs use the same change)

EDITED: now install the plugin on where the system install automagical the Qt/KF5 plugins. keep overlayicon path intact EDIT2: fixed redundant PLUGIN_INSTASLL_DIR

sl1pkn07 avatar Aug 21 '17 17:08 sl1pkn07

:+1: I will try to apply those changes and see that they don't break any package compilation. thanks @sl1pkn07

polmr avatar Aug 22 '17 12:08 polmr

mm seems that patch make PLUGIN_INSTASLL_DIR line redundant, fixed

sl1pkn07 avatar Aug 22 '17 20:08 sl1pkn07

please add src/MEGAShellExtDolphin/megasync-plugin.moc to the .gitignore file

greetings

sl1pkn07 avatar Apr 02 '19 16:04 sl1pkn07

Dolphin extension building has been heavily reworked since 2019. Closing.

rl-mega avatar Sep 18 '25 17:09 rl-mega