RESOLVED FIXED Bug 16406
[Gtk] JavaScriptCore needs -lpthread
https://bugs.webkit.org/show_bug.cgi?id=16406
Summary [Gtk] JavaScriptCore needs -lpthread
Seo Sanghyeon
Reported 2007-12-11 19:16:46 PST
JavaScriptCore build is missing -lpthread. This results in a build failure like: tmp/collector.o: In function `KJS::currentThreadStackBase()': collector.cpp:(.text+0x203): undefined reference to `pthread_getattr_np' collector.cpp:(.text+0x21b): undefined reference to `pthread_attr_getstack' tmp/collector.o: In function `KJS::Collector::markCurrentThreadConservatively()': collector.cpp:(.text+0x825): undefined reference to `pthread_getattr_np' collector.cpp:(.text+0x83d): undefined reference to `pthread_attr_getstack' collect2: ld returned 1 exit status In Gtk port, JavaScriptCore is built using compiler flags from icu-config. Normally, icu-config output includes -lpthread, like: -lpthread -lm -L/usr/lib -licui18n -licuuc -licudata -lpthread -lm But one doesn't need to link against libpthread when one is using only ICU functions. So as a part of general campaign to reduce spurious library dependency, Debian's icu-config doesn't output -lpthread starting from 3.8-5. Then the output looks like: -lm -L/usr/lib -licui18n -licuuc -licudata -lm
Attachments
Include -lpthread (480 bytes, patch)
2007-12-11 19:24 PST, Seo Sanghyeon
mrowe: review-
Remove kjs pthread dependency (1.75 KB, patch)
2007-12-11 20:20 PST, Alp Toker
mrowe: review-
Prospective build fix (1.13 KB, patch)
2007-12-12 09:15 PST, Alp Toker
alp: review+
Seo Sanghyeon
Comment 1 2007-12-11 19:24:37 PST
Created attachment 17858 [details] Include -lpthread
Mark Rowe (bdash)
Comment 2 2007-12-11 19:50:46 PST
Comment on attachment 17858 [details] Include -lpthread You should set the review flag to ? if you'd like your patch looked at for review. You should also include a description of your change in the ChangeLog at JavaScriptCore/ChangeLog. See http://webkit.org/coding/contributing.html for more info. The change looks fine to me. It's not great to always add -lpthread as some platforms may not use pthreads, but as JavaScriptCore makes the assumption that they do when building multi-threaded I think it's fine for the meantime. Marking as r- for now pending a ChangeLog entry. Thanks for the patch!
Alp Toker
Comment 3 2007-12-11 20:20:17 PST
Created attachment 17859 [details] Remove kjs pthread dependency Proposed fix (needs review from someone who knows the collector and what correct behaviour is when threading is disabled)
Mark Rowe (bdash)
Comment 4 2007-12-11 21:06:58 PST
Comment on attachment 17859 [details] Remove kjs pthread dependency That will prevent the stack from being scanned at all, which is really bad.
Mike Hommey
Comment 5 2007-12-11 22:25:33 PST
Check out bug #15118, which is exactly the same issue, except that in the end, I couldn't reproduce with the icu not having -lpthread in its -config script.
Mike Hommey
Comment 6 2007-12-11 22:27:49 PST
(In reply to comment #5) > Check out bug #15118, which is exactly the same issue, except that in the end, > I couldn't reproduce with the icu not having -lpthread in its -config script. It could actually be reproduced by debian buildds... http://buildd.debian.org/fetch.cgi?pkg=webkit;ver=0%7Esvn27674-1;arch=sparc;stamp=1197008842
Alp Toker
Comment 7 2007-12-12 09:15:55 PST
Created attachment 17864 [details] Prospective build fix This patch links to pthread only when not building on Windows, and does it in JavaScriptCore.pri rather than testkjs.pro as proposed previously. Untested since I can't reproduce the build breakage. Can someone try this?
Alp Toker
Comment 8 2007-12-13 11:37:42 PST
Comment on attachment 17864 [details] Prospective build fix Build fix; tested and works.
Alp Toker
Comment 9 2007-12-13 11:38:40 PST
Landed in r28692.
Note You need to log in before you can comment on or make changes to this bug.