Closed Bug 312662 Opened 14 years ago Closed 14 years ago

Build breaks when pthreads installed

Categories

(NSPR :: NSPR, defect)

4.6.1
x86
OS/2
defect
Not set

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dave.r.yeo, Assigned: wtc)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9a1) Gecko/20051015 SeaMonkey/1.1a
Build Identifier: 

After installing pthreads in Innotek_libc rc1 I can not build Firefox (and I'd
guess Seamonkey). The build ends here
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:154:2: #error "pthreads is not
supported for this architecture"
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:267:2: #error "pthreads is not
supported for this architecture"
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:300:2: #error "Need to define
_PT_PTHREAD_YIELD for this platform"
In file included from I:/mozilla/nsprpub/pr/src/io/prfdcach.c:38:
I:/mozilla/nsprpub/pr/include/private/primpl.h:1759: error: field `md' has
incomplete type
make.exe[6]: *** [prfdcach.o] Error 1

Workaround is to add ac_add_options --without-pthreads to .mozconfig.
I think the solution is to add something like USE_PTHREADS= to the OS/2 block in
configure.in but it is not working.
Also note that there are plans for pthread support to be added to innotek_libc.

Reproducible: Always

Steps to Reproduce:
1. Use GCC 3.3.5 (perhaps also 3.2.2 if pthreads built with 3.2.2)
2. Have compatible pthreads headers and libraries installed
3. attempt to build

Actual Results:  
gcc -o prfdcach.o -c      -pipe -Wall -Zomf -O2 -s   -UDEBUG -Uunix -U__unix
-U__unix__   -DMOZILLA_CLIENT=1  -DNDEBUG=1  -DXP_OS2=1  -DXP_PC=1 
-DBSD_SELECT=1  -DTCPV40HDRS=1  -DXP_OS2_EMX=1  -DOS2=1  -DHAVE_LCHOWN=1 
-DHAVE_STRERROR=1   -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
-D_NSPR_BUILD_ -II:/mozilla/obj-fb/dist/include/nspr
-II:/mozilla/nsprpub/pr/include -II:/mozilla/nsprpub/pr/include/private 
I:/mozilla/nsprpub/pr/src/io/prfdcach.c
In file included from I:/mozilla/nsprpub/pr/include/private/prpriv.h:47,
                 from I:/mozilla/nsprpub/pr/include/private/primpl.h:70,
                 from I:/mozilla/nsprpub/pr/src/io/prfdcach.c:38:
I:/mozilla/obj-fb/dist/include/nspr/private/pprthred.h:354: error: parse error
before '*' token
I:/mozilla/obj-fb/dist/include/nspr/private/pprthred.h:355: error: parse error
before '*' token
In file included from I:/mozilla/obj-fb/dist/include/nspr/md/prosdep.h:60,
                 from I:/mozilla/nsprpub/pr/include/private/primpl.h:78,
                 from I:/mozilla/nsprpub/pr/src/io/prfdcach.c:38:
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:156: error: parse error before "HDIR"
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:156: warning: no semicolon at end
of struct or union
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:158: error: parse error before
"FILEFINDBUF3"
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:158: warning: no semicolon at end
of struct or union
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:159: warning: type defaults to
`int' in declaration of `large'
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:159: warning: data definition has
no type or storage class
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:160: warning: type defaults to
`int' in declaration of `d_entry'
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:160: warning: data definition has
no type or storage class
I:/mozilla/obj-fb/dist/include/nspr/md/_os2.h:164: error: parse error before '}'
token
In file included from I:/mozilla/obj-fb/dist/include/nspr/md/prosdep.h:164,
                 from I:/mozilla/nsprpub/pr/include/private/primpl.h:78,
                 from I:/mozilla/nsprpub/pr/src/io/prfdcach.c:38:
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:154:2: #error "pthreads is not
supported for this architecture"
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:267:2: #error "pthreads is not
supported for this architecture"
I:/mozilla/obj-fb/dist/include/nspr/md/_pth.h:300:2: #error "Need to define
_PT_PTHREAD_YIELD for this platform"
In file included from I:/mozilla/nsprpub/pr/src/io/prfdcach.c:38:
I:/mozilla/nsprpub/pr/include/private/primpl.h:1759: error: field `md' has
incomplete type
make.exe[6]: *** [prfdcach.o] Error 1
make.exe[6]: Leaving directory `I:/mozilla/obj-fb/nsprpub/pr/src/io'
make.exe[5]: *** [export] Error 2
...

