Compiling on Fedora 19, bypassing '-mwindows' error
Posted by Mossy on Jan 10, 2014; 4:47am
URL: http://piano-booster.139.s1.nabble.com/Compiling-on-Fedora-19-bypassing-mwindows-error-tp7572591.html
The latest Fedora and CentOS both have PianoBooster RPMs so it's easy to install and run. However, the SVN version supports keyboard lights and note duration so if you want to test those features, you will need to compile your own package. Here are my notes on compiling under Fedora 19.
First you need a bunch of development packages. Install with:
yum install -y svn cmake make automake gcc gcc-c++ kernel-devel qt-devel alsa-lib-devel mesa-libGL-devel
Here are the Debian/Ubuntu package equivalents for Fedora:
libqt4-dev = qt-devel
build-essential = make automake gcc gcc-c++ kernel-devel
libasound2-dev = alsa-lib-devel
Next, download the latest version from SVN:
cd /usr/local/src
svn checkout svn://svn.code.sf.net/p/pianobooster/code/trunk pianobooster-code
cd pianobooster-code/PianoBooster
cmake .
make
Everything will seemingly work fine until wham ... you hit the following error:
Linking CXX executable pianobooster
c++: error: unrecognized command line option ‘-mwindows’
make[2]: *** [build/pianobooster] Error 1
make[1]: *** [build/CMakeFiles/pianobooster.dir/all] Error 2
make: *** [all] Error 2
I googled up this code and found similar error reports from a Debian packager. Their research was this cmake file works fine for GCC 4.6 but requires some environmental variables for GCC 4.7. Unfortunately, Fedora 19 comes with GCC 4.8 and the 4.7 workaround fails for 4.8. On a random lark, I decided to search all the files for "-mwindows.txt" and simply remove it -- success!
So under Fedora 19, you will need this extra command:
sed -i 's/\-mwindows//g' build/CMakeFiles/pianobooster.dir/link.txt
Resume the process according to the build instructions and you're done:
make
make install
--- complete cut & paste compile instructions ---
yum install -y svn cmake make automake gcc gcc-c++ kernel-devel qt-devel alsa-lib-devel mesa-libGL-devel
cd /usr/local/src
svn checkout svn://svn.code.sf.net/p/pianobooster/code/trunk pianobooster-code
cd pianobooster-code/PianoBooster
cmake .
sed -i 's/\-mwindows//g' build/CMakeFiles/pianobooster.dir/link.txt
make
make install