compiling musescore for uCLinux with QT and cmake - qt

I've try few things but I still have this error when trying to cmake for blackfin:
CMake Error at CMakeLists.txt:116 (message):
Fatal error: QT (version >= 4.5.0) required. Cmake tries to detect QT4 by
searching for 'qmake' in your PATH.If you have QT4 installed, make sure
qmake is found in your PATH. If you compiled QT4 yourself make sure your
new qmake ist found _first_ in your PATH.
I'm trying to compile the source of musescore 0.9.5 to keep it compatible with the existing version of QT in uClinux options
What I did is to compile the uClinux kernel with QT lib so I can have the suitable embedded QT.
then I modified the Makefile of musescore to build with uclinux compilers. I've try different things so I show here the latest trial:
bfin:
mkdir build;
mkdir install; \
cd build;
cmake -DCMAKE_TOOLCHAIN_FILE=bfin.cmake -DCMAKE_VERBOSE_MAKEFILE=TRUE -\
DQT_QMAKE_EXECUTABLE=/home/william/Development_new/Music_Recognition/code/uCLin\
ux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-sr\
c-4.5.1/bin -libdir=/home/william/Development_new/Music_Recognition/cod\
e/uCLinux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-openso\
urce-src-4.5.1/lib \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
mscore;
in the CMakeLists.txt I did add:
link_directories(/home/william/Development_new/Music_Recognition/code/uCLinux/r\
ev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-src-4.\
5.1/bin)
SET(CMAKE_MODULE_PATH /home/william/Development_new/Music_Recognition/code/uCLi\
nux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-s\
rc-4.5.1/bin)
SET(CMAKE_PREFIX_PATH /home/william/Development_new/Music_Recognition/code/uCLi\
nux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-s\
rc-4.5.1/bin)
SET(QT_QMAKE_EXECUTABLE /home/william/Development_new/Music_Recognition/code/uC\
Linux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource\
-src-4.5.1/bin)
my bfin.cmake look like that:
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
#
SET (BFIN "/opt/uClinux/bfin-uclinux")
# specify the cross compiler
SET(CMAKE_C_COMPILER ${BFIN}/bin/bfin-uclinux-gcc)
SET(CMAKE_CXX_COMPILER ${BFIN}/bin/bfin-uclinux-g++)
SET(CMAKE_LINKER ${BFIN}/bin/bfin-uclinux-ld)
#/opt/uClinux/bfin-uclinux/bfin-uclinux/runtime/usr/lib
LINK_DIRECTORIES("${BFIN}/usr/lib")
SET(CMAKE_FIND_ROOT_PATH
/opt/uClinux/bfin-uclinux/bfin-uclinux
/opt/uClinux/bfin-linux-uclibc
/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Thanks in advance for the help,
William

You need to put qmake in your $PATH. If you prefer to use QT_QMAKE_EXECUTABLE it has to point to the actual qmake binary and not the directory.
That being said, MuseScore 0.9.5 is a very very old version of MuseScore, the current version is 1.1 and 1.2 is coming soon. Check http://musescore.org for more information about MuseScore and don't hesitate to contact the developers on #musescore on freenode.net or on the developer mailing list at http://musescore.org/mailing-list

Related

Where does CMake look for modules? (trying to fix errors after environment changes)

I'm trying to build a QT5 application using CMake, and it builds fine under normal circumstances.
But I need to build it with the Linux AM335X toolchain / SDK, so I source the "environment-setup" script, which makes a large amount of changes to environment variables.
Now when I run CMake I get this error:
CMake Error at CMakeLists.txt:27 (find_package):
By not providing "FindQt5Quick.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Quick",
but CMake did not find one.
Could not find a package configuration file provided by "Qt5Quick" with any
of the following names:
Qt5QuickConfig.cmake
qt5quick-config.cmake
Add the installation prefix of "Qt5Quick" to CMAKE_PREFIX_PATH or set
"Qt5Quick_DIR" to a directory containing one of the above files. If
"Qt5Quick" provides a separate development package or SDK, be sure it has
been installed.
This is my CMakeLists.txt file.
project(SPRITER_PLUS_PLUS_QT)
cmake_minimum_required(VERSION 2.9)
option(COMPILE_QML_PLUGIN "Compile the qml plugin" ON)
if(${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
message(FATAL_ERROR "In-tree build attempt detected, aborting. Set your build dir outside your source dir, delete CMakeCache.txt from source root and try again.")
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
# Compiler options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fmax-errors=2 -Wall -Wno-unused-function")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(SKIP_EXAMPLES ON)
include("QtCreatorResources")
#Qt
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5Quick REQUIRED) # this is the offending line.
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Multimedia REQUIRED)
add_subdirectory(spriterplusplus EXCLUDE_FROM_ALL)
add_subdirectory(qtdocumentwrapper EXCLUDE_FROM_ALL)
add_subdirectory(qt)
add_subdirectory(example)
qtcreator_add_project_resources(${SPRITER_ENGINE_SRCS} ${SPRITER_ENGINE_HDRS})
qtcreator_add_project_resources(${SPRITER_EXAMPLE_SRCS} ${SPRITER_EXAMPLE_HDRS})
My main question is how do I tell where it's looking for Qt5QuickConfig.cmake which exists in several locations on my machine? I have checked CMAKE_MODULE_PATH but it appears to be the same (just the location I'm running CMake from) whether I run successfully or within the toolkit environment.
Any other hints to fix this issue would be greatly appreciated.
Note: I've already done stuff like sudo apt-get install qtdeclarative5-dev which is why it works in the normal environment. I'm guessing in the SDK's environment, it no longer knows where that put it hence my question.

