Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you build Xalan-C with Visual Studio 2010?

I can not find proof that it's possible. After 40 hours of driving myself to insanity, I'm left with a situation where I cannot build the Localization project that supposedly builds a header file needed by the poorly named AllInOne project (which builds Xalan-C.lib, natch).

This library is software malpractice writ-large, I am desperate for an answer because it is a dependency in another library that I have no alternative to using.

like image 979
Rhubarb Avatar asked Dec 01 '25 05:12

Rhubarb


1 Answers

I have managed to build Xalan-C version 1.11, compatible with the latest version of Xerces-C (v3.1.1), in Visual Studio 2010. I don't know if it is possible with earlier versions, however these are the steps I followed in order to build with version 1.11:

  • Xerces-C has to be built as a dynamic library to obtain the xerces-c_3_1D.dll file which MsgCreator.exe is dependent on.

  • Clone the github repository to obtain the source code of Xalan-C version 1.11.

  • Set the environment variables XERCESCROOT and XALANCROOT in windows (not in Visual Studio).

     XERCESCROOT    The Xerces-C/C++ installation directory
     XALANCROOT     The Xalan-C/C++ source directory
    
  • Open the Xalan-C solution in VS2010 and build the MsgCreator project.

  • Copy the xerces-c_3_1D.dll file from the Xerces-C build and place it in the Xalan-C build folder, the same folder where MsgCreator.exe is located.

Now it is possible to generate the "missing" header files (LocalMsgIndex.hpp and LocalMsgData.hpp) that are needed to build the "AllInOne" project.

  • Run MsgCreator.exe in cmd with the provided path to XalanMsg_en_US.xlf which is located in $(XALANCROOT)\src\xalanc\NLS\en_US and what method to use when building the locale messages.

    MsgCreator.exe $(XALANCROOT)\src\xalanc\NLS\en_US\XalanMsg_en_US.xlf -TYPE=inmem
    

(I used -TYPE=inmem, but check to see what method is best suited for your solution)

  • The header files are now generated and located in the build directory (where MsgCreator.exe resides). Copy or move them to $(XALANCROOT)\src and they should now be able to be located.

  • Now build the XalanMsgLib project.

  • And the last thing to do before the final build is to handle the including of afxres.h in the AllInOne.rc file (located in $(XALANCROOT)\Projects\Win32\Res\AllInOne). Visual Studio Express edition does not contain the MFC library which contains the afxres.h header. I simply changed it to #include "windows.h" instead.

And now it should be possible to build "AllInOne" successfully.

like image 175
w1nston Avatar answered Dec 05 '25 04:12

w1nston



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!