Clementine: Build fails on the qt5 branch

Created on 11 Nov 2018  Â·  20Comments  Â·  Source: clementine-player/Clementine

Before posting

Please follow the steps below and check the boxes with [x] once you did the step.

  • [x] I checked the issue tracker for similar issues
  • [x] I checked the changelog if the issue is already resolved
  • [x] I tried the latest Clementine build from here

System information

Please provide information about your system and the version of Clementine used.

  • Operating System: macOS 10.13
  • Clementine version: la

Description of my problem

I'm unable to build the latest qt5 branch. Here is my build log: https://pastebin.com/ST49ZfGP

I opened an issue as requested here: https://github.com/clementine-player/Clementine/issues/3463#issuecomment-437172661

Most helpful comment

Looks like newer versions of protobuf generate C++11 code so you'd need to enable it in that module like we do elsewhere (something like --std=c++0x in the CMAKE_CXX_FLAGS.

All 20 comments

I can confirm it does not compile.
No work has been done for macos on the qt5 branch. I'm not a macos programmer, but I've fixed it halfway, I can probably submit a PR with my changes so at least it compiles. See #5334 . But a lot of the macos specific code needs updating.
I don't use Xcode though, where is the cmake output, where is any useful output that it actually started to compile any source from clementine in there? Did you set up the build environment properly? How did you install the dependencies? Through brew?

As I understand it, to build for macOS one needs to do the compilation in Linux, usually in docker see: https://github.com/clementine-player/Clementine/wiki/Compiling-from-Source-(Mac-OS-X)

I tried this on my macOS 10.13.6 (17G65) and was able to compile Clementine although I do not recall if it would run long before closing.

I also found a bunch of dev builds here you could try: https://builds.clementine-player.org/mac/

See #6206

Erm, please excuse this Noob sound error, can you help me setup a build tool? AFAIK everything is in my path but:

➜ bin git:(qt5) cmake .. -DQT_MAC_USE_COCOA=ON -DENABLE_VISUALISATIONS=OFF -DUSE_BUNDLE=OFF

CMake Error at /usr/local/Cellar/cmake/3.12.4/share/cmake/Modules/CMakeDetermineSystem.cmake:100 (message):
Could not find toolchain file: /src/macosx/Toolchain-Darwin.cmake

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

➜ bin git:(qt5) git status
On branch qt5
Your branch is up to date with 'origin/qt5'.

➜ bin git:(qt5) export | grep qt
CPPFLAGS=-I/usr/local/opt/qt/include
LDFLAGS=-L/usr/local/opt/qt/lib
PATH=/usr/local/sbin:/usr/local/sbin:/usr/local/opt/gettext/bin:/usr/local/opt/qt/bin:/Users/tom/Dropbox/ShellScripts:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
PKG_CONFIG_PATH=/usr/local/opt/qt/lib/pkgconfig
Qt5_DIR=/usr/local/opt/qt5/lib/cmake
➜ bin git:(qt5) export | grep make
Qt5_DIR=/usr/local/opt/qt5/lib/cmake

@jonaski I tried to build your branch but I have the following error:

$ cmake ..
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
CMake Error at CMakeLists.txt:40 (message):
  Cocoa support is required


-- Configuring incomplete, errors occurred!
See also "/Users/martin/dev/clone/Clementine/bin/CMakeFiles/CMakeOutput.log".

@tomachinz
The error is: Could not find toolchain file: /src/macosx/Toolchain-Darwin.cmake
Did you start with a clean build directory? remove it. You also need to use my branch since it's not merged yet.
@MartinDelille
Use: cmake .. -DQT_MAC_USE_COCOA=ON -DENABLE_VISUALISATIONS=OFF -DUSE_BUNDLE=OFF
Not just "cmake .."

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install glib pkgconfig cmake boost protobuf protobuf-c qt cryptopp gettext
brew install sqlite --with-fts
brew install gstreamer gst-plugins-base
brew install gst-plugins-good --with-flac
brew install gst-plugins-bad gst-plugins-ugly
brew install chromaprint liblastfm
export Qt5_DIR=/usr/local/opt/qt5/lib/cmake
export Qt5LinguistTools_DIR=/usr/local/Cellar/qt/5.11.2/lib/cmake/Qt5LinguistTools
export GST_SCANNER_PATH=/usr/local/Cellar/gstreamer/1.14.4/libexec/gstreamer-1.0/gst-plugin-scanner
export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0
export PATH="/usr/local/opt/gettext/bin:$PATH"