Building Qt project with cmake

Just installed QT and trying to build a QT project from inside the QTcreator using Cmake instead of Qmake.
I get the following error:
Starting to parse CMake project, using: "DCMAKE_BUILD_TYPE:STRING=Debug",
"-DCMAKE_CXX_COMPILER:STRING=",
"-DCMAKE_C_COMPILER:STRING=",
"DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.1/msvc2015_64",
"DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.1/msvc2015_64/bin/qmake.exe".
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeOutput.log".
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
CMake Project parsing failed.
Now if I use the Cmake-GUI instead, I can configure and generate the project files successfully, after supplying the environment variable CMAKE_PREFIX_PATH.
But I can't get this to work from inside the QTcreator.
Anyone has any experience with using Cmake with QTcreator then please help.
Thank you!
The error message says that your C++ compiler Visual Studio 2015 (64 bits) could not be located. Maybe when you run cmake-gui it finds another C++ compiler like mingw?
In Qtcreator's settings dialog you have a tab showing the detected compilers, and another one with the available kits.
It seems that QtCreator is using a deprecated version of cmake. Update QtCreator to a new (unreleased, as writing this comment, version 4.10.0 is broken) or downgrade cmake to choco.exe install cmake --version 3.11 --force (a newer version might work).
Please also make sure to install jom (as this is the default for QtCreator/CMake on windows).
choco.exe install jom (how can I tell it to use make?)
The deprecation warning is harmless. CMake deprecated the cmake-server and provides a new API for the same purpose now. Qt Creator will support that from 4.11.
The error tells you, that CMake is unable find the cl compiler. cl.exe comes with Visual Studio. Make sure you mark C++ there during the installation process. It is not installed by default anymore.
Alternatively install the MinGW tool chain from the Qt installer. In Qt context it is easier to use than the Visual Studio tool chain.

Statically installing Qt4 such that OpenCV can detect the installed Qt4 libraries

