General
cancel
Showing results for 
Search instead for 
Did you mean: 

pthread_create() on Itanium 11.23

pthread_create() on Itanium 11.23

Hello,

I have a program that runs on PA-RISC HPUX, AIX, and Solaris that uses threads for communications. I call pthread_create() to get things going. I recently ported this code to HPUX 11.23 Itanium, and when I make the call to pthread_create(), I receive the return code of 251 - "function not implemented".

Does anyone know if/when the pthread functions will be available on Itanium or if I need to use a different threading library?

Regards, Rob
7 REPLIES

Re: pthread_create() on Itanium 11.23

This is resolved. I needed to change the link order of the -lpthread and remove the explicit link of -lc. The aCC compiler will add the -lc at the end of the link. By default, the libc library provides stubs for the pthread functions.

Re: pthread_create() on Itanium 11.23

Closed
Dennis Handly
Acclaimed Contributor

Re: pthread_create() on Itanium 11.23

>I needed to change the link order of the -lpthread and remove the explicit link of -lc.

Right. The latest compiler will now warn if you attempt to add one of the default shlibs:
aCC: warning 983: The -lc library specified on the command line is also added automatically by the compiler driver.

You may want to use -mt and let the driver add -lpthread.

>the libc library provides stubs for the pthread functions.

Yes, a patch added that on 11.11. Some stubs will return ENOSYS.
Venkata Subramanian
Occasional Visitor

Re: pthread_create() on Itanium 11.23

I am also facing the same problem in hp unix 11.11. I saw your solution but please explain in detail about what needs to be done in the server.
Dennis Handly
Acclaimed Contributor

Re: pthread_create() on Itanium 11.23

>Venkata: explain in detail about what needs to be done in the server.

You should be creating your own thread so you can assign points. You can add an URL to this thread if there is any useful info.

There is nothing to be done on the server, the application is broken and needs to be relinked.
That does "chatr executable" show?
Venkata Subramanian
Occasional Visitor

Re: pthread_create() on Itanium 11.23

Now the program is running in infinite loop with the following error message

/usr/lib/dld.sl: Unresolved symbol: U_get_unwind_table (code) from /opt/langtools/lib/libpthread_tr.1
/usr/lib/dld.sl: Unresolved symbol: U_get_unwind_table (code) from /opt/langtools/lib/libpthread_tr.1
/usr/lib/dld.sl: Unresolved symbol: U_get_unwind_table (code) from /opt/langtools/lib/libpthread_tr.1
/usr/lib/dld.sl: Unresolved symbol: U_get_unwind_table (code) from /opt/langtools/lib/libpthread_tr.1

Pid 4074 received a SIGSEGV for stack growth failure.
Possible causes: insufficient memory or swap space,
or stack size exceeded maxssiz.
^CSegmentation fault (core dumped)

I am working on hp_unix 11.11 platform. Please find the code below


#include
#include
#include
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
long tid;
tid = (long)threadid;
printf("Hello World! It's me, thread #%ld!\n", tid);
pthread_exit(NULL);
}

int main(int argc, char *argv[])
{
pthread_t threads[NUM_THREADS];
int rc;
long t;
for(t=0;t printf("In main: creating thread %ld\n", t);
rc = pthread_create(&threads[t], NULL, NULL, (void *)t);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
}
pthread_exit(NULL);
}

Compilation - g++ -lpthread hello.cpp



Dennis Handly
Acclaimed Contributor

Re: pthread_create() on Itanium 11.23

>Venkata: Now the program is running in infinite loop with the following error message

Please create your own thread in the "languages and scripting" forum. This is completely unrelated to this thread.