git clone https://github.com/clementine-player/Clementine
cd Clementine
git checkout qt5
cd bin
cmake .. -DQT_MAC_USE_COCOA=ON -DENABLE_VISUALISATIONS=OFF -DUSE_BUNDLE=OFF
make -j8

@jonaski Still failing:

CMake Deprecation Warning at CMakeLists.txt:2 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Boost version: 1.69.0
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Gettext (missing: GETTEXT_MSGMERGE_EXECUTABLE
  GETTEXT_MSGFMT_EXECUTABLE)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindGettext.cmake:80 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:47 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/martin/dev/clone/Clementine/bin/CMakeFiles/CMakeOutput.log".

Did you install gettext and is the bin path set in $PATH?
Whats the output of: echo $PATH
and does /usr/local/opt/gettext/bin contain msgmerge?

Ok after installing gettext with brew and adding /usr/local/opt/gettext/bin to the path, I have the following error:

$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Boost version: 1.69.0
FFTW3 lib not found. Set FFTW3_DIR to find it.
-- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
-- Checking for module 'dbus-1'
--   No package 'dbus-1' found
-- Checking for module 'libcdio'
--   No package 'libcdio' found
-- Checking for module 'libchromaprint'
--   No package 'libchromaprint' found
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPkgConfig.cmake:436 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPkgConfig.cmake:602 (_pkg_check_modules_internal)
  CMakeLists.txt:63 (pkg_check_modules)


-- Configuring incomplete, errors occurred!
See also "/Users/martin/dev/clone/Clementine/bin/CMakeFiles/CMakeOutput.log".

Missing chromaprint

I've created the instructions in the wiki which can be updated:
https://github.com/clementine-player/Clementine/wiki/Compiling-from-source-(qt5)-using-dependencies-from-brew-(macOS)

cmake is passing!

Unfortunately, it is now make that is failing:

[ 19%] Building CXX object ext/libclementine-remote/CMakeFiles/libclementine-remote.dir/remotecontrolmessages.pb.cc.o
In file included from /Users/martin/dev/clone/Clementine/bin/ext/libclementine-remote/remotecontrolmessages.pb.cc:4:
In file included from /Users/martin/dev/clone/Clementine/bin/ext/libclementine-remote/remotecontrolmessages.pb.h:9:
/usr/local/include/google/protobuf/stubs/common.h:209:17: error: expected expression
  OnShutdownRun([](const void* p) { delete static_cast<const T*>(p); }, p);
                ^
In file included from /Users/martin/dev/clone/Clementine/bin/ext/libclementine-remote/remotecontrolmessages.pb.cc:4:
In file included from /Users/martin/dev/clone/Clementine/bin/ext/libclementine-remote/remotecontrolmessages.pb.h:25:
In file included from /usr/local/include/google/protobuf/generated_message_table_driven.h:34:
In file included from /usr/local/include/google/protobuf/map.h:49:
In file included from /usr/local/include/google/protobuf/map_type_handler.h:35:
In file included from /usr/local/include/google/protobuf/wire_format_lite_inl.h:43:
/usr/local/include/google/protobuf/message_lite.h:117:3: error: unknown type name 'constexpr'
  constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }

It looks like a C++ 11 is not supported in this build.

I'm not sure why, because I also used macOS 10.13 (High Sierra) to compile and it worked.
I used clang compiler. Maybe some of the development tools on your macos is not up to date?
You can check version with: clang --version
An alternative is to install gcc through brew and try to use that instead.
I've used gcc with cmake on OpenBSD and FreeBSD to compile in the past, but I don't remember how I did it. All I remember is I never got cmake command to use gcc, so I had to edit CMakeLists.txt and force it there.
I've upgraded to Mojave now, so I don't know what version I was using.
Mojave does not have opengl, I've made a PR to make opengl optional since it's only required for Visualisations.

