Emerge adventure with mingw - 11 issues 10 solutions

Antton Tapani antton.tapani at gmail.com
Thu Jul 30 13:11:19 UTC 2015


I've been trying out emerge for the first time with varying rates of
success, so I thought I'd document my progress. I use master branch
(22.7.2015 [dmy]) as it seems to be recommended judging by discussion on
the web, and by the fact that I was unable to run any other branch that I
tried (python errors or errors during kdeenv setup). My final goal is to
build Krita with mingw-w64 (against all recommendations, apparently), but
in this instance I'm happy to just get the dependencies compiled. I have
yet to actually run anything, so even if these fixes make the compiler
happy, there's no guarantee that they actually work. If some other branch
is supposed to be more functional, I may have just messed up the initial
setup with them.

I got some problems with the powershell script, and the guide I was using
failed to mention that the powershell bits are actually optional. There's
also a bat version. I managed to run the ps1 script once but later it just
kept crashing during the env setup. I didn't look into it further after
discovering the bat. Just a heads-up that the bat may be a comfier option.

----emerge qt----
1.  A lot of the sourceforge links are no longer valid. Most links are
forwarded automatically to new location, but some return 404. Easy to fix
manually, but somewhat confusing initially.
2.  Websites may be down momentarily, causing some confusion whether a link
is dead or not. I wasted some time trying to sort out activeperl, when it
wasn't really broken.
3.  Openssl-1.0.2c is no longer available. Apparently emerge is happy if
the new version number is added to the list and default target changed.
4.  Mysql download fails. cdn.mysql.com does not work anymore. Changed
basepath to dev.mysql.com
5.  qt defaults to ANGLE+directx sdk. Failing that, it disables angle with
a warning that build will most likely fail; continue? Added "-opengl
desktop" to download\git\qtbase\configure.bat to force full opengl.
6.  Apparently building qtwebkit can randomly fail with "No such file or
directory" errors. Simply trying again fixes this. It's also possible that
the installation can fail silently. See point 9 further down.

I also found it strange that msys gave a big framed warning that shell must
be restarted before continuing after first run. Then there was a prompt for
continue yes/no. I was not present at the time so it happily defaulted to
yes and soon crashed with some cryptic error (which I forgot to note down).
This apparently left msys dysfunctional and it had to be reinstalled
manually*1) [1]

----emerge frameworks----
(calligra guide [2] suggests emerging kdelibs, but this doesn't seem to
exist anymore. I'm assuming there's something equivalent in frameworks)
7.  Building kdoctools fails. Added colon ':' to the list of escaped
characters in download\git\kdoctools\cmake\uriencode.cmake [3]
8.  win32libs/gpg-error fails with a whole bunch of errors such as this:
error: expected expression before ',' token
   { , "GPG_ERR_E2BIG" },
This is apparently caused by differing behaviour in gcc-5 compared to
earlier versions. Suggested fix [4] is to add compiler flag -P via
libgpg-error-x.xx\src\Makefile.am. This stumped me for  some time, because
I didn't realize that this is an automake file which is not used by cmake.
In our case the flags go to
emerge\portage\win32libs\gpg-error\libgpg-error-cmake-1.12.diff to the
generation calls for mkerrcodes.h and mkw32errmap.tab.h at lines 113 and
115 after the -E flags *2). There is a similar recent fix to this on this
mailing list, but that didn't show up in searches while I was dealing with
9.   kdewebkit build failed, claiming that qtwebkit is not installed
(missing cmake files in lib\cmake). This may relate to the random build
fail of qtwebkit at point 6. I did a full rebuild with "emerge -i
qtwebkit". After this, kdewebkit built successfully.
10.  khtml fails with "conflicting declarations" errors. There are two
time.h files visible in include\mingw and
mingw64\x86_64-w64-mingw32\include. I couldn't figure this one out, so I
just removed the include\mingw one while building khtml, and then put it
back. Probably not the best of ideas.
11.  Kross fails with errors:
CMakeFiles\metafunctiontest.dir/objects.a(metafunctiontest.cpp.obj): In
function `Kross::MetaFunction::~MetaFunction()':
q:/kross/src/core/metafunction.h:128: undefined reference to
q:/kross/src/core/metafunction.h:128: undefined reference to
CMakeFiles\metafunctiontest.dir/objects.a(metafunctiontest.cpp.obj): In
function `Kross::MetaFunction::MetaFunction(QObject*, QByteArray const&)':
q:/kross/src/core/metafunction.h:60: undefined reference to
collect2.exe: error: ld returned 1 exit status
Resulting from the call:
r:\mingw64\bin\g++.exe   -std=c++0x -fno-exceptions -Wall -Wextra
-Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long
-Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual
-Werror=return-type -O2 -g -DNDEBUG  -mwindows -Wl,--whole-archive
CMakeFiles\metafunctiontest.dir/objects.a -Wl,--no-whole-archive  -o
(I understand this is not enough debugging information, but hopefully
someone already has a solution off the cuff)

And this is where I'm stumped. I tried to debug this over a couple of days,
and this goes a bit over my head. This was a fun excursion, and I'm going
to leave it at that for now. I'll post a part2 if I ever get around the
last one and the ones that inevitably emerge after it. Do tell me if some
other branch is more functional and mingw friendly. I may have done
something wrong to start with.
*1) msys fix for the error: make: command not found [1]
run msys.bat (in \emerge\portage\dev-util\msys)
call pacman -Syu
confirm all prompts
run autorebase.bat (in \msys )
call pacman -S base-devel
select all whem prompted
start a new command prompt for kdeenv. The bats add some env variables that
may mess up emerge

*2) example fix for libgpg-error-cmake-1.12.diff  (don't copypaste, may
mess up the patch)
+add_custom_command(OUTPUT ${BIN_DIR}/mkerrcodes.h  COMMAND
${AWK_EXECUTABLE} -f ${SRC_DIR}/mkerrcodes1.awk ${SRC_DIR}/errnos.in >
+                                                   #COMMAND set
+                                                   COMMAND ${ERR_COMPILER}
-E -P ${BIN_DIR}/_mkerrcodes.h ${NULL_DEVICE} | "\"${GREP_EXECUTABLE}\""
"\"${AWK_EXECUTABLE}\"" -f ${SRC_DIR}/mkerrcodes.awk >
+add_custom_command(OUTPUT ${BIN_DIR}/mkw32errmap.tab.h COMMAND
${NULL_DEVICE} | "\"${GREP_EXECUTABLE}\"" \"{&mkw32errmap_marker\" >

[1] https://bugs.kde.org/show_bug.cgi?id=329856 (msys)
[2] https://community.kde.org/Calligra/Building_Calligra_on_Windows
[3] https://bugs.kde.org/show_bug.cgi?id=348061 (doctools)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-windows/attachments/20150730/04e52046/attachment.html>

More information about the Kde-windows mailing list