RESOLVED FIXED 144557
[GTK] OSX linker doesn't understand --whole-archive
https://bugs.webkit.org/show_bug.cgi?id=144557
Summary [GTK] OSX linker doesn't understand --whole-archive
Philip Chimento
Reported 2015-05-03 16:50:49 PDT
On OSX, the linker doesn't understand --whole-archive. This causes the build to fail due to ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES) in PlatformGTK.cmake. The corresponding option for the OSX linker is -all_load and -noall_load.
Attachments
Patch (2.24 KB, patch)
2015-05-07 23:20 PDT, Philip Chimento
no flags
Patch (4.26 KB, patch)
2015-10-12 15:26 PDT, Philip Chimento
no flags
Patch (4.29 KB, patch)
2015-10-12 15:37 PDT, Philip Chimento
no flags
Philip Chimento
Comment 1 2015-05-07 23:15:23 PDT
However, using -all_load or -force_load makes MiniBrowser hit an assertion failure on startup: ASSERTION FAILED: m_key != PTHREAD_KEYS_MAX /Users/fliep/gtk/source/webkitgtk-2.8.0/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp(65) : static ThreadIdentifier WTF::ThreadIdentifierData::identifier() 1 0x11509d1d0 2 0x1150fb11d 3 0x1150fc8cd 4 0x1150a8a06 5 0x112c8ab9e 6 0x112c3fc6e 7 0x112e53ecf 8 0x112e4c558 9 0x112e4c1fd 10 0x112e4c190 11 0x1131e38db 12 0x1131e3865 13 0x1131d97d5 14 0x11a29b452 15 0x11a27fa55 16 0x11a27edce 17 0x11a27ea08 18 0x1131d981b 19 0x10dcc5a03 20 0x10dcbc694 Segmentation fault: 11 Simply leaving off the option seems to work fine. I'll upload a patch to that effect.
Philip Chimento
Comment 2 2015-05-07 23:20:04 PDT
Philippe Normand
Comment 3 2015-10-12 09:12:08 PDT
I'm not sure about this patch. What do you think Martin, Carlos?
Martin Robinson
Comment 4 2015-10-12 09:21:06 PDT
Comment on attachment 252688 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252688&action=review Seems sensible to me, but this patch needs a bit of work. Thanks! > Source/WebKit2/PlatformGTK.cmake:549 > -ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES) > +if (CMAKE_SYSTEM_NAME MATCHES "Linux") > + ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES) > +endif () It would be better to add this check to the ADD_WHOLE_ARCHIVE_TO_LIBRARIES macro instead of requiring it for every invocation. > Source/WebKit2/PlatformGTK.cmake:875 > - COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS= > + COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS=-lGObjectDOMBindings This looks unrelated. > Source/WebKit2/PlatformGTK.cmake:890 > + --library=c++ Ditto.
Philip Chimento
Comment 5 2015-10-12 12:48:22 PDT
(In reply to comment #4) > Comment on attachment 252688 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=252688&action=review > > Seems sensible to me, but this patch needs a bit of work. Thanks! > > > Source/WebKit2/PlatformGTK.cmake:549 > > -ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES) > > +if (CMAKE_SYSTEM_NAME MATCHES "Linux") > > + ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES) > > +endif () > > It would be better to add this check to the ADD_WHOLE_ARCHIVE_TO_LIBRARIES > macro instead of requiring it for every invocation. Sure. I'll also change it to NOT CMAKE_SYSTEM_MATCHES "Darwin" in order to be more specific like I did in #144555. > > Source/WebKit2/PlatformGTK.cmake:875 > > - COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS= > > + COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS=-lGObjectDOMBindings > > This looks unrelated. These are related though; it's what I was referring to with "link with extra libraries instead" in the patch's changelog. Without --whole-archive, these libraries don't get picked up for linking, so I have to add them manually. I wonder if it might make sense to get rid of the ADD_WHOLE_ARCHIVE_TO_LIBRARIES macro entirely, since all the necessary libraries are now added manually. Alternatively, I could bracket these manual additions inside CMAKE_SYSTEM_NAME checks.
Martin Robinson
Comment 6 2015-10-12 13:16:04 PDT
Comment on attachment 252688 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252688&action=review >>> Source/WebKit2/PlatformGTK.cmake:875 >>> + COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS=-lGObjectDOMBindings >> >> This looks unrelated. > > These are related though; it's what I was referring to with "link with extra libraries instead" in the patch's changelog. Without --whole-archive, these libraries don't get picked up for linking, so I have to add them manually. > > I wonder if it might make sense to get rid of the ADD_WHOLE_ARCHIVE_TO_LIBRARIES macro entirely, since all the necessary libraries are now added manually. Alternatively, I could bracket these manual additions inside CMAKE_SYSTEM_NAME checks. If you can get WebKitGTK+ to compile properly on Linux and on the build bots without ADD_WHOLE_ARCHIVE_TO_LIBRARIES, feel free to remove it. >> Source/WebKit2/PlatformGTK.cmake:890 >> + --library=c++ > > Ditto. Hrm. Is c++ a system library or a special value understood by g-ir-scanner? If it's the latter, is it documented somewhere?
Philip Chimento
Comment 7 2015-10-12 15:14:34 PDT
(In reply to comment #6) > >> Source/WebKit2/PlatformGTK.cmake:890 > >> + --library=c++ > > > > Ditto. > > Hrm. Is c++ a system library or a special value understood by g-ir-scanner? > If it's the latter, is it documented somewhere? libc++ is LLVM's version of libstdc++, so it's a system library. That makes me realize though, that I'd need to add libstdc++ on normal systems and libc++ on systems using XCode's linker. So I think removing ADD_WHOLE_ARCHIVE_TO_LIBRARIES is a non-starter; better to use --whole-archive when it's available.
Philip Chimento
Comment 8 2015-10-12 15:26:44 PDT
Philip Chimento
Comment 9 2015-10-12 15:27:34 PDT
Here's a new patch with the check inside the macro, as suggested, and everything inside CMAKE_SYSTEM_NAME checks.
Martin Robinson
Comment 10 2015-10-12 15:31:56 PDT
Comment on attachment 262929 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262929&action=review Looks good, but I want to suggest one small thing before committing the patch. > Source/WebKit2/PlatformGTK.cmake:929 > + set(DARWIN_ADDITIONAL_LIBRARIES --library=c++) > + set(DARWIN_ADDITIONAL_LDFLAGS -lGObjectDOMBindings) Do you mind renaming these to INTROSPECTION_ADDITIONAL_LIBRARIES and INTROSPECTION_ADDITIONAL_LDFLAGS to make it consistent with INTROSPECTION_ADDITIONAL_LIBRARY_PATH?
Philip Chimento
Comment 11 2015-10-12 15:37:16 PDT
Philip Chimento
Comment 12 2015-10-12 15:38:02 PDT
Sure thing, here it is. Thanks for the review.
WebKit Commit Bot
Comment 13 2015-10-12 17:38:23 PDT
Comment on attachment 262930 [details] Patch Clearing flags on attachment: 262930 Committed r190909: <http://trac.webkit.org/changeset/190909>
WebKit Commit Bot
Comment 14 2015-10-12 17:38:27 PDT
All reviewed patches have been landed. Closing bug.
Jeremy Huddleston Sequoia
Comment 15 2016-01-14 23:21:55 PST
This was fixed incorrectly. Following up in bug #153117
Note You need to log in before you can comment on or make changes to this bug.