- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Loading a shared library in HP-UX
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2011 06:31 AM
тАО03-18-2011 06:31 AM
Loading a shared library in HP-UX
Cannot dlopen load module '/opt/java1.5/jre/lib/PA_RISC2.0W/server/libjvm.sl' because it contains thread specific data.
I have no idea what this means, and Google has not been very helpful explaining what this is actually saying. Here is some information on the environment:
# uname -a
HP-UX neo B.11.11 U 9000/800 101901537 unlimited-user license
# /opt/java1.5/bin/java -version
java version "1.5.0.19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.19-_18_dec_2009_00_08)
Java HotSpot(TM) Server VM (build 1.5.0.19 jinteg:12.18.09-02:30 PA2.0 (aCC_AP), mixed mode)
# aCC --version
aCC: HP ANSI C++ B3910B A.03.85
This is how I compile my code:
# aCC -mt +Z +DA2.0W -c test.cpp
# ld -o test -lc test.o
# ./test
Cannot dlopen load module '/opt/java1.5/jre/lib/PA_RISC2.0W/server/libjvm.sl' because it contains thread specific data.
This is my C++ code:
#include
#include
#include
#include
int main(void){
void* handle;
handle = dlopen("/opt/java1.5/jre/lib/PA_RISC2.0W/server/libjvm.sl", RTLD_NOW);
if(handle == NULL){
printf("%s\n", dlerror());
}
else {
printf("ok\n");
dlclose(handle);
}
}
Any help with this would be very much appreciated!
- Tags:
- dlopen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2011 08:32 AM
тАО03-18-2011 08:32 AM
Re: Loading a shared library in HP-UX
But here's what I've understood about your situation:
"thread-specific data" might be more commonly known as Thread-Local Storage (TLS). It means the library must reserve some amount of memory for the library's internal workspace for each thread this process is going to run.
When the program is initially loaded, this is not a problem: the dynamic loader loads the program and all the libraries it requires, finds the TLS requirements (if any) of each library and puts the value to some place where the thread creation functions can find it. Then it runs the initialization code(if any) for each library, and ultimately the program itself.
But when you dlopen() a library in mid-program, and that library requires Thread-Local Storage, there is a problem: the dlopen() function would have to stop all the threads this program may be using, and increase the TLS assigned for each one. But this would require moving things around in memory, and *that* would invalidate all the pointers and similar memory references the program may have created. Apparently there is no good solution to this problem, because Google indicates the situation is much the same in other Unixes, Linux and Windows too.
Therefore, you aren't permitted to use dlopen() to load a library that contains TLS: you must link your program with it, so the dynamic loader knows to load the library *before* the main() function of your program begins executing.
The library you're loading is libjvm.sl, the core of the Java Virtual Machine. Java makes heavy use of threads: I wouldn't be too surprised if the initialization code of libjvm.sl set up some JVM-internal threads on its own.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2011 08:50 AM
тАО03-18-2011 08:50 AM
Re: Loading a shared library in HP-UX
$ g++ -ldl -o test test.cpp
$ ./test
ok
$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2011 11:20 AM
тАО03-18-2011 11:20 AM
Re: Loading a shared library in HP-UX
It means what it says. You can't dynamically load that shlib at all on PA.
You'll have to statically link in that shlib.
Or use:
LD_PRELOAD=/opt/java1.5/jre/lib/PA_RISC2.0W/server/libjvm.sl executable
>this exact piece of code runs just fine on both Windows and Linux.
And also on HP-UX Integrity.
>MK: Apparently there is no good solution to this problem
The problem is solved on Integrity since +tls=dynamic is the default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-18-2011 11:23 AM
тАО03-18-2011 11:23 AM
Re: Loading a shared library in HP-UX
Did you try:
"Cannot dlopen load module" site:itrc.hp.com