You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Dennis Doussan <da...@yahoo.com> on 2000/09/29 14:33:05 UTC
fopen() fails on Solaris in 1.2a release
Hi again,
I am having a problem with fopen() when linking with libxerces-c1_2.so.
When I link libxerces-c1_2.so, fopen() fails on Solaris 2.6 using Sun Workshop 4.2 CC compiler.
If I do not link with libxerces-c1_2.so, fopen() works fine. (I have tried both the binary and source distributions.)
I have included my simple test program below. When I run it as:
> foo ./anyfile
I get this message and the program hangs:
> libc internal error: _rmutex_unlock: rmutex not held.
Note that it does not matter if I call XMLPlatformUtils::Initialize() or not.
Any ideas what could be causing this?
Anyone else seen this problem?
Regards,
Dennis Doussan
Nielsen Media Research
foo.cc:
--------
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <string.h>
#include <util/PlatformUtils.hpp>
int main(int argc, char* argv[])
{
if( argc < 2 ) {
cout << "usage: " << argv[0] << " filename" << endl;
exit(1);
}
if( argc > 2 )
XMLPlatformUtils::Initialize();
char* filename = argv[1];
char xmlBuffer[1024*2];
memset(xmlBuffer, 0, sizeof(xmlBuffer));
cout << "Opening file: " << filename << endl;
FILE* fp = fopen(filename, "rb+");
if( fp ) {
fread(xmlBuffer, sizeof(xmlBuffer), 1, fp);
}
cout << "Contents of xmlBuffer" << endl << xmlBuffer << endl;
}
Re: fopen() fails on Solaris in 1.2a release
Posted by Dennis Doussan <da...@yahoo.com>.
Fixed:
I recompiled the test program with CC option -mt and now fopen() works. So
we have two options:
1) turn off threads in xerces lib
2) turn on threads in programs linking with xerces
Dennis
----- Original Message -----
From: Tony Wuebben <wu...@lexis-nexis.com>
To: <xe...@xml.apache.org>
Sent: Friday, September 29, 2000 8:46 AM
Subject: Re: fopen() fails on Solaris in 1.2a release
> I was having the same problem when running under Solaris 2.7. I
> recompiled the library with threads turned off (I'm currently not using
> threads) and everything works fine.
>
> I was told that if I upgrade to the latest GNU compilier (2.95??) it
> will work with threads. I plan on upgrading to SUN Workshop 6 in the
> near future, but for now I'm just not threading.
>
>
>
> > Dennis Doussan wrote:
> >
> > Hi again,
> >
> > I am having a problem with fopen() when linking with
> > libxerces-c1_2.so.
> >
> > When I link libxerces-c1_2.so, fopen() fails on Solaris 2.6 using Sun
> > Workshop 4.2 CC compiler.
> > If I do not link with libxerces-c1_2.so, fopen() works fine. (I have
> > tried both the binary and source distributions.)
> >
> > I have included my simple test program below. When I run it as:
> >
> > > foo ./anyfile
> >
> > I get this message and the program hangs:
> >
> > > libc internal error: _rmutex_unlock: rmutex not held.
> >
> > Note that it does not matter if I call XMLPlatformUtils::Initialize()
> > or not.
> >
> > Any ideas what could be causing this?
> > Anyone else seen this problem?
> >
> > Regards,
> >
> > Dennis Doussan
> > Nielsen Media Research
> >
> > foo.cc:
> > --------
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <iostream.h>
> > #include <string.h>
> >
> > #include <util/PlatformUtils.hpp>
> >
> > int main(int argc, char* argv[])
> > {
> > if( argc < 2 ) {
> > cout << "usage: " << argv[0] << " filename" << endl;
> > exit(1);
> > }
> > if( argc > 2 )
> > XMLPlatformUtils::Initialize();
> >
> > char* filename = argv[1];
> > char xmlBuffer[1024*2];
> > memset(xmlBuffer, 0, sizeof(xmlBuffer));
> >
> > cout << "Opening file: " << filename << endl;
> > FILE* fp = fopen(filename, "rb+");
> > if( fp ) {
> > fread(xmlBuffer, sizeof(xmlBuffer), 1, fp);
> > }
> > cout << "Contents of xmlBuffer" << endl << xmlBuffer << endl;
> > }
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: fopen() fails on Solaris in 1.2a release
Posted by Tony Wuebben <wu...@lexis-nexis.com>.
I was having the same problem when running under Solaris 2.7. I
recompiled the library with threads turned off (I'm currently not using
threads) and everything works fine.
I was told that if I upgrade to the latest GNU compilier (2.95??) it
will work with threads. I plan on upgrading to SUN Workshop 6 in the
near future, but for now I'm just not threading.
> Dennis Doussan wrote:
>
> Hi again,
>
> I am having a problem with fopen() when linking with
> libxerces-c1_2.so.
>
> When I link libxerces-c1_2.so, fopen() fails on Solaris 2.6 using Sun
> Workshop 4.2 CC compiler.
> If I do not link with libxerces-c1_2.so, fopen() works fine. (I have
> tried both the binary and source distributions.)
>
> I have included my simple test program below. When I run it as:
>
> > foo ./anyfile
>
> I get this message and the program hangs:
>
> > libc internal error: _rmutex_unlock: rmutex not held.
>
> Note that it does not matter if I call XMLPlatformUtils::Initialize()
> or not.
>
> Any ideas what could be causing this?
> Anyone else seen this problem?
>
> Regards,
>
> Dennis Doussan
> Nielsen Media Research
>
> foo.cc:
> --------
> #include <stdio.h>
> #include <stdlib.h>
> #include <iostream.h>
> #include <string.h>
>
> #include <util/PlatformUtils.hpp>
>
> int main(int argc, char* argv[])
> {
> if( argc < 2 ) {
> cout << "usage: " << argv[0] << " filename" << endl;
> exit(1);
> }
> if( argc > 2 )
> XMLPlatformUtils::Initialize();
>
> char* filename = argv[1];
> char xmlBuffer[1024*2];
> memset(xmlBuffer, 0, sizeof(xmlBuffer));
>
> cout << "Opening file: " << filename << endl;
> FILE* fp = fopen(filename, "rb+");
> if( fp ) {
> fread(xmlBuffer, sizeof(xmlBuffer), 1, fp);
> }
> cout << "Contents of xmlBuffer" << endl << xmlBuffer << endl;
> }
>
>