CuteCash Question (MSVC)

Christian Stimming stimming at tuhh.de
Sat Apr 10 04:14:02 EDT 2010


Hi Martin,

Am Samstag, 10. April 2010 schrieb Martin Gill:
> I'm curious about cute-cash and I'm trying to build it.
> 
> I've fully built gnu-cash already (and had it running, so I know it
> works) and hopefully that means all dependencies are in place.

That's very good. This means all of the requirements should be in place 
already.

> I'm getting errors trying to configure cmake. I'm trying to generate for
>  VC2008.

As I wrote on the wiki page http://wiki.gnucash.org/wiki/Cutecash , I also 
succeeded in *building* with Visual Studio 2008. The result can also be 
started and you can play around with the GUI.

However, it does not yet work in a usable way: All file operations do not yet 
work due to some collisions of the file-related functions in the C runtime of 
the glib dll vs. those in the C runtime of the MSVC compiler. To fix this, 
quite some more work is needed where eventually all file-related calls into 
the C runtime are no longer being used via the glib DLL but instead are all 
directed into the MSVC C runtime directly.

> For the source path I have $GNUCASH_DIR\gnucash\repos\src which CMake
> seems to be happy with.

No, that's wrong - the source path must be $GNUCASH_DIR\gnucash\repos (the 
top-most directory that contains a CMakeLists.txt file).

> Not sure what I should set EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH
>  to.
> 
> EXECUTABLE_OUTPUT_PATH = $GNUCASH_DIR\inst\bin
> LIBRARY_OUTPUT_PATH = $GNUCASH_DIR\inst\lib
> 
> CMAKE_INSTALL_PREFIX  I set  a new (empty) directory.
> CMAKE_BACKWARDS_COMPATIBILITY i left at the value 2.4 CMake set it to.

These can all be left alone. For building (and running) cutecash, they are 
irrelevant for now.

For a VS2008 build, you will have to set several other variables concerning 
include paths (because the automatic lookup will fail for all of them). Some 
of them have their own directory in the install.sh build tree, others are 
mostly in the $GNUCASH_DIR\gnome subdirectory. Some examples and the settings 
which you probably need:

PKG_CONFIG_EXECUTABLE=$GNUCASH_DIR\gnome\bin\pkg-config
LIBXML2_INCLUDE_DIR=$GNUCASH_DIR\gnome\include
LIBXML2_LIBRARIES=$GNUCASH_DIR\gnome\lib\libxml2.lib
LIBINTL_INCLUDE_PATH=$GNUCASH_DIR\gnome\include
LIBINTL_LIBRARIES=$GNUCASH_DIR\gnome\lib\libintl.lib (or some similar .lib 
filename)
REGEX_INCLUDE_PATH=$GNUCASH_DIR\regex\include
REGEX_LIBRARY=$GNUCASH_DIR\regex\lib\regex.lib (or some similar .lib filename)
HTMLHELP_INCLUDE_PATH=$GNUCASH_DIR\hh\include

For VS2008, there's one additional issue which might need manual intervention: 
On Windows, for any required DLL that should be linked into cutecash, the MSVC 
compiler/linker wants several files to exist. Namely, not only the DLL should 
exist (such as regex-0.DLL), but additionally an "import library" that fits to 
that DLL must exist. The filename of that import library has the suffix .LIB. 

(Caveat: This is the same filename suffix which MSVC static libraries have, 
but in our case we don't have any MSVC static libraries in the gnucash 
dependency tree anyway. The mingw/gcc compiler behaves differently here: gcc 
doesn't need the import library but directly uses the dll regex-0.DLL when 
linking. Nevertheless such "import libraries" are supported in mingw/gcc, but 
they have the suffix ".dll.a.", whereas a pure mingw/gcc static library has 
the suffix ".a". So gcc doesn't suffer from this filename confusion.)

The point is: If you have run the install.sh script, you will have all 
required DLLs at hand, but maybe some of their MSVC import libraries are still 
missing. But mingw comes with the tools to build those MSVC import libraries 
by hand, in case they are not already there. I inserted some commands in the 
script to build some of those needed MSVC import libraries, but I might have 
forgotten some of them as well.

For example, for the libguile.DLL the MSVC linker needs a suitable import 
library named libguile.LIB. I've added commands in the install.sh script so 
that for the DLL $GNUCASH_DIR\guile\bin\libguile.dll an import library 
$GNUCASH_DIR\guile\lib\libguile.lib is built.

If you encounter any of the FOO_LIBRARIES variables in the cmake where you 
cannot find a suitable libFOO.lib anywhere, you might need to build it 
yourself by running the following commands on the mingw command line (example 
for libguile):

  cd $GNUCASH_DIR/guile
  pexports /bin/libguile.dll > lib/libguile.def
  dlltool lib/libguile.def -D bin/libguile.dll -l lib/libguile.lib

which gives you the libguile.lib file that MSVC needs.

These instructions should be sufficient to get 1. a VS2008 project file, 2. 
compiling everything, 3. linking everything successfully.

> The final (and seemingly the blocking issue) is this error message:
> 
> CMake Error at core-utils/CMakeLists.txt:18 (GNC_ADD_SWIG_COMMAND):
>   Unknown CMake command "GNC_ADD_SWIG_COMMAND".
> 
> No idea how to resolve this (very little experience with CMake)

The error will disappear once you select the top-most directory as source 
directory, because in that CMakeLists file, this (and other) additional "CMake 
command" will be defined.

> I did set USE_CUTECASH=yes in the custom.sh and I notice it downloaded
> cmake, but didn't seem to trigger anything. Should I be doing
> something with the downloaded cmake instead?

No, this was just a first try to integrate a cutecash build into the scripted 
win32 build, but I didn't continue on this work, so currently it only 
downloads cmake but does nothing more.

Regards,

Christian


More information about the gnucash-devel mailing list