You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Lars Uffmann <la...@dlr.de> on 2008/01/08 14:06:59 UTC

Problem building Xerces 2.8.0 under Cygwin / Windows

Hi everyone!

After downloading the newest Xerces Source from xerces.apache.org, 
extracting it and following the instructions at
http://xerces.apache.org/xerces-c/build-winunix.html#CygWin
I managed to do the steps:
    $ XERCESCROOT = /home/lars/xerces-c-src_2_8_0/src/xercesc/
    $ export XERCESCROOT
    $ ./runConfigure -p cygwin -c gcc -x g++

successfully in my cygwin environment (no error messages from 
runConfigure), but then failed on
    $ make

at this point:
 >>>
make -s -C parsers
   (CP)  /home/lars/xerces-c-src_2_8_0/src/xercesc//include/xercesc/parsers
   (C++) AbstractDOMParser.o
AbstractDOMParser.cpp:46:44: xercesc/dom/impl/DOMAttrImpl.hpp: No such 
file or directory
 >>>

A lot of "No such file or directory" messages followed, causing the make 
to fail. As you can see, the include path is not complete, so I suppose 
it looks for the directory xercesc in /usr/include/ - now HOW do I 
configure and make xercesc in a way that all the libraries and headers 
are put in the correct locations (namely /usr/include/xercesc/)?
Or do I simply copy them there?

Any help appreciated!

    Lars

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Lars Uffmann <la...@dlr.de>.
David Bertoni wrote:
> --bindir might work, but I've never tried it before.  On the other hand, 
> I'm not sure you want to copy a bunch of executables there.  Why don't 
> you just modify the path?
Actually I was not making myself clear :) I didn't wanna copy the 
executables there, just the dynamic link libraries. And yes, modifying 
the path would work, I suppose - if I make sure all new 
packages/libraries I install under cygwin put their libraries in the 
same place - otherwise adding a new path everytime would sort of defy 
the idea behind this.

>>> The Cygwin binaries are built to be run within the Cygwin 
>>> environment, so the environment takes care of the symlinks, etc.  If 
>>> you really want to run Xerces-C binaries outside of Cygwin, you might 
>>> try using Mingw, or just using the free version of Visual Studio.

Visual Studio is absolutely out of the question :) No M$ products 
whenever I can avoid it. No, I'm not a general Microsoft hater, I do 
appreciate the one good software that has come out of Redmond, being MS 
Access ;) But apart from that, yes, Microsoft is teh shit *g*

> Not necessarily true.  The Xerces-C binaries built under cygwin will 
> have a dependency on the Cygwin DLL, so the target machine will need to 
> have Cygwin installed.  Mingw does not link against anything other than 
> the Microsoft run-time libraries, so you don't need Cygwin with it.

That's an argument in favour of using MinGw, but so far, it seems all I 
need to do to run cygwin-built applications on other systems, is the 
cygwin1.dll - or was that just working because I tested a very simple 
(network socket  demonstration) and I will run into more problems once I 
use more funcionality?

Thanks again!

     Lars

-- 
Dipl.-Ing. Lars Uffmann
Microgravity User Support Center (MUSC)
Deutsches Zentrum für Luft- und Raumfahrt e.V.
Linder Höhe
D-51147 Köln
phone: 02203 601-2171
http://www.dlr.de/musc

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by David Bertoni <db...@apache.org>.
Lars Uffmann wrote:
> David Bertoni wrote:
>> Why not do:
>> runConfigure -p cygwin -c gcc -x g++ --prefix=/usr
>  > then do a make install, like similar autoconf-built packages?  I would
>  > recommend /usr/local instead of /usr, but that's really up to you.
> 
> Because I'm ignorant ;) Thanks a lot - the option for the runConfigure 
> script is -P /usr/local btw - which is then passed on as 
> --prefix=/usr/local
Yes, I forgot about the special -P syntax -- sorry about that.

> 
> And whoop-de-doo - it's working! :)
> I had to read a couple of error messages first, however, to recall that 
> "make install" requires a preceeding "make" usually :)
> 
> $ XERCESCROOT=/home/lars/xerces-c-src_2_8_0
> $ export XERCESCROOT
> $ make clean
> $ runConfigure -p cygwin -c gcc -x g++ -P /usr/local
> $ make
> $ make install
> 
> Et voilá!
> -> /usr/local/include has the include directory xercesc
> -> /usr/local/lib has the libraries
> -> /usr/local/bin has the windows-dlls
> 
> Only downside is, for the execution of the windows-application built 
> with gnu, I still need to manually copy the dll-files into 
> c:\windows\system32 - is there a way to tell make install to use that 
> directory as target for the binaries?

--bindir might work, but I've never tried it before.  On the other hand, 
I'm not sure you want to copy a bunch of executables there.  Why don't you 
just modify the path?

> 
>> The Cygwin binaries are built to be run within the Cygwin environment, 
>> so the environment takes care of the symlinks, etc.  If you really 
>> want to run Xerces-C binaries outside of Cygwin, you might try using 
>> Mingw, or just using the free version of Visual Studio.
> 
> I'm not sure I understand - what I am doing right now, with the 
> .dll-files in windows' system32 folder, and compiling my application 
> with the gnu toolchain, seems to be working fine (alternatively, having 
> the .dll-files in the program directory, everything's working just as 
> fine). At the end of the day, all I need to port my application to 
> another windows system, is to copy the application executable & the 
> required DLLs to the target folder, and run it from there.

Not necessarily true.  The Xerces-C binaries built under cygwin will have a 
dependency on the Cygwin DLL, so the target machine will need to have 
Cygwin installed.  Mingw does not link against anything other than the 
Microsoft run-time libraries, so you don't need Cygwin with it.

Dave

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Lars Uffmann <la...@dlr.de>.
David Bertoni wrote:
> Why not do:
> runConfigure -p cygwin -c gcc -x g++ --prefix=/usr
 > then do a make install, like similar autoconf-built packages?  I would
 > recommend /usr/local instead of /usr, but that's really up to you.

Because I'm ignorant ;) Thanks a lot - the option for the runConfigure 
script is -P /usr/local btw - which is then passed on as --prefix=/usr/local

And whoop-de-doo - it's working! :)
I had to read a couple of error messages first, however, to recall that 
"make install" requires a preceeding "make" usually :)

$ XERCESCROOT=/home/lars/xerces-c-src_2_8_0
$ export XERCESCROOT
$ make clean
$ runConfigure -p cygwin -c gcc -x g++ -P /usr/local
$ make
$ make install

Et voilá!
-> /usr/local/include has the include directory xercesc
-> /usr/local/lib has the libraries
-> /usr/local/bin has the windows-dlls

Only downside is, for the execution of the windows-application built 
with gnu, I still need to manually copy the dll-files into 
c:\windows\system32 - is there a way to tell make install to use that 
directory as target for the binaries?

> The Cygwin binaries are built to be run within the Cygwin environment, 
> so the environment takes care of the symlinks, etc.  If you really want 
> to run Xerces-C binaries outside of Cygwin, you might try using Mingw, 
> or just using the free version of Visual Studio.

I'm not sure I understand - what I am doing right now, with the 
.dll-files in windows' system32 folder, and compiling my application 
with the gnu toolchain, seems to be working fine (alternatively, having 
the .dll-files in the program directory, everything's working just as 
fine). At the end of the day, all I need to port my application to 
another windows system, is to copy the application executable & the 
required DLLs to the target folder, and run it from there.

All problems concerning the implementation of Xerces on my development 
computer solved! :)
Look forward to questions incoming about the actual USE of Xerces-C from 
someone who has only done XML parsing under PHP with domxml before... *g*

Best Regards,

    Lars

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by David Bertoni <db...@apache.org>.
Lars Uffmann wrote:
> Okay, once again, I solved my own problem (partially):
> 
> In order to put the xerces include and library files where I want them, 
> I simply copied the folders (to /usr/include/xerces-c and 
> /usr/lib/xerces-c) and then I didn't have to supply an include path for 
> the gcc compiler anymore because /usr/include/ is among the standard 
> presettings. /usr/lib however isnt, I'll have to find out from where 
> libraries are usually included.
> 

