[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC with '-threads' on SOLARIS not supported by

From: Bob Friesenhahn
Subject: Re: GCC with '-threads' on SOLARIS not supported by
Date: Thu, 8 Jun 2006 10:37:39 -0500 (CDT)

On Thu, 8 Jun 2006, Eric PAIRE wrote:

The threads(3THR) manual page for Solaris specifies:

   cc -mt [ flag... ] file...- lpthread [ -lposix4 library... ]
   cc - mt [ flag... ] file...[ library... ]

But, if you read closely, you will see that the page refers to 'cc' and not 'gcc' :-(, and if you read the specs files of 'gcc', you will discover that gcc refuses the '-mt' flag but accepts '-pthreads' flag when compiling for POSIX threads, and '-threads' one when compiling for SOLARIS threads, without having to add '-lpthread' (which is much simpler IMHO).

I see. A solution is to simply define -D_REENTRANT in CPPFLAGS and then everything just works. The -mt, -threads, and -pthreads options are just crutches.

There was a time when I was using Solaris UI threads with GCC but that was a very long time ago. At that time I was not using any special option except for -D_REENTRANT.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]