Hello all -
I'm fairly inexperienced with Microsoft development tools, but have spent the past couple weeks working to compile libsbml with Microsoft Visual C++ Express 2008 and the Windows SDK for Windows Server 2008 and .NET Framework 3.5 on a Windows XP box.
I've used the Express Edition of MSVC because it's free, and I'm not a professional developer. There are some significant differences between the Express and Pro editions of MSVC.
It's been a very educational experience - perhaps my notes and experience as a newbie will be useful for updating the libsbml installation instructions, currently at http://sbml.org/Software/libSBML/docs/cpp-api/libsbml-installation.html
Here, step by step, is what I did to get a build of libsbml.dll on my Windows XP box, with a few comments following:
To build libsbml, I used the following binaries and sources:
bzip2 1.0.5 - http://gnuwin32.sourceforge.net/packages/bzip2.htm
libxml2 2.7.3 - http://www.zlatkovic.com/libxml.en.html
zlib 1.2.3 - http://www.zlatkovic.com/libxml.en.html
iconv 1.9.2 - http://www.zlatkovic.com/libxml.en.html
libsbml 4.0.0 - http://sourceforge.net/projects/sbml/files/libsbml/
(I used the libSBML-4.0.0-src.zip file)
Extract libSBML-4.0.0-src to the desktop.
(C:\Documents and Settings\bdh32\Desktop\libsbml-4.0.0-src for me)
Exctract the other libraries downloaded, and put them in the libsbml-4.0.0-src\
dir on the desktop, too.
So now the directory structure looks like:
Now we need to make some directories.
First, from \Desktop\libsbml-4.0.0-src\libsbml-4.0.0\win\batch-files, run createInclude.bat (apparently this gets automatically executed from some installations of MSVC, but I haven't done that yet).
Since "The DLL file for libxml2, Xerces, or Expat must be placed in the win32/bin subdirectory of the libSBML directory", (from the install docs), makethe directory \Desktop\libsbml-4.0.0-src\libsbml-4.0.0\win\bin, then:
copy libxml2.dll from
copy iconv.dll from
copy zlib1.dll from
You don't have to add an extra path to MSVC++ if do this with bzip2.dll, too:
copy bzip2.dll from
Next, from MSVC++ 2008 Express Edition, open project:
Select Tools->Options, and select Projectsand Solutions->VC++ Directories. The screen for indicating which directories contain project-relevant files appears.
At "Show Directories For:", select "Include Files". Add the following:
At "Show Directories For:", select "Library Files". Add the following:
(note: there is not a libsbml \lib directory)
First, we'll do a debug build to make sure it works. Under project properties, make sure the Configuration is "Active(Debug)". Secelct Configuration Properties -> C/C++ -> Code Generation and make sure that the Runtime Library is set to Multi-threaded Debug DLL (M/MDd).
Select Build -> Clean Solution from the Visual Studio main menu, then select Build -> Build Solution. The default object name is fine.
For me, the build succeeded with 77 warnings.
Since the debug build worked, next do the release build.
Under project properties, set the Configuration to "Release". Select Configuration Properties -> C/C++ -> Code Generation and make sure that the Runtime Library is set to Multi-threaded DLL (M/MD).
Select Build -> Batch Build. Click the box next to Release/Win32, and click "Clean", then select Build -> Batch Build, and click "Build".
As a result of this build, you should now have libsbml.dll and libsbml.lib in
libsbml seems to have library files in a different location than other open source projects -
libxml2, iconv, zlib, and bzip2 all have \lib files, but libsbml keeps them in \bin - that seems weird.
The way that libsbml requires users to assemble all the dependencies makes the build process very difficult and confusing for inexperienced users such as myself. Figuring out how to get them in the right locations and being able to compile and link with no errors took the bulk of my time. Since I couldn't find bzip2.dll for a long time, I removed the compression support from libsbml at one point, before getting this process to work. Perhaps there's a way to include the dependencies in the project file, or to use Windows SxS stuff (I know next to nothing about that) to link to .dlls that can be updated if underlying libraries change?
As for my progress towards being able to use the Yeastnet model for my research, I've now done a clean minimal install of Matlab R2009a (no toolboxes), so I'll be working to build translateSBML.mex32 next, and I'll share my experience with that if I get it working, too.