Expected Results:  
Built a working firefox.exe
I believe this is working as it should. It is the developers responsibility to
add ac_add_options --without-pthreads to .mozconfig, or to imeplement the
pthreads code.

If we make it so that we always disable pthreads, when innotek adds pthreads
support, we will have to make yet another code change to back this out.
Ok fair enough, it is definately not hard to add ac_add_options
--without-pthreads to .mozconfig. The question becomes will OS/2 ever enable
pthreads support? It seems to me that native threading will always be superiour
but I don't know enough about it.
If it is important to keep the way clear for adding pthreads support at a later
date then the resolution is as simple as a note somewhere, perhaps on the
ports/os2 page or just published in the newsgroup to close the bug.
If someone were to write pthreads support for Mozilla, we would certainly take
it at least to see what it would do. 
USE_PTHREADS defaults to being unset for all platforms.  Only the platforms
which have pthreads support have it enabled in configure.in.  I'm not sure how
simply installing the pthread headers would cause pthread support to be
partially enabled.

Can you attach your complete configure output and nsprpub/config.log files? 
Btw, when you modify configure.in, you need to run autoconf-2.13 in the same
directory to regenerate configure.
Assignee: nobody → wtchang
Component: Build Config → NSPR
Product: Firefox → NSPR
QA Contact: build.config → wtchang
Version: unspecified → 4.6.3
Here is the configure output. Note that the pthread headers and library were
installed (for a different project)
Attached file nsprpub/config.log
Here is the nsprpub/config.log
So the problem is in the --with-pthreads configure option.  For the default case, it sets USE_PTHREADS=1 if configure has detected that the pthread library exists and USE_USER_PTHREADS or USE_NSPR_THREADS isn't set.  FWIW, for win32, we unset USE_PTHREADS after the configure option is processed.  If you want to leave open the possibility of future pthreads support (which looks like it will need future code changes anyway), then we should probably explicitly set USE_NSPR_THREADS=1 in the os2 section.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Chris: USE_PTHREADS=1 can only be used for Unix.
USE_PTHREADS=1 means "use the code in nsprpub/pr/src/pthreads".
That directory contains not only threading but also
I/O functions, and the code uses various Unix functions.
So that code can't be used on OS/2 or Win32.
Attached patch v1Splinter Review
Ok, we'll just add os2 to the win32 block that unsets USE_PTHREADS.
Attachment #203473 - Flags: review?(wtchang)
Comment on attachment 203473 [details] [diff] [review]
v1

r=wtc.  We can also add beos to that list.
Attachment #203473 - Flags: review?(wtchang) → review+
The patch has been checked in with beos added to the list.

Checking in nsprpub/configure;
/cvsroot/mozilla/nsprpub/configure,v  <--  configure
new revision: 1.204; previous revision: 1.203
done
Checking in nsprpub/configure.in;
/cvsroot/mozilla/nsprpub/configure.in,v  <--  configure.in
new revision: 1.206; previous revision: 1.205
done
Checking in nsprpub/configure;
/cvsroot/mozilla/nsprpub/configure,v  <--  configure
new revision: 1.78.2.122; previous revision: 1.78.2.121
done
Checking in nsprpub/configure.in;
/cvsroot/mozilla/nsprpub/configure.in,v  <--  configure.in
new revision: 1.83.2.120; previous revision: 1.83.2.119
done
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Thanks, cls.

Dave, could you update your Mozilla source tree and
verify the bug fix?
Whiteboard: [4.7]
Seamonkey now builds fine without having to disable pthreads.
Thank you
Status: RESOLVED → VERIFIED
Whiteboard: [4.7]
Target Milestone: --- → 4.7
Version: 4.6.3 → 4.6.1
You need to log in before you can comment on or make changes to this bug.