Bug 110236

Summary: [CMake] Undefined references should be detected at build time
Product: WebKit Reporter: Balazs Kelemen <kbalazs>
Component: PlatformAssignee: Balazs Kelemen <kbalazs>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, eflews.bot, gyuyoung.kim, gyuyoung.kim, laszlo.gombos, ossy, paroga, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from APPLE-EWS-5 for win-future
none
Patch cdumez: review+

Balazs Kelemen
Reported 2013-02-19 10:17:19 PST
Currently the build can survive undefined references, this is not convenient.
Attachments
Patch (7.78 KB, patch)
2013-02-19 10:24 PST, Balazs Kelemen
no flags
Patch (12.28 KB, patch)
2013-02-26 04:20 PST, Balazs Kelemen
no flags
Patch (10.15 KB, patch)
2013-06-25 10:14 PDT, Balazs Kelemen
no flags
Patch (11.38 KB, patch)
2013-06-25 12:46 PDT, Balazs Kelemen
no flags
Archive of layout-test-results from APPLE-EWS-5 for win-future (791.82 KB, application/zip)
2013-06-25 18:34 PDT, Build Bot
no flags
Patch (10.77 KB, patch)
2013-07-05 07:52 PDT, Balazs Kelemen
cdumez: review+
Balazs Kelemen
Comment 1 2013-02-19 10:24:59 PST
EFL EWS Bot
Comment 2 2013-02-19 11:38:38 PST
Balazs Kelemen
Comment 3 2013-02-26 04:20:58 PST
Balazs Kelemen
Comment 4 2013-04-15 04:57:11 PDT
Could you reevaluate this thing? According to my memory Laszlo and others were ok with the change, but Raphael mentioned we should not force such build options out-of-box because packagers should be free to decide such things. Personally I don't agree with that, because first it does not cause any harm for packagers since it's just a sanity check, second not having the build system find out link issues automatically is harmful for productivity. Anyway, I'm ok with either decision, just let's put and end on the question.
Chris Dumez
Comment 5 2013-04-15 04:59:24 PDT
I also support this change. This makes debugging "undefined symbols" errors a lot easier. I also don't think it is normal if our library has missing symbols and such thing should be caught as early as possible.
Laszlo Gombos
Comment 6 2013-06-20 12:11:33 PDT
Maybe we should break this patch into 2 parts - the somewhat controversial linker flag and the rest of the changes that should be good to land..
Balazs Kelemen
Comment 7 2013-06-23 14:38:12 PDT
(In reply to comment #6) > Maybe we should break this patch into 2 parts - the somewhat controversial linker flag and the rest of the changes that should be good to land.. Actually I'm not sure there is too much value of those changes without the flag. These dependencies are actually satisfied at runtime or some implicit or transitive way. I just had to add them because otherwise linking fails with --no-undefined. Do you think it's really useful to harden the linking by explicitly define these dependencies?
Raphael Kubo da Costa (:rakuco)
Comment 8 2013-06-24 08:36:49 PDT
Comment on attachment 190258 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190258&action=review As we've just discussed on IRC, I don't really have much against passing --no-undefined to the linker these days. I've added some items that should be addressed before landing. Additionally, I agree with Laszlo that it makes sense to land this in two parts: the part which adds dependencies can be landed first since it doesn't depend on --no-undefined, and the rest can be added later. > Source/WebKit2/CMakeLists.txt:586 > + rt -lrt is Linux-specific. Instead, I suggest looking for it via FIND_LIBRARY(). It could even be done in the top-level CMakeLists.txt. > Source/cmake/OptionsCommon.cmake:36 > +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") Can't we use if (UNIX) or if (UNIX AND NOT APPLE) if it that really breaks OS X (gcc -Wl,--foobarbla worked here, even if ld --foobarbla doesn't)? > Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:1 > +find_package(X11 REQUIRED) We already call this in OptionsEFL.cmake; if it's needed by other ports, it's better to just move the call to OptionsCommon.cmake.
Laszlo Gombos
Comment 9 2013-06-24 09:25:22 PDT
Comment on attachment 190258 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=190258&action=review Overall this patch needs another iteration to address Raphael's and my comments. > Source/WebCore/ChangeLog:8 > + Push --no-undefined to the linker if building on Linux. Pass the --no-undefined argument to the linker when building on Linux. > Source/WebKit2/ChangeLog:8 > + Push --no-undefined to the linker if building on Linux. Ditto.
Balazs Kelemen
Comment 10 2013-06-25 09:49:11 PDT
(In reply to comment #8) > (From update of attachment 190258 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=190258&action=review > > As we've just discussed on IRC, I don't really have much against passing --no-undefined to the linker these days. I've added some items that should be addressed before landing. > > Additionally, I agree with Laszlo that it makes sense to land this in two parts: the part which adds dependencies can be landed first since it doesn't depend on --no-undefined, and the rest can be added later. I don't think this would buy us anything. The only reason to fix the dependencies is to be able to use --no-undefined and the only thing that can prove the correctness of those changes is to add the flag. > > > Source/WebKit2/CMakeLists.txt:586 > > + rt > > -lrt is Linux-specific. Instead, I suggest looking for it via FIND_LIBRARY(). It could even be done in the top-level CMakeLists.txt. find_library is a good idea. This is only a dependency of WebKit2 so I would keep it there (i.e. ports that don't support WebKit2 do not need this). > > > Source/cmake/OptionsCommon.cmake:36 > > +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") > > Can't we use if (UNIX) or if (UNIX AND NOT APPLE) if it that really breaks OS X (gcc -Wl,--foobarbla worked here, even if ld --foobarbla doesn't)? Good idea. > > > Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:1 > > +find_package(X11 REQUIRED) > > We already call this in OptionsEFL.cmake; if it's needed by other ports, it's better to just move the call to OptionsCommon.cmake. I think OptionsCommon.cmake should not contain any such platform specific bits. I will remove it and and we can see whether all ports that build this are fine with it.
Balazs Kelemen
Comment 11 2013-06-25 10:14:34 PDT
EFL EWS Bot
Comment 12 2013-06-25 10:20:28 PDT
Balazs Kelemen
Comment 13 2013-06-25 12:46:24 PDT
Build Bot
Comment 14 2013-06-25 18:34:37 PDT
Comment on attachment 205417 [details] Patch Attachment 205417 [details] did not pass win-ews (win): Output: http://webkit-queues.appspot.com/results/913386 New failing tests: fast/workers/worker-close-more.html
Build Bot
Comment 15 2013-06-25 18:34:40 PDT
Created attachment 205436 [details] Archive of layout-test-results from APPLE-EWS-5 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: APPLE-EWS-5 Port: win-future Platform: CYGWIN_NT-6.1-WOW64-1.7.20-0.266-5-3-i686-32bit
Balazs Kelemen
Comment 16 2013-07-04 00:27:27 PDT
Everything is green. Could you review the new patch?
Raphael Kubo da Costa (:rakuco)
Comment 17 2013-07-05 05:15:03 PDT
Comment on attachment 205417 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205417&action=review > Source/WebCore/CMakeLists.txt:2953 > +set(WebCoreTestSupport_LIBRARIES > + JavaScriptCore > + WTF > + WebCore > +) Did you get any crashes without this? It worked fine for me without defining any libraries (and SHARED_CORE=ON). > Source/WebKit2/CMakeLists.txt:611 > +if (WTF_OS_LINUX) I thought we were moving away from defining WTF variables in CMake? The following looks better to me: # librt is needed for shm_open in libc. find_library(LIBRT_LIBRARIES NAMES rt) if (LIBRT_LIBRARIES) list(APPEND WebKit2_LIBRARIES ${LIBRT_LIBRARIES}) endif () > Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:1 > +find_package(X11 REQUIRED) Weren't you going to experiment with not calling this one?
Balazs Kelemen
Comment 18 2013-07-05 07:52:08 PDT
Balazs Kelemen
Comment 19 2013-07-05 07:58:01 PDT
(In reply to comment #17) > (From update of attachment 205417 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=205417&action=review > > > Source/WebCore/CMakeLists.txt:2953 > > +set(WebCoreTestSupport_LIBRARIES > > + JavaScriptCore > > + WTF > > + WebCore > > +) > > Did you get any crashes without this? It worked fine for me without defining any libraries (and SHARED_CORE=ON). No crash but undefined references makes the build fail. The linker don't know that at runtime those libraries will be loaded before this one. > > > Source/WebKit2/CMakeLists.txt:611 > > +if (WTF_OS_LINUX) > > I thought we were moving away from defining WTF variables in CMake? The following looks better to me: > # librt is needed for shm_open in libc. > find_library(LIBRT_LIBRARIES NAMES rt) > if (LIBRT_LIBRARIES) > list(APPEND WebKit2_LIBRARIES ${LIBRT_LIBRARIES}) > endif () Fine to me, fixed. > > > Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:1 > > +find_package(X11 REQUIRED) > > Weren't you going to experiment with not calling this one? Right, I was forgetting this. Fixed.
Raphael Kubo da Costa (:rakuco)
Comment 20 2013-07-05 08:41:08 PDT
(In reply to comment #19) > (In reply to comment #17) > > (From update of attachment 205417 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=205417&action=review > > > > > Source/WebCore/CMakeLists.txt:2953 > > > +set(WebCoreTestSupport_LIBRARIES > > > + JavaScriptCore > > > + WTF > > > + WebCore > > > +) > > > > Did you get any crashes without this? It worked fine for me without defining any libraries (and SHARED_CORE=ON). > > No crash but undefined references makes the build fail. The linker don't know that at runtime those libraries will be loaded before this one. Sorry, I meant I tried your patch and removed those lines, and everything still worked and linked fine.
Balazs Kelemen
Comment 21 2013-07-05 08:46:59 PDT
(In reply to comment #20) > (In reply to comment #19) > > (In reply to comment #17) > > > (From update of attachment 205417 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=205417&action=review > > > > > > > Source/WebCore/CMakeLists.txt:2953 > > > > +set(WebCoreTestSupport_LIBRARIES > > > > + JavaScriptCore > > > > + WTF > > > > + WebCore > > > > +) > > > > > > Did you get any crashes without this? It worked fine for me without defining any libraries (and SHARED_CORE=ON). > > > > No crash but undefined references makes the build fail. The linker don't know that at runtime those libraries will be loaded before this one. > > Sorry, I meant I tried your patch and removed those lines, and everything still worked and linked fine. I see. Thanks for trying. I think I added these because first time the build was failing on the ews. I guess it fails without SHARED_CORE=ON. I am going to try that locally.
Balazs Kelemen
Comment 22 2013-07-07 14:41:56 PDT
> > Sorry, I meant I tried your patch and removed those lines, and everything still worked and linked fine. > > I see. Thanks for trying. I think I added these because first time the build was failing on the ews. I guess it fails without SHARED_CORE=ON. I am going to try that locally. Yes, if I not make libTestWebKitSupport explicitly link against the other libraries the build fails _without_ SHARED_CORE=ON.
Raphael Kubo da Costa (:rakuco)
Comment 23 2013-07-08 05:47:01 PDT
Right, LGTM then. Thank you :-)
Chris Dumez
Comment 24 2013-07-16 00:00:28 PDT
Comment on attachment 206150 [details] Patch Ok, r=me. Thanks for the informal review Rakuco.
Csaba Osztrogonác
Comment 25 2015-02-26 06:56:07 PST
Note You need to log in before you can comment on or make changes to this bug.