Why not do:

runConfigure -p cygwin -c gcc -x g++ --prefix=/usr

then do a make install, like similar autoconf-built packages?  I would 
recommend /usr/local instead of /usr, but that's really up to you.

> One thing that really annoys me, however, is that the lib directory uses 
>  a shortcut linking to a shortcut linking to the real library for 
> compatibility purposes. This is their naming:
> libxerces-c.dll.a.lnk ->libxerces-c2_8_0.dll.a.lnk ->libxerces-c28.dll.a
> libxerces-depdom.dll.a.lnk ->libxerces-depdom2_8_0.dll.a.lnk 
> ->libxerces-depdom28.dll.a
> 
> Now those shortcuts seem to allow for the "simpler" library inclusion 
> with g++ -lxerces-c and need to be edited if the libraries are copied to 
> a new folder, because they link to absolute paths.

They're done that way because that's the way the Xerces-C links ELF 
binaries (for supporting binary-compatible upgrades), and that has carried 
over to the Cygwin build process.

> And of course, $§%$§" Windows won't let me edit a shortcut to a shortcut 
> - for whatever reason. Apart from that, those shortcuts might not be 
> Windows-shortcut-compatible after all - the comment field holds the 
> "native" linux-environment path to the link target, while the target has 
> the windows path. Anyways, changing these shortcuts doesn't seem to work 
> if I use the windows shortcut property-editing, so as for linker 
> directives, I have to resort to -lcygxerces-c28 again :/
> 
> Working on this though :)

The Cygwin binaries are built to be run within the Cygwin environment, so 
the environment takes care of the symlinks, etc.  If you really want to run 
Xerces-C binaries outside of Cygwin, you might try using Mingw, or just 
using the free version of Visual Studio.

Dave

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Lars Uffmann <la...@dlr.de>.
Okay, once again, I solved my own problem (partially):

In order to put the xerces include and library files where I want them, 
I simply copied the folders (to /usr/include/xerces-c and 
/usr/lib/xerces-c) and then I didn't have to supply an include path for 
the gcc compiler anymore because /usr/include/ is among the standard 
presettings. /usr/lib however isnt, I'll have to find out from where 
libraries are usually included.

One thing that really annoys me, however, is that the lib directory uses 
  a shortcut linking to a shortcut linking to the real library for 
compatibility purposes. This is their naming:
libxerces-c.dll.a.lnk ->libxerces-c2_8_0.dll.a.lnk ->libxerces-c28.dll.a
libxerces-depdom.dll.a.lnk ->libxerces-depdom2_8_0.dll.a.lnk 
->libxerces-depdom28.dll.a

Now those shortcuts seem to allow for the "simpler" library inclusion 
with g++ -lxerces-c and need to be edited if the libraries are copied to 
a new folder, because they link to absolute paths.
And of course, $§%$§" Windows won't let me edit a shortcut to a shortcut 
- for whatever reason. Apart from that, those shortcuts might not be 
Windows-shortcut-compatible after all - the comment field holds the 
"native" linux-environment path to the link target, while the target has 
the windows path. Anyways, changing these shortcuts doesn't seem to work 
if I use the windows shortcut property-editing, so as for linker 
directives, I have to resort to -lcygxerces-c28 again :/

Working on this though :)

Best Regards,

    Lars

-- 
Dipl.-Ing. Lars Uffmann
Microgravity User Support Center (MUSC)
Deutsches Zentrum für Luft- und Raumfahrt e.V.
Linder Höhe
D-51147 Köln
phone: 02203 601-2171
http://www.dlr.de/musc

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Lars Uffmann <la...@dlr.de>.
Hi Keith!

Keith Mendoza wrote:
> You have to set Eclipse to do "-l xerces-c" and set the "-L <path to
> libxerces-c.so>". I noticed that currently Eclipse is executing
> -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\include" that should be something
> along the line of -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\lib".

Thanks - as irony has it, I finished solving this problem the very 
second that your reply arrived in my inbox - was about to post my 
solution :) However, I do not have any libxerces-c.so file or folder 
under cygwin / xerces lib folder.

