Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Switch from CMake to Qbs #213

Merged
merged 94 commits into from
Mar 13, 2018
Merged

Switch from CMake to Qbs #213

merged 94 commits into from
Mar 13, 2018

Conversation

ColinDuquesnoy
Copy link
Owner

I plan to switch from cmake to qbs. Qbs (pronounced cubes) is the new build system from the Qt company that will replace qmake in the future. Qbs is much easier to use (from a developer perspective) than CMake, especially for Qt projects.

The build instructions have been updated and both AppVeyor and Travis-CI builds are passing.

I plan to merge this branch into develop in a few days. Qbs will be used for MellowPlayer 3.4 release (which I haven't started working on yet). If a bug fix is needed for version 3.3 it will be made from the master branch (with CMake).

Please try the qbs branch and report any issues you might encounter before I merge to develop.

About Qbs

Pros

  • nice language that is a derivation of QML. This makes maintaining qbs files a breeze and introduce less workflow disruption when used to build a QML application.
  • flexible project structure
  • ability to integrate custom developer tools
  • automatic generation of moc, qrc, qm files,... -> increase developers productivity
  • multi-threaded builds by default -> faster builds by default
  • very good integration with QtCreator
  • native support for pre-compiled headers -> faster builds

Cons

  • not supported by all IDE (e.g. CLion)
  • require a very recent version of qbs to build MellowPlayer (qbs >= 1.10)
  • lack of built-in solutions for deployement. We still have to rely on windeployqt/macdeployqt/linuxdeployqt

This might change in then future when we'll have native plugins but for now static libs are simpler to manage...
All infrastructure unit tests are now passing again
This is annoying if you have to debug a test failure
and improve project organization
and improve the target to not being run by default and always run when triggered explicitely
@ColinDuquesnoy ColinDuquesnoy added this to the 3.4.0 milestone Mar 10, 2018
@ColinDuquesnoy ColinDuquesnoy self-assigned this Mar 10, 2018
@ColinDuquesnoy
Copy link
Owner Author

@demmm @martinkg Please try packaging this branch and report whether it works for you or not.

Here is a sample from a working PKGBUILD that I use on the AUR:

prepare() {
    cd $srcdir/ColinDuquesnoy-MellowPlayer-${_commit}
    qbs-setup-toolchains --detect
    qbs-setup-qt /usr/bin/qmake-qt5 qt5
    qbs-config defaultProfile qt5
}

build() {
    cd $srcdir/ColinDuquesnoy-MellowPlayer-${_commit}
    qbs build --no-install -d build profile:qt5 release qbs.installRoot:/usr
}

package() {
    cd $srcdir/ColinDuquesnoy-MellowPlayer-${_commit}
    qbs install -d build --no-build -v --install-root ${pkgdir}/usr profile:qt5 release
}

@demmm you may set the default theme to midna using projects.MellowPlayer.defaultTheme:Midna

Here is a sample from a working specfile that I use on the openSUSE build service:

%prep
%setup -q
qbs --version
qbs-setup-toolchains --detect
qbs-setup-qt /usr/bin/qmake-qt5 qt5
qbs-config defaultProfile qt5

%build
qbs build --no-install -d build release qbs.installRoot:/usr

%install
qbs install -d build --no-build -v --install-root %{buildroot}/usr release

@ColinDuquesnoy ColinDuquesnoy changed the title Switch from cmake to qbs Switch from CMake to Qbs Mar 10, 2018
@martinkg
Copy link

on Fedora on used this rpm spec file:

the compilation fails at the end with this message:

ERROR 0001: file '/usr/bin/MellowPlayer' contains a standard rpath '/usr/lib64' in [/usr/lib64]

a workaround for the moment is to remove rpath with:

chrpath --delete %{buildroot}%{_bindir}/%{rname}

the next error i get is: error: Empty %files file /home/martin/rpmbuild/BUILD/MellowPlayer-0f919a14bab14fff69768deb4940dc9ecfe798b6/debugsourcefiles.list

It means -g was missing. -g tells gcc to generate debuginfo. If there
isn't any debuginfo at all, then it is impossible to generate a sources list.

how can i solve this ?

@ColinDuquesnoy
Copy link
Owner Author

@martinkg Thanks for testing.

ERROR 0001: file '/usr/bin/MellowPlayer' contains a standard rpath '/usr/lib64' in [/usr/lib64]

Does modules.cpp.useRPaths:false helps?

It means -g was missing. -g tells gcc to generate debuginfo. If there
isn't any debuginfo at all, then it is impossible to generate a sources list.
how can i solve this ?

I'd try to use qbs.debugInformation:true.

@martinkg
Copy link

@ColinDuquesnoy
these flags help now

modules.cpp.useRPaths:false
qbs.debugInformation:true

thanks

@demmm
Copy link

demmm commented Mar 11, 2018

On KaOS the gold linker error is back:

compiling Program.cpp
creating libMellowPlayer.Presentation.a
linking MellowPlayer
ERROR: /usr/bin/g++ -Wl,-m,elf_x86_64 -L/usr/lib -m64 -o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/MellowPlayer /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/3a52ce780950d4d9/Program.cpp.o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/3a52ce780950d4d9/main.cpp.o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/3a52ce780950d4d9/qrc_languages.cpp.o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/3a52ce780950d4d9/qrc_qml.cpp.o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.bbfc31ce/73489b871e127538/moc_Program.cpp.o /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.Presentation.61a70051/libMellowPlayer.Presentation.a /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/qxtglobalshortcut.a43e450e/libqxtglobalshortcut.a /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.Infrastructure.cfe7a6c0/libMellowPlayer.Infrastructure.a /buildsys/apps/mellowplayer/src/ColinDuquesnoy-MellowPlayer-0f919a1/build/release/MellowPlayer.Domain.ac16fe46/libMellowPlayer.Domain.a /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Concurrent.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Sql.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread -lX11 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Concurrent.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Sql.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5DBus.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebEngine.so.5.10.1 /usr/lib/libQt5WebEngineCore.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebEngineCore.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Core.so.5.10.1 -lpthread -lpthread -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Concurrent.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Sql.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5DBus.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebEngine.so.5.10.1 /usr/lib/libQt5WebEngineCore.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebEngineCore.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5Core.so.5.10.1 -lpthread -lpthread /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5WebEngineWidgets.so.5.10.1 /usr/lib/libQt5WebEngineCore.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5PrintSupport.so.5.10.1 /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5WebChannel.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Positioning.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5PrintSupport.so.5.10.1 /usr/lib/libQt5Widgets.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread /usr/lib/libQt5QuickControls2.so.5.10.1 /usr/lib/libQt5Quick.so.5.10.1 /usr/lib/libQt5Gui.so.5.10.1 /usr/lib/libQt5Qml.so.5.10.1 /usr/lib/libQt5Network.so.5.10.1 /usr/lib/libQt5Core.so.5.10.1 -lpthread -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

ERROR: /usr/lib/libQt5QuickTemplates2.so.5:(*IND*+0x0): multiple definition of `_edata'
collect2: error: ld returned 1 exit status
ERROR: Process failed with exit code 1.
The following products could not be built for configuration release:
        MellowPlayer
==> ERROR: A failure occurred in build().

@martinkg
Copy link

there are different on fedora F28 + F29

mellowplayer qbs branch compile fine on Fedora 27 for every arch,
but fails on:
mellowplayer qbs branch failed on fedora rawhide F29; arch: armv7hl build.log

mellowplayer qbs branch failed on fedora F28; arch: on every arch build.log
the error message: multiple definition of __bss_start maybe could solved with this flag
QMAKE_LFLAGS += -fuse-ld=gold

@ColinDuquesnoy
Copy link
Owner Author

ColinDuquesnoy commented Mar 11, 2018

@demmm @martinkg The following option should fix the gold linker error: modules.cpp.linkerFlags:-fuse-ld=gold

@demmm
Copy link

demmm commented Mar 11, 2018

@ColinDuquesnoy With latest commit (0f919a1) in qbs branch branch, builds and runs fine now on KaOS. This after adding the gold linker option.

@ColinDuquesnoy ColinDuquesnoy merged commit 59bf2c6 into develop Mar 13, 2018
@ColinDuquesnoy
Copy link
Owner Author

@demmm @martinkg Thank you for testing!

@ColinDuquesnoy
Copy link
Owner Author

@ZeroDot1 You might want to update your script. It probably won't work on Ubuntu 17.10 anymore because their version of qbs is too old but it will work in the upcoming 18.04 release.

@ColinDuquesnoy ColinDuquesnoy deleted the qbs branch March 13, 2018 18:54
@ZeroDot1
Copy link
Contributor

@ColinDuquesnoy What do I have to change the script to keep it working?

@ColinDuquesnoy
Copy link
Owner Author

ColinDuquesnoy commented Mar 13, 2018

Well it won't work with cmake anymore so you have to change the build commands, see https://github.com/ColinDuquesnoy/MellowPlayer#from-command-line

@ZeroDot1
Copy link
Contributor

@ColinDuquesnoy
Copy link
Owner Author

@ZeroDot1 Thank you. That looks good. Feel free to update the wiki 😉

@cpjeanpaul cpjeanpaul mentioned this pull request Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants