Closed
Bug 4179
Opened 26 years ago
Closed 25 years ago
configure.in patch for FreeBSD pthread build
Categories
(SeaMonkey :: Build Config, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
M5
People
(Reporter: lennox, Assigned: briano)
References
()
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
FreeBSD needs to have -pthread specified in order to build code with Pthreads.
It must *not* link with -lc when it's doing so; -pthread implies linkage with
-lc_r, and Very Bad Things happen when you link with -lc and -lc_r
simultaneously. (g++ automatically links with -lc unless you specify -pthread,
which is why we can't just specify -lc_r.)
This patch (also available at the URL above, in case form submission mangles the
patch) fixes things for autoconf. A corresponding patch is also necessary for
nspr; this has been posted to the netscape.public.mozilla.nspr.
Index: configure.in
===================================================================
RCS file: /cvsroot/mozilla/configure.in,v
retrieving revision 1.221
diff -u -r1.221 configure.in
--- configure.in 1999/03/18 03:11:15 1.221
+++ configure.in 1999/03/23 05:25:39
@@ -415,8 +415,7 @@
dnl Checks for libraries.
dnl ========================================================
-AC_CHECK_LIB(c_r, gethostbyname_r,,
- AC_CHECK_LIB(c, strcpy))
+AC_CHECK_LIB(c_r, gethostbyname_r)
AC_CHECK_LIB(m, atan)
AC_CHECK_LIB(dl, dlopen)
if [ test -z "$GNU_CXX" ]; then
@@ -1281,6 +1280,9 @@
CFLAGS="$CFLAGS -pthread"
CXXFLAGS="$CXXFLAGS -pthread"
fi ;;
+ *-*-freebsd*)
+ CFLAGS="$CFLAGS -pthread"
+ CXXFLAGS="$CXXFLAGS -pthread"
esac
fi] )
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•26 years ago
|
||
I need to do some testing before I check this in. Does this apply to
all CPU architectures (i.e., not just x86)? Which FreeBSD release are
you using?
Reporter | ||
Comment 3•26 years ago
|
||
I'm using FreeBSD 3.1-STABLE, but I believe the -pthread behavior applies in all
versions of FreeBSD with enough threading support that you'd want to turn
pthreads on. This is from the pthread(3) man page on 3.1-STABLE:
A FreeBSD specific option has been added to gcc to make linking threaded
processes simple. gcc -pthread links a threaded process against libc_r
instead of libc.
The same text appears in pthread(3) on 2.2.7. There's no mention of it being
arch-specific.
One concern is that this option was only added to the FreeBSD egcs port
recently, so if you want to compile with egcs on FreeBSD you need to grab a
current ports collection and build egcs out of that. If you're compiling with
gcc 2.7.2.1 as distributed with the system there's no problem, though.
There's been some discussion of the patch on netscape.public.mozilla.builds; see
<news://secnews.netscape.com/7d79cc$fdg1@secnews.netscape.com> and its
follow-ups. The patch at the URL specified above has been modified according to
the discussion there.
I'm more concerned, from a cross-platform standpoint, about the removal of the
AC_CHECK_LIB(c, strcpy) line. Since I can't imagine any reason why it would
ever be necessary, there're two possibilities: it *was* unnecessary, so taking
out shouldn't hurt anything; or it has some very non-obvious effect on some
obscure platform. CVSBlame doesn't reveal anything interesting about why it was
put in in the first place, unfortunately.
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 4•25 years ago
|
||
I _think_ this might be fixed now. Maybe. Please try
revision 1.142 of configure (1.264 of configure.in), and
reopen this bug if things are still not right.
Reporter | ||
Updated•25 years ago
|
Status: RESOLVED → REOPENED
Reporter | ||
Comment 5•25 years ago
|
||
With this new patch (see attachment), I build sucessfully on FreeBSD. There
are three changes:
1. Don't check libc for strcpy. This makes the link line link in -lc
explicitly; this does very bad things, since you musn't link with -lc and -lc_r
simultaneously on FreeBSD.
2. If we find pthread_attr_init in libc_r, make sure USE_PTHREADS is set, or all
the other pthreads code doesn't work.
3. Once we've specified -pthread for the link line for FreeBSD, don't link in
-lc_r explicitly.
There's also a typo fix (the warning should be for --with-pthreads specified for
a system *without* pthreads support).
With all this, Mozilla builds and runs on FreeBSD (except for Registry problems
which seem to be cross-platform, and unrelated).
Reporter | ||
Comment 6•25 years ago
|
||
Assignee | ||
Updated•25 years ago
|
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Assignee | ||
Comment 7•25 years ago
|
||
Your changes are checked in. Thanks again!
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•