Windows build - mscore\CMakeLists.txt

• Sep 20, 2012 - 20:49

MuseScore (Git) did not build under Windows 7 at my PC. I found a construct in the mscore\CMakeLists.txt file that appears wrong and correcting it solved my build problem.

In the HAS_AUDIOFILE section for MINGW there's the following construct (in mscore\CMakeLists.txt):

if (HAS_AUDIOFILE)
      target_link_libraries(mscore libsndfile-1)
endif (HAS_AUDIOFILE)

but it should be sndfile-1 instead of libsndfile-1? Analogue to the rest of the target_link_libraries declarations, hence as follows:

if (HAS_AUDIOFILE)
      target_link_libraries(mscore sndfile-1)
endif (HAS_AUDIOFILE)

Comments

Somehow this is hard to beleive, that line is in there since at lesst 26May2012 (as per 'git blame') and we had numerous nightly builds since?

In reply to by [DELETED] 5

In an earlier attempt I did have a problem with cygwin (it was in my path at the front and got executed first). But I've removed cygwin from my path completely and followed instructions at Compile instructions windows mingw git"

And I'm using a command prompt window started via Qt 4.8.1 for Desktop (MinGW), which is provided by installed Qt SDK.

{syntaxhighlighter brush: shell}PATH=C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin;...
QTDIR=C:\QtSDK\Desktop\Qt\4.8.1\mingw

D:\Development\MuseScore>gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,jav
a,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enabl
e-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enab
le-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root
--with-mpfr=/mingw/src/mpfr/root --build=mingw32
Thread model: win32
gcc version 4.4.0 (GCC) {/syntaxhighlighter}

In reply to by mdonkers

I tried to compile with your modification (remove the lib) and it links successfully as well. I believe CMake is doing some kind of resolution of the library name, testing if it can find it with or without the lib prefix. Which version of CMake are you using?

I will push the fix to align libsndfile with the other target_link_libraries calls.

In reply to by [DELETED] 5

I've started from scratch with setting up a MuseScore build environment and have downloaded the latest CMake version.

Versions info:
{syntaxhighlighter brush: shell}D:\Development\MuseScore>cmake -version
cmake version 2.8.9

D:\Development\MuseScore>qmake -version
QMake version 2.01a
Using Qt version 4.8.1 in C:\QtSDK\Desktop\Qt\4.8.1\mingw\lib

D:\Development\MuseScore>mingw32-make -version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32{/syntaxhighlighter}

Thanks for the fix push.

Hi!
I have cloned current version of MuseScore and try to build it with Qt_Creator (Qt 5.5) in Windows 8.1 according compile instructions at https://musescore.org/en/developers-handbook/compilation/compile-instru…
I have correctly set PATH and done
3. Copy include\sndfile.h into C:\Qt\Tools\mingw492_32\i686-w64-mingw32\include
4. Copy bin/libsndfile-1.dll into C:\Qt\Tools\mingw492_32\lib

Compiling was Ok, but linking failed with "cannot find -lsndfile-1" error:
[ 52%] Linking CXX executable MuseScore.exe
C:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsndfile-1
collect2.exe: error: ld returned 1 exit status
mscore\CMakeFiles\mscore.dir\build.make:5814: recipe for target 'mscore/MuseScore.exe' failed
mingw32-make[2]: *** [mscore/MuseScore.exe] Error 1

Can anybody give a hit, please, how to solve the problem?
- this my first experience with Qt Creator and MuseScore.

In reply to by Jojo-Schmitz

Thank you!
By the way in Qt-addition-5 is also mingw492_32 directory as in Qt 5.5 version.
And I'm sorry, it was my fault - I have copied libsndfile-1.dll to the wrong place.
Now linking with qt 5-5 is successful.
1. But when I "start Debugging" in QtCreator I get "During startup program exited with code 0xc0000135" error.
2. And when I just start builded MuseScore.exe - it starts and show some error messages in debug windows - see image attached.

Ok, let's now start with Qt 5.4
3. Get qt-opensource-windows-x86-winrt-5.4.2.exe and qt-opensource-windows-x86-mingw491_opengl-5.4.2.exe from here http://download.qt.io/archive/qt/5.4/5.4.2/
4. install them
5. merge both installation
6. successful buld with QtCreator

7.Then "start debugging" - again with error "During startup program exited with code 0xc0000135"
8. Simple start MuseScore.exe with error 0xc000a200

So my build with Qt 5.5 is a bit better :-)
Any suggestions?

Attachment Size
5-5_start.JPG 210.81 KB

In reply to by Jojo-Schmitz

Another step ahead :-)
I suppose that something was wrong with my Qt 5.4 installation.
Now I've reinstalled both 5.5 an 5.4 versions using online installer qt-unified-windows-x86-2.0.2-2-online.exe, set 5.4 as current version, successfully built MuseScore with QtCreator and ran it.
I've found that MS doesn't play sound, I suppose because of errors:
1. Debug: Init midi driver failed ...
2. Debug: Fluid: sf not found ...

Then I started Plugin Manager - yes, with empty window.
Then I added plugins folder with test plugin, start Plugin Manager again and got errors with program crush:
- - -
3. Warning: QQmlComponent: Component is not ready (:0, )
4. Debug: creating component <.../plugins/test_qml.qml> failed ...
5. Debug: line 1: module "QtQuick" is not installed ...
Fatal: ASSERT failure in QList::operator[]: "index out of range", ...
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Open error: is JACK server running?
Debugging has finished
- - -

Can anybody give me a hint - how to solve problems 1-5?
(see details in MS_log1.txt)

Attachment Size
MS_log1.txt 21.11 KB

In reply to by Jojo-Schmitz

Thank you lasconic , thank you Jojo-Schmitz
Yes, we need to read attentively: "
- Click Projects at left, then Build toward the top of the screen.
- Under Build Steps, expand the Details button and add a checkmark next to the lrelease target.
- Then go back to the top of the screen and click Run.
- On this screen, you will first need to click Add Deploy Step.
- Select Make, then select install under Targets.
- Finally, you will need to click the Add button under Run Configuration to add a custom executable, and set it to %{sourceDir}\win32install\bin\MuseScore.exe." (end Quote)

But my last mistake was that I ignored the recommendation “choose a build directory of MuseScore/build.qtc instead” for Cmake parameters :-)

Now I successfully use QtCreator's debugger for MuseScore investigation.

Do you still have an unanswered question? Please log in first to post your question.