What I did right now was that I included -lcygxerces-c28 and set the 
searchpath to - as you correctly pointed out - the lib subfolder:
 >>>
g++ -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\lib" -o"readNetwork.exe" 
./src/main.o   -lcygxerces-c28
Info: resolving xercesc_2_8::XMLUni::fgXercescDefaultLocale       by 
linking to __imp___ZN11xercesc_2_86XMLUni22fgXercescDefaultLocaleE 
(auto-import)
Finished building target: readNetwork.exe
 >>>

That worked fine, however I had to copy cygxerces-c28.dll to the 
Windows\System32 folder in order for the executable to run.

After your suggestion I had another look at the lib-folder and discovered
    libxerces-c.dll.a.lnk
being a shortcut linking to
    libxerces-c2_8_0.dll.a.lnk
being a shortcut linking to
    libxerces-depdom28.dll.a
with the end result that I am very confused now 8-)

However, linker also works with -llibxerces-c or -lxerces-c - so I guess 
I'll use -lxerces-c being the most generic library name.

Thanks for the help, now the last thing remaining is:
How do I "correctly" configure and make xerces so that the include files 
end up in /usr/include and the library files in /usr/lib?

But hey - at least I can get started on parsing XML files now - so 
thanks a lot for your effort!

Best Regards,

    Lars

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Keith Mendoza <pa...@gmail.com>.
You have to set Eclipse to do "-l xerces-c" and set the "-L <path to
libxerces-c.so>". I noticed that currently Eclipse is executing
-L"C:\cygwin\home\lars\xerces-c-src_2_8_0\include" that should be something
along the line of -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\lib".
Unfortunately I don't have Eclipse installed so I can't give you exact
instructions on how to make these settings.

Keith

On Jan 8, 2008 5:57 AM, Lars Uffmann <la...@dlr.de> wrote:

> Alberto Massari wrote:
> >>    $ XERCESCROOT = /home/lars/xerces-c-src_2_8_0/src/xercesc/
> > XERCESCROOT should point to /home/lars/xerces-c-src_2_8_0
>
> Great! That did it, thanks a lot :) Someone might wanna add that in the
> build instructions - it wasn't obvious IMHO - at least not for dummies
> like me.
>
> Now the next step in my problems:
> I was able to include the header files by adding the compiler option
> -I"C:\cygwin\home\lars\xerces-c-src_2_8_0\include"
>
> But of course I'd love to see all those include files in /usr/include
> (c:\cygwin\usr\include) - is there any way to make Xerces so that they
> are put there? Or is copying the include directory there all I need to do?
>
> And while I can workaround that issue, the other problem is that the
> linker complains about undefined references (for all xerces functions
> calls in the minimal main-function) - what library do I need to include
> for xerces functionality to be available?
>
> Right now, my (Eclipse + Gnu toolchain) environment says upon compiling:
>  >>>
> g++ -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\include"
> -o"readNetwork.exe"  ./src/main.o
> ./src/main.o: In function `_ZN11xercesc_2_810XMLDeleterD1Ev':
>
> C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851:
> undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'
>
> C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851:
> undefined reference to `xercesc_2_8::XMLPlatformUtils::Initialize(char
> const*, char const*, xercesc_2_8::PanicHandler*,
> xercesc_2_8::MemoryManager*, bool)'
>
> C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851:
> undefined reference to `xercesc_2_8::XMLPlatformUtils::Terminate()'
> collect2: ld returned 1 exit status
>  >>>
>
> Thanks again for any help!
>
>    Lars
>
>
>
> PS: Attached is the example program for initialization of Platform
> utilities:
>  >>>
> #include <xercesc/util/PlatformUtils.hpp>
> // Other include files, declarations, and non-Xerces-C++ initializations.
> XERCES_CPP_NAMESPACE_USE
>
> int main(int argc, char* argv[])
> {
>   try {
>     XMLPlatformUtils::Initialize();
>   }
>   catch (const XMLException& toCatch) {
>     // Do your failure processing here
>     return 1;
>   }
>
>   // Do your actual work with Xerces-C++ here.
>
>   XMLPlatformUtils::Terminate();
>
>   // Other terminations and cleanup.
>   return 0;
> }
>  >>>
>



-- 
www.savedbycuriosity.com

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Lars Uffmann <la...@dlr.de>.
Alberto Massari wrote:
>>    $ XERCESCROOT = /home/lars/xerces-c-src_2_8_0/src/xercesc/
> XERCESCROOT should point to /home/lars/xerces-c-src_2_8_0

Great! That did it, thanks a lot :) Someone might wanna add that in the 
build instructions - it wasn't obvious IMHO - at least not for dummies 
like me.

Now the next step in my problems:
I was able to include the header files by adding the compiler option
-I"C:\cygwin\home\lars\xerces-c-src_2_8_0\include"

But of course I'd love to see all those include files in /usr/include 
(c:\cygwin\usr\include) - is there any way to make Xerces so that they 
are put there? Or is copying the include directory there all I need to do?

And while I can workaround that issue, the other problem is that the 
linker complains about undefined references (for all xerces functions 
calls in the minimal main-function) - what library do I need to include 
for xerces functionality to be available?

Right now, my (Eclipse + Gnu toolchain) environment says upon compiling:
 >>>
g++ -L"C:\cygwin\home\lars\xerces-c-src_2_8_0\include" 
-o"readNetwork.exe"  ./src/main.o
./src/main.o: In function `_ZN11xercesc_2_810XMLDeleterD1Ev':
C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851: 
undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'
C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851: 
undefined reference to `xercesc_2_8::XMLPlatformUtils::Initialize(char 
const*, char const*, xercesc_2_8::PanicHandler*, 
xercesc_2_8::MemoryManager*, bool)'
C:/cygwin/home/lars/xerces-c-src_2_8_0/include/xercesc/util/PlatformUtils.hpp:851: 
undefined reference to `xercesc_2_8::XMLPlatformUtils::Terminate()'
collect2: ld returned 1 exit status
 >>>

