Closed Bug 35205 Opened 25 years ago Closed 25 years ago

Viewer doesn't link on FreeBSD: -pthread missing

Categories

(Core Graveyard :: Viewer App, defect, P3)

x86
FreeBSD
defect

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 35127

People

(Reporter: lennox, Assigned: waqar)

Details

Attachments

(3 files)

(I'm not sure if this should be filed under viewer or whoever's responsible for the makefiles...re-file if necessary). On FreeBSD 3.4, Linking viewer_gtk fails as follows: g++295 -o viewer_gtk nsBaseDialog.o nsFindDialog.o nsXPBaseWindow.o nsTableInspectorDialog.o nsImageInspectorDialog.o nsPrintSetupDialog.o nsBrowserWindow.o nsEditorMode.o nsSetupRegistry.o nsThrobber.o nsViewerApp.o nsWebCrawler.o nsWebBrowserChrome.o -L../../../dist/bin -L../../../dist/lib -lviewer_gtk_s -lgtksuperwin ../../../dist/lib/libtimer_s.a ../../../dist/lib/libwidgetsupport_s.a -lraptorgfx -lmozjs -L../../../dist/bin -lxpcom -ljsj -lplds4 -lplc4 -lnspr4 -L/usr/X11R6/lib -L/usr/X11R6/lib -lgtk12 -lgdk12 -L/usr/local/lib -Wl,-E -lgmodule12 -lglib12 -lintl -lxpg4 -lXext -lX11 -lm -lintl -lutil -lm ../../../dist/bin/libnspr4.so: undefined reference to `pthread_cond_signal' ../../../dist/bin/libnspr4.so: undefined reference to `pthread_attr_destroy' ../../../dist/bin/libnspr4.so: undefined reference to `pthread_create' ../../../dist/bin/libnspr4.so: undefined reference to `pthread_getspecific' ../../../dist/bin/libnspr4.so: undefined reference to `pthread_attr_init' ../../../dist/bin/libnspr4.so: undefined reference to `pthread_condattr_init' [[ ... lots more pthread symbols undefined ... ]] collect2: ld returned 1 exit status gmake[3]: *** [viewer_gtk] Error 1 The problem is that the -pthread flag isn't getting passed to the link line. The reason for this is that the Makefile line to link $(PROGRAM)_gtk includes $(LDFLAGS) but not $(CXXFLAGS), but the FreeBSD autoconf logic which inserts the -pthread flag puts it only in $(CCFLAGS) and $(CXXFLAGS), not in $(LDFLAGS). There are two fixes possible here. One is to add $(CXXFLAGS) to the link lines in mozilla/webshell/tests/viewer/Makefile.in, bringing it in line with the link lines in mozilla/config/rules.mk. The other is to change autoconf to put -pthread into $(LDFLAGS) on FreeBSD. I'll attach a patch to do the former; it's the easier fix, even though the latter might be technically more correct. A workaround is to configure --disable-tests. (This is the reason why I haven't run into this bug before: bug 28699 could also be worked around with --disable-tests. The recent changes to the build system have caused this problem to be hit before that one.) This is FreeBSD 3.4, compiling with gcc 2.95.2 built out of the FreeBSD ports directory.
This is a duplicate of 35127, though the analysis here is more thorough I think, plus there's a patch, so I dunno which bug should be marked "duplicate".
waqar please take a look.
Assignee: rickg → waqar
I think we should fix the autoconf script to put the -pthreads on the LDFLAGS.
Status: NEW → ASSIGNED
Target Milestone: --- → M16
Okay, here are some patches to do that. There are two separate patches here: 1. Add the -pthread flag to the _PTHREAD_LDFLAGS variable in configure.in for FreeBSD. (Regenerate configure after applying this patch.) The problem with this is that the -pthread flag gets passed twice in normal link lines. I don't know if this hurts anything on FreeBSD, but it certainly seems conceptually wrong. So, my second patch: 2. Remove $(CFLAGS) and $(CXXFLAGS) from all link rules in config/rules.mk. Should #2 be filed as a separate bugzilla report? It has a lot more possibility of affecting other platforms. (However, any platform which has a problem with it must already be failing to link viewer, I think.) I've built Mozilla from scratch on FreeBSD with both patches applied. Haven't tested any other platforms, though.
*** This bug has been marked as a duplicate of 35127 ***
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
Verified duplicate.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: