Operating System - HP-UX
1844467 Members
3767 Online
110233 Solutions
New Discussion

Wrapping Perl or Re-Linking Perl

 
SOLVED
Go to solution
Vincent Marcus
New Member

Wrapping Perl or Re-Linking Perl

We have recently rebuilt a perl module with a library that is failing because of this error:
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1

We can get it to work using the LD_PRELOAD environment variable. However, the perl module is used by the vast majority of our perl scripts so we'd have to either change every single shell script that calls one of the perl scripts to do the LD_PRELOAD, or we'd have to put it in everyone's environment which would mean that everything would be running with that shared library preloaded.

We've tried replacing the perl binary with a shell script that has the LD_PRELOAD in it, but we can't figure out a way to make that work with a script that executes perl using a shebang (#!).

Another idea that we've had is rebuilding perl so that it's linked to libpthread.1. We didn't build the version that we're running in the production environment though, so there's a little bit of hesitation that because of the amount of testing that our QA team would want to do before rolling it out to production. Would it be possible to just link libpthread to the executable without rebuilding everything so that it should load it at startup?

Any suggestions would be great.

Thanks,

-Vince
2 REPLIES 2
Dennis Handly
Acclaimed Contributor
Solution

Re: Wrapping Perl or Re-Linking Perl

>which would mean that everything would be running with that shared library preloaded.

You can't just export LD_PRELOAD and leave it set. All sorts of things will fail.

Which library is linked with libpthread? Do you own it? If you do, remove libpthread from the link line.

>rebuilding perl so that it's linked to libpthread.1.

This is the correct solution. In fact, isn't there a perl build target with that?

> Would it be possible to just link libpthread to the executable without rebuilding everything so that it should load it at startup?

The trouble with that is if you don't compile perl with threads, some things may fail if threads are created.

If threads are never created in your environment, you probably don't have to worry.
Vincent Marcus
New Member

Re: Wrapping Perl or Re-Linking Perl

The library that we build is linked to another library that's supplied by the vendor, and it's the vendor's library that is apparently linked to libpthread. This wasn't an issue with older versions of their libraries, it only recently became an issue when we updated their SDK.