Looks like newer versions of protobuf generate C++11 code so you'd need to enable it in that module like we do elsewhere (something like --std=c++0x in the CMAKE_CXX_FLAGS.

My build currently fails with D-Bus support enabled because the QDBusArgument file is not being found, despite it existing on my system in the normal place.

In file included from /home/tatsh/dev/clementine/src/ui/settingsdialog.h:25,
from /home/tatsh/dev/clementine/src/core/application.h:29,
from /home/tatsh/dev/clementine/src/core/application.cpp:23:
/home/tatsh/dev/clementine/src/widgets/osd.h:40:10: fatal error: QDBusArgument: No such file or directory
#include <QDBusArgument>
^~~~~~~~~~~~~~~
compilation terminated.

@hatstand It worked!

@jonaski I pushed my fix here but I can't found the qt5-fix branch anymore to make a pull request against it.

@MartinDelille I just ran into this issue a few days ago on the Gentoo Linux via emerge. Not sure if it's related to the same thing since it's not on MacOS, but here's the output. Can you confirm if this will be resolved with that?:

In file included from /var/tmp/portage/media-sound/clementine-9999/work/clementine-9999/src/ui/settingsdialog.h:25:0,
                 from /var/tmp/portage/media-sound/clementine-9999/work/clementine-9999/src/core/application.h:29,
                 from /var/tmp/portage/media-sound/clementine-9999/work/clementine-9999/src/core/application.cpp:23:
/var/tmp/portage/media-sound/clementine-9999/work/clementine-9999/src/widgets/osd.h:40:10: fatal error: QDBusArgument: No such file or directory
 #include <QDBusArgument>
          ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/clementine_lib.dir/build.make:3270: src/CMakeFiles/clementine_lib.dir/core/application.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/media-sound/clementine-9999/work/clementine-9999_build'
make[1]: *** [CMakeFiles/Makefile2:546: src/CMakeFiles/clementine_lib.dir/all] Error 2
make[1]: Leaving directory '/var/tmp/portage/media-sound/clementine-9999/work/clementine-9999_build'
make: *** [Makefile:130: all] Error 2
 * ERROR: media-sound/clementine-9999::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=media-sound/clementine-9999::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-sound/clementine-9999::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-sound/clementine-9999/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-sound/clementine-9999/temp/environment'.
 * Working directory: '/var/tmp/portage/media-sound/clementine-9999/work/clementine-9999_build'
 * S: '/var/tmp/portage/media-sound/clementine-9999/work/clementine-9999'

>>> Failed to emerge media-sound/clementine-9999, Log file:

>>>  '/var/tmp/portage/media-sound/clementine-9999/temp/build.log'

@K73SK No my fix only concerns C++11 compatibility

@K73SK I am having the same issue with QDBusArgument on Linux:

[ 52%] Building CXX object src/CMakeFiles/clementine_lib.dir/core/application.cpp.o
In file included from /home/alex/src/clementine-player/src/ui/settingsdialog.h:25:0,
                 from /home/alex/src/clementine-player/src/core/application.h:29,
                 from /home/alex/src/clementine-player/src/core/application.cpp:23:
/home/alex/src/clementine-player/src/widgets/osd.h:40:25: fatal error: QDBusArgument: No such file or directory
 #include <QDBusArgument>
                         ^
compilation terminated.

Sorry for commenting here, just found that someone has opened a separate issue for this problem: #6245

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pulfer picture Pulfer  Â·  3Comments

Clementine-Issue-Importer picture Clementine-Issue-Importer  Â·  6Comments

MavropaliasG picture MavropaliasG  Â·  3Comments

AndydeCleyre picture AndydeCleyre  Â·  6Comments

SystemParadox picture SystemParadox  Â·  5Comments