I am currently using Ubuntu 14.04 LTS.
How can I statically build Qt 4.8.5 -
https://download.qt.io/archive/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
such that when I cmake OpenCV 2.4.13 -
https://github.com/opencv/opencv/archive/2.4.13.zip
it correctly identifies the location of Qt4 ?
When I cmake OpenCV after I have installed Qt4 in /usr/local/qt4-static/, the find_package(Qt4 REQUIRED QtCore QtGui QtTest) function call within opencv-2.4.13/cmake/OpenCVFindLibsGUI.cmake fails because it cannot find qmake. Also, upon running the qmake -query in the terminal, Ubuntu says that qmake is not installed, when it clearly in /usr/local/qt4-static/.
How should I go about this so OpenCV cmake correctly recognizes Qt4 ?
Build Qt
Extract the source-code and run ./configure && make and then sudo make install. It should create all necessary configuration to run qmake in any folder (system-wide).
Additional: create a symlink/export (use only if make install did not work for you)
You need to promote qmake to $PATH or create a symlink, but this is usually done when you run sudo make install after make in the Qt source-folder.
root:/home# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
Symlink (permanently)
ln -s /path/to/qmake /usr/sbin/qmake
or
export (temporary)
export PATH=$PATH:/folder/of/qmake
Afterwards qmake -v is working whereever you are
root:/tmp qmake -v
QMake version 3.1
Using Qt version 5.10.1 in /usr/local/Qt-5.10.1/lib
If your project still cannot determine the location of Qt, read the pro/pri/cmake file to understand how it looks for the path.

how to change opencv configrations in cmake to support qt

I'm new to opencv. I installed it on my computer using cmake following the tutorial in their website.
mkdir Desctop/opencv
cd Desctop/opencv
git clone https://github.com/Itseez/opencv.git
cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
And to compile with opencv using cmake, I add the CMakeLists.txt file in the cpp file directory then execute
cd <cpp file directory>
cmake .
make
But now I know more about opencv. I know that I can make GUI windows with it; I can make buttons, scroll bars and many other UI controls.
But I can't use the GUI tools unless I integrated cmake with QT.I'm not sure how should it be, but I thing it would be something like
cmake -D WITH_QT=ON ..
Reference
But the problem is that I've already installed opencv and I don't know how can I change it's configurations to use QT.
I tried to install cmake-gui to change the opencv installation configurations but I didn't find anything for opencv in the program.
My questions
Do I need to re-install opencv or it's possible to change the settings or changing the content of CMakeLists.txt file?
How can I change the configurations of the current opencv installation so it support QT?
would I need to change the CMakeLists.txt file after changing opencv's configurations?

Cmake can't find Qt OpenGL library

