30/10/2014

Build Inkscape on Windows using MinGW (and a cygwin's bazaar)

Here are the notes I took this night while compiling Inkscape. They originally were writen as emails for the Inkscape devel list, but as they were many of them, I'll put them here and send a unique email to the list.

Just to be clear : pretty much everything in this post is not a fix for the issues I encountered, just a way to work around it in order to build Inkscape.

[Inkscape][Devel][Windows][Bazaar] Fetching source using Bazaar on Cygwin, no file fetched exceptinside .bzr folder
Hi everyone,

I just wanted to report some difficulties I add to fetch the source code of Inkscape using Bazaar on Cygwin and how I managed to go on anyway.
I'm pretty sure it's something trivial for a skilled bazaar user, but it wasn't painless for me to figure how to do, and I just want next random guy after me not having the same troubles.

What happened is that I simply followed the wiki how to that is located here
And after a few (dozens of) minutes of downloading, my local repository was empty... except for the .bzr folder.
No error happened and no error was logged anywhere.

bzr update
was only showing me something like
Tree is up to date at revision 13638 of branch ...

It looked like everything was alright, but I had no code to edit or compile. I finally figured out what happened through the
bzr status
command that led me to this error message :
bzr: ERROR: No WorkingTree exists for "file:///cygdrive/c/Donnees/home/InkscapeSource/inkscape/.bzr/checkout/

This led me to forums answers, that finally give me an explanation of the issue.
That was using :
bzr reconfigure --tree

I still had nothing but .bzr in my local folder, but this time a "bzr status" show me every single file as if they were deleted.
So I just had to
bzr revert *

I'm not sure if what happened to me was something unusual or linked to the fact I use Bazaar on Cygwin.
But I wanted this to be logged somewhere, as this may happen to someone else, that may not want to spent the few hours I spent to figure out what the matter was.

Cheers.

[Inkscape][Devel][Windows][MinGW] Compiling using mingw - as.exe cannot start
...
Now I have the sources and I try to build it using mingw.
The symptom is that this command line
g++ buildtool.cpp -o btool
is generating following error :
as.exe wasn't able to start ... 0xc0000022

This forum helped me to find this ticket.
It basically explain that the libiconv-2.dll library that was generated through the command :
g++ buildtool.cpp -o btool
is interfering with the one located in mingw environment.
So I just had to re-set my path to make it work
set PATH=C:/MinGW32bin;%PATH%

Additionally, it would be great to update the mingwenv batch file, in order to make c:/Devlibs to be located before c:/mingw in the path.

Cheers

[Inkscape][Devel][Windows][MinGW] Compiling using mingw - 'gettimeofday(timeval*, NULL)' is ambiguous
...
Next compilation error is :
buildtool.cpp: In member function 'virtual bool buildtool::Make::run(const String&)':
buildtool.cpp:10273:36: error: call of overloaded 'gettimeofday(timeval*, NULL)' is ambiguous
buildtool.cpp:10273:36: note: candidates are:
c:/mingw32bin../lib/gcc/mingw32/4.6.1/../../../../include/sys/time.h:39:29: note: int gettimeofday(timeval*, void*)
buildtool.cpp:84:12: note: int gettimeofday(timeval*, timezone*)

Which I trivially "solved" by editing buildtool.cpp and replacing :
::gettimeofday(&timeStart, NULL);
by
::gettimeofday(&timeStart, (timezone*)NULL);

Cheers

[Inkscape][Devel][Windows][Cygwin+MinW] Using bzr on Cygwin and MingW

Next compilation error is :
Make error line 0: executeCommand : could not create process : Le fichier spÚcifiÚ est introuvable.
Make error line 0: error executing 'bzr revno':

As I use MingW fr compilation but Bazaar on Cygwin, this may not be solved easily. I may have to install bazaar on Windows. For now I just faked a bzr.exe on windows that return the revision number at which I am. Here is the code :
#include <iostream>
using namespace std;
int main()
{
cout << "13638" << endl;
return 0;
}


Cheers

[Inkscape][Devel][Windows]Python] Python crash (Oxc0000022)

Next compilation error is a python.exe crash.
It appear that the used python is
c:/Devlibspythonpython.exe


Which doesn't start at all, even if launched separatedly by hand.
Fortunately I also had another python interpreter in my active PATH, so i just renamed it :
mv c:/Devlibspythonpython.exe c:/Devlibspython_python.exe


Cheers

[Inkscape][Devel][Windows][Python] New python issue "<cxxtestpart> problem:"

Next compilation error is :
Make error line 231: executeCommand : could not create process : Le fichier spécifié est introuvable.
Make error line 231: <cxxtestpart>, problem:

It appears this is the following of my previous python issue. If you grep python.exe inside files :
./build-x64.xml
./build.xml

You'll find multiple path where python interpreter path is absolutely referenced, I just changed them to my python.exe file.

Long term solution may be to make C++ compilation work with recent Mingw (that would carry a better python.exe), or to make the scripts able to use another python.
I'm not sure if one of those solution even would be possible to achieve.

Once this issue fixed, Inkscape is compiling but not linking.

[Inkscape][Devel][Windows][GetText] msgfmt crash
...
Now Inkscape is compiling, but not building yet. I got issues with msgfmt.:
##### compile gettext .po files to .mo
--- i18n / msgfmt
Make error line 421: <msgfmt> problem:

My way to "fix" the problem was to install a fresh version of gettext and libiconv for windows (from here)

And to make the path to point on this one before pointing on the C:/DevLibsbin one.

Hurray : it linked and it executes.

I'm still afraid of some patches I maid (especially if I look at this like this log :
--- distbase / copy
copy : c:/devlibs/python/python26.dll to inkscape
copy : 1 file copied
--- distbase / copy
copy : C:/Tools/python27/python.exe to inkscape/python
copy : 1 file copied)


But it linked and it executes.

Now I may start the fun part.

Cheers

Additional note about btool way to list the dep files (thanks to Failbit and JonCruz from irc://irc.freenode.org/#inkscape-devel )

When adding a cpp file :
- if you want btool to compile it, you may want to delete build.dep in src root and re-run btool
- if you want other OS's make system to be aware of it, you may want to add it (and .h too) in the folder's Makefile_insert

Makefile.am sources the Makefile_insert for each directory
then automake produces Makefile.in
then autoconf produces Makefile

Les commentaires sont fermés.