Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* pthreads compilation problem
@ 1994-04-08 22:17 Dean McRobie
  1994-04-11 12:37 ` Simon Patience
  1994-04-11 15:24 ` Burkhard Neidecker-Lutz
  0 siblings, 2 replies; 4+ messages in thread
From: Dean McRobie @ 1994-04-08 22:17 UTC (permalink / raw)


Hi OSFers,

I am trying to use DEC OSF/1 for am Operating Systems course I am
teaching, I was going to write a process simulator and had thought to
use the threads facility of OSF/1 to simulate the processes.  However,
I can not get ANYTHING to compile!!! In fact:

#include <stdio.h>
#include <pthread.h>

int main(int argc, char **argv)
{
  printf("boo!\n");
}

followed by "cc -o boo boo.c -lpthread -lmach" says:
Segmentation Fault!

HELP!!!  What have I done wrong?!?!?!?  I can not get to the DEC
example programs as they are unable to be extracted from the
documentation unless I intend to type them in (a last resort).

Any help would be appreciated!

Deano
--
---------------------------------------------------------------------
Dean McRobie             | "Never was a cornflake girl, thought that
Assistant Lecturer       |  was a good solutions hanging with the 
University of Otago      |  raisin girls, she's gone to the other side
Dunedin, New Zealand     |  givin us the old heave ho, things are 
deano@rabbit.otago.ac.nz |  getting kind of gross" Tori Amos


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthreads compilation problem
  1994-04-08 22:17 pthreads compilation problem Dean McRobie
@ 1994-04-11 12:37 ` Simon Patience
  1994-04-11 15:24 ` Burkhard Neidecker-Lutz
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Patience @ 1994-04-11 12:37 UTC (permalink / raw)


In article <DEANO.94Apr9101756@rabbit.otago.ac.nz>, deano@rabbit.otago.ac.nz (Dean McRobie) writes:
> I am trying to use DEC OSF/1 for am Operating Systems course I am
> teaching, I was going to write a process simulator and had thought to
> use the threads facility of OSF/1 to simulate the processes.  However,
> I can not get ANYTHING to compile!!! In fact:
> 
> #include <stdio.h>
> #include <pthread.h>
> 
> int main(int argc, char **argv)
> {
>   printf("boo!\n");
> }
> 
> followed by "cc -o boo boo.c -lpthread -lmach" says:
> Segmentation Fault!
> 
> HELP!!!  What have I done wrong?!?!?!?  I can not get to the DEC
> example programs as they are unable to be extracted from the
> documentation unless I intend to type them in (a last resort).
> 
> Any help would be appreciated!

I don't know what your problem is but I have two comments which might help.
The header pthread.h should be included before any other file as it can modify
their behavior. Secondly you should link with the re-entrant C library (-lc_r). 
I am assuming that DEC OSF/1 pthreads are the same as OSF OSF/1 pthreads!

Good Luck
Simon.

-- 
  Simon Patience				Phone: (617) 621-7376
  Open Software Foundation			FAX:   (617) 621-8696
  1 Cambridge Center				Email: sp@osf.org
  Cambridge, MA 02142				       uunet!osf!sp


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthreads compilation problem
  1994-04-08 22:17 pthreads compilation problem Dean McRobie
  1994-04-11 12:37 ` Simon Patience
@ 1994-04-11 15:24 ` Burkhard Neidecker-Lutz
  1994-04-11 16:47   ` Steve Strange USG
  1 sibling, 1 reply; 4+ messages in thread
From: Burkhard Neidecker-Lutz @ 1994-04-11 15:24 UTC (permalink / raw)


In article <DEANO.94Apr9101756@rabbit.otago.ac.nz> deano@rabbit.otago.ac.nz (Dean McRobie) writes:
>#include <stdio.h>
>#include <pthread.h>
>
>int main(int argc, char **argv)
>{
>  printf("boo!\n");
>}
>
>followed by "cc -o boo boo.c -lpthread -lmach" says:
>Segmentation Fault!
>

Make that:

	#include <pthread.h>		/* Has to go first */
	#include <stdio.h>

and

	cc -o boo boo.c -lpthread -lmach -lc_r

and live happily ever after...

		Burkhard Neidecker-Lutz

Distributed Multimedia Group, CEC Karlsruhe  
BERKOM II Project
Digital Equipment Corporation
neideck@nestvx.enet.dec.com




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pthreads compilation problem
  1994-04-11 15:24 ` Burkhard Neidecker-Lutz
@ 1994-04-11 16:47   ` Steve Strange USG
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Strange USG @ 1994-04-11 16:47 UTC (permalink / raw)


In article <2obq3eINNt17@usenet.pa.dec.com> neideck@bier.kar.dec.com (Burkhard Neidecker-Lutz) writes:

>	   cc -o boo boo.c -lpthread -lmach -lc_r

Or, use the more friendly

	cc -o boo boo.c -threads

for the same effect.  man cc for a description of -threads.

	Steve

--
Steve Strange						strange@zk3.dec.com
Digital Equipment Corporation, Nashua, NH		     (603) 881-0595
DEC OSF/1 File System Development


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-04-11 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-04-08 22:17 pthreads compilation problem Dean McRobie
1994-04-11 12:37 ` Simon Patience
1994-04-11 15:24 ` Burkhard Neidecker-Lutz
1994-04-11 16:47   ` Steve Strange USG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox