Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build on alpine linux x86_64: #295

Open
rickyrockrat opened this issue Feb 8, 2022 · 1 comment
Open

Unable to build on alpine linux x86_64: #295

rickyrockrat opened this issue Feb 8, 2022 · 1 comment

Comments

@rickyrockrat
Copy link

rickyrockrat commented Feb 8, 2022

Hi,
First, I want to preface this by saying I absolutely despise CMake and other, even more complicated build systems (Maven, anyone?).
I installed deps:

qt5-qtbase-dev readline-dev openssl-dev cmake
mkdir build
cd build
cmake ../
CMake Error at qt/CMakeLists.txt:61 (qt5_add_translation):
  Unknown CMake command "qt5_add_translation".

I don't know where or what qt5_add_translation is, so I hacked qt/CMakeLists.txt (line 61 as it says)

#qt5_add_translation(QM_FILES ${TS_FILES})       
        #set(QM_FILES_XML "")                     
        #foreach(_QM ${QM_FILES})                 
#               get_filename_component(_QM ${_QM} NAME)
#               set(QM_FILES_XML "${QM_FILES_XML}${_QM}")
#       endforeach()                                                  
#       configure_file(translations/translations.qrc.in translations.qrc)
#                                                                        
#       qt5_add_resources(RESOURCES android-file-transfer.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)

Cmake is happy until the link:

[100%] Linking CXX executable android-file-transfer
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: CMakeFiles/android-file-transfer.dir/main.cpp.o: in function `main':
main.cpp:(.text.startup+0x7d): undefined reference to `qInitResources_android_file_transfer()'
collect2: error: ld returned 1 exit status
make[2]: *** [qt/CMakeFiles/android-file-transfer.dir/build.make:479: qt/android-file-transfer] Error 1
make[1]: *** [CMakeFiles/Makefile2:197: qt/CMakeFiles/android-file-transfer.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I do not need translations, but understand they are needed.
I got it to build, but what a royal PITA!!
It's not building the resource file, so I figured that command out:

/usr/lib/qt5/bin/rcc -g cpp ../../qt/android-file-transfer.qrc -o qt/CMakeFiles/android-file-transfer.cpp

It doesn't have the right name in the resource output, of course!!, so fix that:

sed -i 's!qInitResources!qInitResources_android_file_transfer!' qt/CMakeFiles/android-file-transfer.cpp

Then compile it:

/usr/bin/c++ -DMTPZ_DATA_SOURCE=\"https://raw.githubusercontent.com/kbhomes/libmtp-zune/master/src/.mtpz-data\" -DMTPZ_ENABLED -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -I/home/doug/android-file-transfer-linux/build/qt -I/home/doug/android-file-transfer-linux -I/home/doug/android-file-transfer-linux/mtp/backend/posix -I/home/doug/android-file-transfer-linux/mtp/backend/linux -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtNetwork -O3 -DNDEBUG   -Wall -pthread -fPIC -std=gnu++11 -MD -MT qt/CMakeFiles/android-file-transfer.cpp -MF qt/CMakeFiles/main.cpp.o.d -o qt/CMakeFiles/android-file-transfer.o -c qt/CMakeFiles/android-file-transfer.cpp

Wow, that was !@#$!! fun.
Then link it:

/usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/android-file-transfer.dir/main.cpp.o CMakeFiles/android-file-transfer.dir/mainwindow.cpp.o CMakeFiles/android-file-transfer.dir/fileuploader.cpp.o CMakeFiles/android-file-transfer.dir/commandqueue.cpp.o CMakeFiles/android-file-transfer.dir/mtpobjectsmodel.cpp.o CMakeFiles/android-file-transfer.dir/mtpstoragesmodel.cpp.o CMakeFiles/android-file-transfer.dir/progressdialog.cpp.o CMakeFiles/android-file-transfer.dir/createdirectorydialog.cpp.o CMakeFiles/android-file-transfer.dir/renamedialog.cpp.o CMakeFiles/android-file-transfer.dir/devicesdialog.cpp.o CMakeFiles/android-file-transfer.dir/qtobjectstream.cpp.o CMakeFiles/android-file-transfer.dir/utils.cpp.o CMakeFiles/android-file-transfer.dir/moc_mainwindow.cpp.o CMakeFiles/android-file-transfer.dir/moc_fileuploader.cpp.o CMakeFiles/android-file-transfer.dir/moc_commandqueue.cpp.o CMakeFiles/android-file-transfer.dir/moc_mtpobjectsmodel.cpp.o CMakeFiles/android-file-transfer.dir/moc_progressdialog.cpp.o CMakeFiles/android-file-transfer.dir/moc_createdirectorydialog.cpp.o CMakeFiles/android-file-transfer.dir/moc_renamedialog.cpp.o CMakeFiles/android-file-transfer.dir/moc_devicesdialog.cpp.o CMakeFiles/android-file-transfer.dir/moc_qtobjectstream.cpp.o CMakeFiles/android-file-transfer.o -o android-file-transfer  /usr/lib/libQt5Widgets.so.5.15.3 /usr/lib/libQt5Network.so.5.15.3 ../libmtp-ng-static.a -lcrypto /usr/lib/libQt5Gui.so.5.15.3 /usr/lib/libQt5Core.so.5.15.3

The application does work. I don't know what is broken in the build system, but it surely is. This is one of the many reasons I despise Cmake - it took a difficult problem and made it harder.

One other thing, I commented out all the translation stuff at the top of main.cpp in the qt directory.
Hope this helps some poor soul trying to get this built on an Alpine Linux X86_64 system (3.15).

I'm so sick of go-mtpfs crippled pathetic nonsense that I'm hopeful this application lives up to the README. It can't get any worse for sure. Thanks for all the work!

@whoozle
Copy link
Owner

whoozle commented Apr 7, 2022

hey, I'm sorry you have this failure and for the late answer,
try installing libqt5-linguist-devel or whatever it's called in your distro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants