Build Inkscape with Microsoft Visual Studio?

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
SaGS

Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Mon Jul 28, 2008 10:51 pm

Is it possible to build Inkscape from source, on Windows, using MS Visual Studio or MS Visual C++ Express? Any ready-made ‘VS solution/ project’ anywhere? Any walkthrough on creating one (since I don't even know which files should be included - some may be specific to non-Windows platforms)?

Simarilius
Posts: 626
Joined: Wed Jun 06, 2007 2:37 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby Simarilius » Tue Jul 29, 2008 8:23 am

Just out of curiousity, but why do you need to? The mingw build setup works out of the box without any issue. What advantage does Visual Studio add?

SaGS

Re: Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Tue Jul 29, 2008 6:08 pm

Simarilius wrote:Just out of curiousity, but why do you need to?

  • I already have VS installed, I’m used to it, and I use it for everything else.
  • I’m not the type of guy that adds/ removes programs, for minor reasons, every day; I prefer to continue using the ones I already have.
  • Maybe I’m wrong, but the ‘out of the box’ build forces me to put some things in specific C:\ETC directories. It’s a bad idea, not to mention that none of my drives has a letter ‘C:’. (I know, I know, I can create one, but it’s still wrong…)
  • Ah, and the Express editions are free too (not open source, not redistributable, but cost-free).
All I wanted is to test a 1-line fix to a bug I found, before submitting a bug report (with the suggested fix attached to it). The other day I wanted to do a small fix to some other software built with SharpDevelop (and witch could not be compiled with VS either). Tomorow I may find something that needs yet another IDE/ compiler/ toolchain etc. I simply do not want to install each and every developement tool. If testing Inkscape means I have to install a completely new set of tools, add/ change drive letters, etc, I’ll have to pass.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Build Inkscape with Microsoft Visual Studio?

Postby microUgly » Tue Jul 29, 2008 6:33 pm

I'm sorry if I'm taking this off track, I haven't touched a programming application since using Turbo C++ at university. I'm only just now becoming familiar with the term "IDE" as I've started using NetBeans for PHP development (previously I had used Dreamweaver, but Netbeans is far superior and free!). So, I know I can use NetBeans to contribute to Inkscape--it depends on an external compiler of your choosing and really it's just a glorified text editor. How does MS Visual C++ differ from an IDE? Is it doing something different? I mean does it take regular C++ code and compile it? I assume nothing would stop you from writing the code in Visual C++ and compiling it with a different compiler, except that Visual C++ might encourage you to use methods not accessible outside to non Visual C++ compilers?

Guest

Re: Build Inkscape with Microsoft Visual Studio?

Postby Guest » Tue Jul 29, 2008 7:44 pm

microUgly wrote:So, I know I can use NetBeans to contribute to Inkscape--it depends on an external compiler of your choosing and really it's just a glorified text editor. How does MS Visual C++ differ from an IDE? Is it doing something different? I mean does it take regular C++ code and compile it? I assume nothing would stop you from writing the code in Visual C++ and compiling it with a different compiler, except that Visual C++ might encourage you to use methods not accessible outside to non Visual C++ compilers?

Visual Studio includes a complete set of tools, editor/ compiler(s) for C/C++, C#, VB (up to VS2005 it also included J#)/ debugger/ integrated help/ etc. Yes, it does have a project type (‘makefile project’) that can use external tools. But that means I still need to install all those ‘other’ tools, and I really hate to install all developement tools in existence simply because now and then I stumble against a small bug in some open-source software. Also, if those external tools are too different (syntax of error messages, etc), I cannot use some IDE features like automatically going to the source code that has compile errors, and cannot (or bearly can) use the integrated debugger.

SaGS

Re: Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Tue Jul 29, 2008 7:52 pm

Guest wrote:
(I apologize, in the the previous post I forgot to fill-in the nickname.)

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby sas » Tue Jul 29, 2008 10:51 pm

SaGS wrote:Maybe I’m wrong, but the ‘out of the box’ build forces me to put some things in specific C:\ETC directories.

I think you can put them where you like - the supplied mingwenv.bat file assumes certain directories, but you can always use others.

All I wanted is to test a 1-line fix to a bug I found, before submitting a bug report (with the suggested fix attached to it).

I don't think it's worth trying to build Inkscape just for that, especially if you want to avoid the standard build process. Just submit the bug report with the patch, and say that you haven't tested it.

Simarilius
Posts: 626
Joined: Wed Jun 06, 2007 2:37 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby Simarilius » Thu Jul 31, 2008 3:19 am

SaGS wrote:
Simarilius wrote:Just out of curiousity, but why do you need to?

  • Maybe I’m wrong, but the ‘out of the box’ build forces me to put some things in specific C:\ETC directories. It’s a bad idea, not to mention that none of my drives has a letter ‘C:’. (I know, I know, I can create one, but it’s still wrong…)


The build setup assumes some C:\ folders as defaults, but you change about 2 variables in the setup folders and you can put stuff where ever you want.

SaGS wrote:All I wanted is to test a 1-line fix to a bug I found, before submitting a bug report (with the suggested fix attached to it). The other day I wanted to do a small fix to some other software built with SharpDevelop (and witch could not be compiled with VS either). Tomorow I may find something that needs yet another IDE/ compiler/ toolchain etc. I simply do not want to install each and every developement tool. If testing Inkscape means I have to install a completely new set of tools, add/ change drive letters, etc, I’ll have to pass.


I'm not saying you cant use the ide, I just wouldnt use the compiler. all of the libs we use have been compiled with mingw and I'm not sure how nicely MS compiler code plays with mingw dlls. Unless you plan on building all the libs too I'd think its easier to download the build bundle if you want to compile. Its worth pointing out its not an install par se either, its just a folder on your drive. No registry etc, if you want to get rid you just delete it.

SaGS

Re: Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Thu Jul 31, 2008 11:11 pm

I looked more into the sources and into how the standard build works, and building Inkscape with the native VC++ tools seems an almost impossible task.

Things that don't seem to be blockers:
  • I think it’s possible to use btool.exe as a make tool, and change build*.xml to invoke the VC++ command-line compiler/ linker/ librarian. There is however msgfmt that has no equivalent. Don't know it there are any other such cases.
  • Fixed directories: there are hard-coded paths in mingwenv.bat and build*.xlm, but maybe that's all.
Things that may be blockers, and theoretically could be solved by rebuilding all dependencies with VC++ (a huge task):
  • File formats for libraries: not sure if those built with mingw can be read by VC++.
  • Compiler-specific helper functions that may be needed by static libraries (not sure if all libraries are import libraries or not).
  • Calling/ naming conventions used by the functions in the DLLs.
Things that may be blockers in the source code:
  • Compiler-specific stuff (pragmas and others); like the includenext thing I remember having seen in some Linux sources (not Inkscape).
And the worst of all, an Absolute Blocker:
  • Source code uses variable lenght arrays, which VC++ doesn’t support (not sure about VS2008, though).

Anyway, in the end I did the ‘standard build’ in a virtual machine. It was a pain, and NO, it doesn’t work at all ‘out of the box’, but in the end I sorted it out. My patches seem OK, and I filed them.

Thanks everybody for their time and help.

Simarilius
Posts: 626
Joined: Wed Jun 06, 2007 2:37 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby Simarilius » Fri Aug 01, 2008 7:03 am

It was a pain? Please do elaborate cos it really shouldnt be, and if it is we want to know so we can fix it.
It should be 2 zips to download and extract, 1 or 2 files to edit paths in if your using non defaults, and then compile.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Build Inkscape with Microsoft Visual Studio?

Postby microUgly » Fri Aug 01, 2008 7:32 am

Thanks for taking the time to describe what you discovered about trying to use VC++. It may save someone else the trouble.

SaGS

Re: Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Fri Aug 01, 2008 7:34 pm

Simarilius wrote:It was a pain? Please do elaborate cos it really shouldnt be, and if it is we want to know so we can fix it.

Well, here is it, from memory.

I used the compiler and dependencies recommended on the inkspace.org site: devlibs-2.12-080417.7z and mingw-4.2.1-071022-dw2.7z.

To avoid the problem with hard-coded paths, I created a new directory and used subst to assign it a drive letter of C:. Then I worked there.

1st attempt: with the 0.46 sources from the ‘official’ *.tar.gz:

  • Decompressed the sources with StuffIt Expander 9. It asked wheather to rename or overwrite a few files. Not sure why, maybe some files, placed in the same directory, have names that differ only in case, which Windows does not allow. I chose to rename and did not care much, because these were buried under packging\macosx.
  • Instructions start with ‘run mingwenv.bat’. Oups, there’s none! So I got one from the SVN repository.
  • Built btool.exe, OK.
  • Ran btool.exe. It compiled a buch of files, then failed with some very strange compilation errors.
At this point I though maybe I’ll have more luck with the sources from the SVN repository. I’ll come back to those misterious compilation errors later.

2nd attempt: with a svn checkout from the 0.46 RELEASE branch.

  • Ran mingwenv.bat (OK! it’s there), built btool.exe and ran it, all seems OK.
  • Created the installer, OK.
  • Did a test install, seems OK, but...
  • At the end of the install, it offers to run Inkscape. Left that option checked, but nothing happened. Ctrl+Alt+Del, maybe it’s taking a lot of time to start - nothing inthere either. When I tried to run it from the menu, it didn’t start, but Windows told me why: libpoppler-3.dll was not to be found. Investigating, I found that build[-dw2].xml cites libpoppler-2.dll, not 3.
  • After editind these files, and redoind the build, I got a good installer.
Follow-up to the 2nd attempt:

When I made the installer, I noticed a directory with patches. At first, I thought these are already applied, because the installer was named ‘0.46-1’ (not simply ‘0.46’), but they weren’t.
  • Applied those patches, and ran btool,exe again.
  • It compiled some files OK (they are newer, being touched by patch), but the linker failed with ‘unresolved reference ‘is_os_vista’).
I got good results without the patches, so I abandoned the attempt to build a ‘patched’ version.

3rd try: with a SVN checkout from the SVN TRUNK.

  • btool.exe stopped at the very beginning, not finding ‘gst’ or ’gts’ (don’t remember for sure). Maybe the recommended dependencies are not enough for the current (2008/7/31) TRUNK.
So I abandoned this attempt too.

Now, back to the reason for the misterious compile errors in the 1st attempt:

In the mean time, I learned that btool.exe tries to compile all *.cpp files (with some exceptions listed explicitely). When I decompressed the official *.tar.gz, I got subdirectories named PaxHeaders.3558 everywhere. These contain files with same names (including many with a cpp extension) as the ‘normal’ directory it is attached to, the contents of those seeming to be extended file info (like creation and last access time). Btool tried to compile those *.cpps too, and of course this failed. Maybe it’s just StuffIt that creates these directories, but I use it for a long time and have never seen this before.

After removing all those rogue directories, the build went fine. Except the problem with including libpoppler-2.dll instead of libpoppler-3.dll, which exists in this version too...

Guest

Re: Build Inkscape with Microsoft Visual Studio?

Postby Guest » Fri Aug 08, 2008 9:13 pm

A few more info about the build failures, after more investigation:

About the ‘rename or overwrite’ during the unpacking:
WinRar allows to view the contents without unpacking (StuffIt Expander does not), and indeed shows same-named files and files who’s names differ only in case.
Workaround: none needed on Windows, I think, because the affected files seem to be for Macs only.

