GCC 4.4.0, mips-sgi-irix6.5 and pthread - MORE
Tovrea, George W (US SSA)
george.tovrea@baesystems.com
Tue Sep 22 15:56:00 GMT 2009
This simple program, simple.c, taken from http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *print_message_function( void *ptr );
main()
{
pthread_t thread1, thread2;
char *message1 = "Thread 1";
char *message2 = "Thread 2";
int iret1, iret2;
/* Create independent threads each of which will execute function */
iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1);
iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2);
/* Wait till threads are complete before main continues. Unless we */
/* wait we run the risk of executing an exit which will terminate */
/* the process and all threads before the threads have completed. */
pthread_join( thread1, NULL);
pthread_join( thread2, NULL);
printf("Thread 1 returns: %d\n",iret1);
printf("Thread 2 returns: %d\n",iret2);
exit(0);
}
void *print_message_function( void *ptr )
{
char *message;
message = (char *) ptr;
printf("%s \n", message);
}
Compiled with
gcc -lpthread simple.c
results in
Thread 1
Thread 2
Thread 1 returns: 0
Thread 2 returns: 0
The sample program compiled with
g++ -lpthread simple.c -L/home/users/tovrea/local/sgi6/lib/gcc/mips-sgi-irix6.5/4.4.0 -L/home/users/tovrea/local/sgi6/lib/gcc/mips-sgi-irix6.5/4.4.0/32 -L/home/users/tovrea/local/sgi6/lib/gcc/mips-sgi-irix6.5/lib32 -L/home/users/tovrea/local/sgi6/lib
results in a core with backtrace
tovrea@warhol%dbx a.out core
dbx version 7.3.5 (92898_Aug07 MR) Aug 7 2003 14:15:31
Core from signal SIGSEGV: Segmentation violation
(dbx) t
> 0 pthread_key_create(0x600ed060, 0x6009ed20, 0x18248, 0x0, 0x0, 0x0, 0x65, 0x6009ef90) ["/xlv51/patches/7042/work/eoe/lib/libpthread/libpthread_n32_M3/key.c":68, 0xc058730]
1 <Unknown>(__initialize_p = <illegal>, __priority = <illegal>) ["/home/users/tovrea/GCC_SGI6/gcc-4.4.0/libstdc++-v3/libsupc++/eh_globals.cc":1, 0x6009ef88]
2 <Unknown>(__initialize_p = <illegal>, __priority = <illegal>) ["/home/users/tovrea/GCC_SGI6/gcc-4.4.0/libstdc++-v3/libsupc++/eh_globals.cc":1, 0x6009ef88]
3 <Unknown>(__initialize_p = <illegal>, __priority = <illegal>) ["/home/users/tovrea/GCC_SGI6/gcc-4.4.0/libstdc++-v3/libsupc++/eh_globals.cc":1, 0x6009ef88]
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Tovrea, George W (US SSA)
Sent: Tuesday, September 22, 2009 7:36 AM
To: gcc-help@gcc.gnu.org
Subject: GCC 4.4.0, mips-sgi-irix6.5 and pthread
I would greatly appreciate if anyone working with gcc 4.4.0 on mips-sgi-irix6.5 and pthreads would contact me ASAP (deadlines, deadlines, deadlilnes). I am having issues with pthread initialization (just including -lpthread in a simple program that does not use them).
I have tried both binutils ld v2.19 and the native loader /usr/bin/ld v7.41. Neither work.
Thanks in advance,
Bill Tovrea
BAE Systems
16550 West Bernardo Drive
San Diego, CA 92127
Telephone: (858) 592-5292
Pager: (888) 971-4964
E-mail: George.Tovrea@baesystems.com
More information about the Gcc-help
mailing list