Thanks again for any help!

    Lars



PS: Attached is the example program for initialization of Platform 
utilities:
 >>>
#include <xercesc/util/PlatformUtils.hpp>
// Other include files, declarations, and non-Xerces-C++ initializations.
XERCES_CPP_NAMESPACE_USE

int main(int argc, char* argv[])
{
   try {
     XMLPlatformUtils::Initialize();
   }
   catch (const XMLException& toCatch) {
     // Do your failure processing here
     return 1;
   }

   // Do your actual work with Xerces-C++ here.

   XMLPlatformUtils::Terminate();

   // Other terminations and cleanup.
   return 0;
}
 >>>

Re: Problem building Xerces 2.8.0 under Cygwin / Windows

Posted by Alberto Massari <am...@datadirect.com>.
Lars Uffmann wrote:
> Hi everyone!
>
> After downloading the newest Xerces Source from xerces.apache.org, 
> extracting it and following the instructions at
> http://xerces.apache.org/xerces-c/build-winunix.html#CygWin
> I managed to do the steps:
>    $ XERCESCROOT = /home/lars/xerces-c-src_2_8_0/src/xercesc/
XERCESCROOT should point to /home/lars/xerces-c-src_2_8_0

Alberto
>    $ export XERCESCROOT
>    $ ./runConfigure -p cygwin -c gcc -x g++
>
> successfully in my cygwin environment (no error messages from 
> runConfigure), but then failed on
>    $ make
>
> at this point:
> >>>
> make -s -C parsers
>   (CP)  
> /home/lars/xerces-c-src_2_8_0/src/xercesc//include/xercesc/parsers
>   (C++) AbstractDOMParser.o
> AbstractDOMParser.cpp:46:44: xercesc/dom/impl/DOMAttrImpl.hpp: No such 
> file or directory
> >>>
>
> A lot of "No such file or directory" messages followed, causing the 
> make to fail. As you can see, the include path is not complete, so I 
> suppose it looks for the directory xercesc in /usr/include/ - now HOW 
> do I configure and make xercesc in a way that all the libraries and 
> headers are put in the correct locations (namely /usr/include/xercesc/)?
> Or do I simply copy them there?
>
> Any help appreciated!
>
>    Lars
>
>