About the ‘PaxHeaders.3558’:
These directories actually exist in the *.tar.gz (shown by WinRar), apparently created by some tool (‘pax’?) in an attempt to store more detailed information about the contained files. Tools that don’t know what are these for do the most sensible thing they can do with them: unpack as regular folders/ files. But because of the way btool.exe works, these extra files cause the build to fail.
Workaround: delete all these extra directories.

About the ‘libpoppler-2.dll versus libpoppler-3.dll’ problem:
Editing build.xml to include the needed ‘...-3.dll’ instead of ‘...-2.dll’ seems, at 1st glance, to work, but it doesn’t. Doing so, Inkscape runs OK in general, but crashes when importing PDFs. The distributed 0.46 release binary includes ‘...-2.dll’ and does not crash. Maybe the dependencies (namely the applicable lib) are ‘too up-to-date’ for the 0.46 branch?

About the failure to build the TRUNK
The error is about not finding ‘c:\devlibs\lib\pkgconfig\gsl.pc’ (not ‘gst’, neither ‘gts’), and indeed there's no such file. Maybe the dependencies are ‘not enough up-to-date’ for the TRUNK (as of 08/08/08)?

SaGS

Re: Build Inkscape with Microsoft Visual Studio?

Postby SaGS » Fri Aug 08, 2008 9:15 pm

Guest wrote:
A appologize, in the previous post I forgot (again) to fill-in the nickname…

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby sas » Fri Aug 08, 2008 10:31 pm

Maybe the dependencies are ‘not enough up-to-date’ for the TRUNK (as of 08/08/08)?

Based on what you said earlier, I think you were using an out-of-date devlibs. The latest version of devlibs is devlibs-2.12-svn-0805081735.7z, and this needs updating (by doing an SVN update on it) before use.

Perhaps someone could update the wiki page to make this clearer.

bbyak
Posts: 64
Joined: Sun Oct 07, 2007 4:53 am

Re: Build Inkscape with Microsoft Visual Studio?

Postby bbyak » Fri Aug 29, 2008 2:52 pm

Right now we have devlibs in SVN. You just check them out and do svn update every time you update inkscape source, this way they are always in sync.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Build Inkscape with Microsoft Visual Studio?

Postby microUgly » Tue Sep 09, 2008 2:15 pm

bbyak wrote:Right now we have devlibs in SVN. You just check them out and do svn update every time you update inkscape source, this way they are always in sync.

What's the path? I can't find them.


elecman
Posts: 27
Joined: Mon Feb 09, 2015 1:39 pm

Re: Build Inkscape with Microsoft Visual Studio?

Postby elecman » Thu Mar 05, 2015 9:58 pm

It is finally possible to debug Inkscape using Visual Studio:
http://wiki.inkscape.org/wiki/index.php ... ual_Studio


Return to “Discuss Software Issues”