I've created a patch that fixed the problem for me.....
-Rob
Robert Wyrick wrote:
I have a perl script that uses XML::Xerces and, therefore, xerces-c.
I'm compiling with:
pp -o xtest -l libxerces.so.25 x.pl
When I run xtest the first time, I get the following error messages:
Undefined subroutine &XML::Xerces::XMLPlatformUtils::Initialize called
at XML/Xerces.pm line 16.
INIT failed--call queue aborted.
Undefined subroutine &XML::Xerces::XMLPlatformUtils::Terminate called
at XML/Xerces.pm line 24.
END failed--call queue aborted.
When I run the second (and subsequent) times, everything works.
I've determined via strace, that on the first run, it cannot find the
shared libary but it does find it on
subsequent runs because it is cached in /tmp.
There are cache directories getting created (and left) in /tmp (the
first time it runs) that contain the
libxerces.so.25 file.
I cannot understand why xtest cannot find the shared library during
the first run.
I've also tried:
pp -o xtest -l xerces x.pl
as well as adding -M XML::Xerces::XMLPlatformUtils to the mix
But I had even less luck with that.
At this point, it's mostly an annoyance that I have to run the script
twice after it's deployed.
Anyone have any clues?
-Rob
P.S. This is all on RedHat Linux....
diff -u -r PAR-0.85/myldr/mktmpdir.c PAR-0.85-rew/myldr/mktmpdir.c
--- PAR-0.85/myldr/mktmpdir.c Fri Jul 2 03:01:04 2004
+++ PAR-0.85-rew/myldr/mktmpdir.c Wed Nov 17 17:18:14 2004
@@ -5,6 +5,7 @@
#include "ctype.h"
#include "mktmpdir.h"
+#include <string.h>
#define PAR_TEMP "PAR_TEMP"
@@ -14,6 +15,35 @@
# define OPEN_O_BINARY 0
#endif
+void par_setup_libpath( const char * stmpdir )
+{
+ const char *key = NULL , *val = NULL;
+ int i;
+ const char *ld_path_keys[6] = {
+ "LD_LIBRARY_PATH", "LIBPATH", "LIBRARY_PATH",
+ "PATH", "DYLD_LIBRARY_PATH", ""
+ };
+ char *ld_path_env;
+ for ( i = 0 ; strlen(key = ld_path_keys[i]) > 0 ; i++ ) {
+ if ( ((val = (char *)par_getenv(key)) == NULL) || (strlen(val) == 0) ) {
+ par_setenv(key, stmpdir);
+ }
+ else if(!strstr(val, stmpdir)) {
+ ld_path_env = (char *)malloc(
+ strlen(stmpdir) +
+ strlen(path_sep) +
+ strlen(val) + 2
+ );
+ sprintf(
+ ld_path_env,
+ "%s%s%s",
+ stmpdir, path_sep, val
+ );
+ par_setenv(key, ld_path_env);
+ }
+ }
+}
+
char *par_mktmpdir ( char **argv ) {
int i;
char *c;
@@ -23,16 +53,11 @@
const char *temp_dirs[4] = { "C:\\TEMP", "/tmp", ".", "" };
const char *temp_keys[4] = { "TMPDIR", "TEMP", "TMP", "" };
const char *user_keys[3] = { "USER", "USERNAME", "" };
- const char *ld_path_keys[6] = {
- "LD_LIBRARY_PATH", "LIBPATH", "LIBRARY_PATH",
- "PATH", "DYLD_LIBRARY_PATH", ""
- };
const char *subdirbuf_prefix = "par-";
const char *subdirbuf_suffix = "";
char *progname = NULL, *username = NULL;
- char *ld_path_env;
char *stmpdir;
int f, j, k;
char sha1[41];
@@ -41,6 +66,7 @@
unsigned char sha_data[20];
if ( (val = (char *)par_getenv("PAR_TEMP")) && strlen(val) ) {
+ par_setup_libpath(val);
return strdup(val);
}
@@ -136,24 +162,7 @@
/* set dynamic loading path */
par_setenv(PAR_TEMP, stmpdir);
- for ( i = 0 ; strlen(key = ld_path_keys[i]) > 0 ; i++ ) {
- if ( ((val = (char *)par_getenv(key)) == NULL) || (strlen(val) == 0) ) {
- par_setenv(key, stmpdir);
- }
- else {
- ld_path_env = (char *)malloc(
- strlen(stmpdir) +
- strlen(path_sep) +
- strlen(val) + 2
- );
- sprintf(
- ld_path_env,
- "%s%s%s",
- stmpdir, path_sep, val
- );
- par_setenv(key, ld_path_env);
- }
- }
+ par_setup_libpath( stmpdir );
return(stmpdir);
}