I'm trying to compile a project using cmake. The instructions given to me was that Qt 4.8 is needed. Downloaded it from qt-project.org/downloads. Compiled and installed Qt 4.8:
mazdak#lnxamindai> qmake -query
QT_INSTALL_PREFIX:/usr/local/Trolltech/Qt-4.8.5
QT_INSTALL_DATA:/usr/local/Trolltech/Qt-4.8.5
QT_INSTALL_DOCS:/usr/local/Trolltech/Qt-4.8.5/doc
QT_INSTALL_HEADERS:/usr/local/Trolltech/Qt-4.8.5/include
QT_INSTALL_LIBS:/usr/local/Trolltech/Qt-4.8.5/lib
QT_INSTALL_BINS:/usr/local/Trolltech/Qt-4.8.5/bin
QT_INSTALL_PLUGINS:/usr/local/Trolltech/Qt-4.8.5/plugins
QT_INSTALL_IMPORTS:/usr/local/Trolltech/Qt-4.8.5/imports
QT_INSTALL_TRANSLATIONS:/usr/local/Trolltech/Qt-4.8.5/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/local/Trolltech/Qt-4.8.5/examples
QT_INSTALL_DEMOS:/usr/local/Trolltech/Qt-4.8.5/demos
QMAKE_MKSPECS:/usr/local/Trolltech/Qt-4.8.5/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.8.5
However, when compiling the project I received the following error:
root#lnxamindai> cmake .
-- Setting flags for GNU GCC
-- REQUIRED_VARS (missing: QTMOBILITY_INCLUDE_DIR QTMOBILITY_MULTIMEDIAKIT_INCLUDE_DIR QTMOBILITY_MULTIMEDIAKIT_LIBRARY VERSION_VAR QTMOBILITY_VERSION)
Qt QTOPENGL library not found.
-- Buiding ManyEarsLib Library...
-- Buiding RTAudio Library...
-- Found jack: /usr/lib/libjack.so
ALSA lib : -lasound -lpthread
Qt QTOPENGL library not found.
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/mazdak/dev/ManyEars/manyears/QtGUI
QTMOBILITY_MULTIMEDIAKIT_LIBRARY (ADVANCED)
linked by target "ManyEars" in directory /home/mazdak/dev/ManyEars/manyears/QtGUI
-- Configuring incomplete, errors occurred!
CMakeLists.txt:
(...)
IF (NOT MANYEARS_GUI_DISABLED)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTSVG TRUE)
SET(QT_USE_QTXML TRUE)
SET(QT_USE_QTSCRIPT TRUE)
SET(QT_USE_QTOPENGL TRUE)
SET(QT_USE_QTMULTIMEDIA TRUE)
find_package(QtMobility COMPONENTS MultimediaKit)
find_package(Qt4 4.8.0 QUIET)
if (QTMOBILITY_FOUND)
MESSAGE("QT_MOBILITY_INCLUDE_DIR : ${QTMOBILITY_INCLUDE_DIRS} QT_MOBILITY_LIB: ${QTMOBILITY_LIBRARIES}")
ENDIF (QTMOBILITY_FOUND)
if(QT4_FOUND AND (QT_QTMULTIMEDIA_FOUND OR QTMOBILITY_FOUND))
include(${QT_USE_FILE})
else(QT4_FOUND AND (QT_QTMULTIMEDIA_FOUND OR QTMOBILITY_FOUND))
MESSAGE("WARNING : ManyEars GUI will not be compiled because Qt4 not found or obsolete. You need Qt 4.8 or higher.Try using the latest QtSDK from http://qt-project.org")
MESSAGE("DEBUG: QT4_FOUND: ${QT4_FOUND} QT_MULTIMEDIA_FOUND: ${QT_QTMULTIMEDIA_FOUND} QT_MOBILITY_FOUND: ${QTMOBILITY_FOUND}")
SET(MANYEARS_GUI_DISABLED TRUE)
endif(QT4_FOUND AND (QT_QTMULTIMEDIA_FOUND OR QTMOBILITY_FOUND))
ELSE (NOT MANYEARS_GUI_DISABLED)
MESSAGE("ManyEars GUI disabled.")
ENDIF (NOT MANYEARS_GUI_DISABLED)
#Files excluded from package
set(CPACK_SOURCE_IGNORE_FILES
"build"
"bin"
${CPACK_SOURCE_IGNORE_FILES}
".svn"
)
#include files
(...)
IF (UNIX)
#########################################
# Packaging stuff for sources (All UNIX)
#########################################
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING.TXT")
SET(CPACK_PACKAGE_NAME "ManyEars")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ManyEars")
SET(CPACK_PACKAGE_VENDOR "Francois Grondin, Dominic Letourneau")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.TXT")
SET(CPACK_PACKAGE_CONTACT "blablablabla")
(...)
ENDIF(UNIX)
(...)
INCLUDE(CPack)
This is confusing me, shouldn't the OpenGL library be installed?
This is confusing me, shouldn't the OpenGL library be installed?
It's not complaining about OpenGL. It's complainting about Qt's OpenGL module QtOpenGL which is a different thing. Most likely your custom build of Qt doesn't include the QtOpenGL module. You've to go back building Qt and take extra care that you enable build of the QtOpenGL module.
After some research I found out that I needed to install some development packages if I was compiling from the source code.
apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev
When configuring the Qt source code I had forgot to specify that I wanted to install the OpenGL module and the Multimedia Kit. I just naturally ran "configure" without any options and hoped for the best.
./configure --help
Specifies that I needed -multimedia and -opengl.
When I executed configure with the correct options the issue was resolved.
./configure -multimedia -opengl
Note that the multimedia kit needs gstreamer installed.

Resources