Bug 90973

Summary: [CMake] Make gtest a shared library
Product: WebKit Reporter: Thiago Marcos P. Santos <tmpsantos>
Component: Tools / TestsAssignee: Thiago Marcos P. Santos <tmpsantos>
Status: RESOLVED FIXED    
Severity: Normal CC: dbates, gyuyoung.kim, rakuco, rwlbuis, sw0524.lee, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 90606, 91221    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Thiago Marcos P. Santos 2012-07-11 04:45:34 PDT
It's nicer to make it a shared library because it might improve linking time and we don't need to force gtest users to link with gtest dependencies.
Comment 1 Thiago Marcos P. Santos 2012-07-11 04:51:43 PDT
Created attachment 151680 [details]
Patch
Comment 2 Raphael Kubo da Costa (:rakuco) 2012-07-12 13:18:00 PDT
Comment on attachment 151680 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=151680&action=review

I wonder if this is really needed -- gtest is only needed by unit tests, whose linking time isn't very important, and pthreads would need to be present anyway for gtest to be built.

> Source/cmake/gtest/CMakeLists.txt:26
> +IF(CMAKE_USE_PTHREADS_INIT)

You need FIND_PACKAGE(Threads) to use this. Plus, shouldn't you just always link to the thread library?
Comment 3 Thiago Marcos P. Santos 2012-07-12 14:27:35 PDT
Comment on attachment 151680 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=151680&action=review

>> Source/cmake/gtest/CMakeLists.txt:26
>> +IF(CMAKE_USE_PTHREADS_INIT)
> 
> You need FIND_PACKAGE(Threads) to use this. Plus, shouldn't you just always link to the thread library?

FIND_PACKAGE(Threads) is done at Options${Platform} like the other FIND_PACKAGEs.

pthreads won't happen if you are building on Windows, remember that we are not the only customers of CMake build system and I want to make this reusable.
Comment 4 Raphael Kubo da Costa (:rakuco) 2012-07-12 14:38:08 PDT
Comment on attachment 151680 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=151680&action=review

>>> Source/cmake/gtest/CMakeLists.txt:26
>>> +IF(CMAKE_USE_PTHREADS_INIT)
>> 
>> You need FIND_PACKAGE(Threads) to use this. Plus, shouldn't you just always link to the thread library?
> 
> FIND_PACKAGE(Threads) is done at Options${Platform} like the other FIND_PACKAGEs.
> 
> pthreads won't happen if you are building on Windows, remember that we are not the only customers of CMake build system and I want to make this reusable.

Hmm, but don't you need to link to the equivalent thread library in other systems as well?
Comment 5 Thiago Marcos P. Santos 2012-07-12 15:02:11 PDT
Created attachment 152071 [details]
Patch

Rebased.
Comment 6 Thiago Marcos P. Santos 2012-07-12 15:13:03 PDT
(In reply to comment #4)
> (From update of attachment 151680 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=151680&action=review
> 
> >>> Source/cmake/gtest/CMakeLists.txt:26
> >>> +IF(CMAKE_USE_PTHREADS_INIT)
> >> 
> >> You need FIND_PACKAGE(Threads) to use this. Plus, shouldn't you just always link to the thread library?
> > 
> > FIND_PACKAGE(Threads) is done at Options${Platform} like the other FIND_PACKAGEs.
> > 
> > pthreads won't happen if you are building on Windows, remember that we are not the only customers of CMake build system and I want to make this reusable.
> 
> Hmm, but don't you need to link to the equivalent thread library in other systems as well?

I don't think threading support is mandatory, but don't expect for example that thread-safe death tests will be available in this case.
Comment 7 Gyuyoung Kim 2012-07-12 15:47:08 PDT
Comment on attachment 152071 [details]
Patch

Attachment 152071 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13180986
Comment 8 Thiago Marcos P. Santos 2012-07-16 05:05:19 PDT
Created attachment 152512 [details]
Patch
Comment 9 Gyuyoung Kim 2012-07-16 05:38:50 PDT
Comment on attachment 152512 [details]
Patch

Attachment 152512 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13253265
Comment 10 Thiago Marcos P. Santos 2012-07-16 06:15:33 PDT
(In reply to comment #9)
> (From update of attachment 152512 [details])
> Attachment 152512 [details] did not pass efl-ews (efl):
> Output: http://queues.webkit.org/results/13253265

[ 90%] /usr/bin/ld: ../../bin/test_ewk_view: hidden symbol `Building CXX object Source/WebKit2/CMakeFiles/ewebkit2.dir/UIProcess/WebGrammarDetail.cpp.o
WTF::fastMalloc(unsigned long)' in ../../lib/libwtf_efl.a(FastMalloc.cpp.o) is referenced by DSO
/usr/bin/ld: final link failed: Bad value


Weird, I don't get this error locally.
Comment 11 Thiago Marcos P. Santos 2012-07-16 07:39:14 PDT
Created attachment 152532 [details]
Patch
Comment 12 Gyuyoung Kim 2012-07-16 07:52:00 PDT
Comment on attachment 152532 [details]
Patch

Attachment 152532 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13242970
Comment 13 Thiago Marcos P. Santos 2012-07-16 07:58:48 PDT
Created attachment 152535 [details]
Patch

One more attempt to make EFL EWS happy. I really could not reproduce this linking error. :(
Comment 14 Gyuyoung Kim 2012-07-16 08:32:23 PDT
Comment on attachment 152535 [details]
Patch

Attachment 152535 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13243988
Comment 15 Thiago Marcos P. Santos 2012-07-16 09:53:21 PDT
Created attachment 152555 [details]
Patch

One more attempt.
Comment 16 Thiago Marcos P. Santos 2012-07-16 11:17:05 PDT
(In reply to comment #15)
> Created an attachment (id=152555) [details]
> Patch
> 
> One more attempt.

EWS is sane. Don't know why I was not having this linking errors on my desktop. The problem was gtest has now to link with WTF, since it uses it wrappers for memory allocation.
Comment 17 Daniel Bates 2012-07-17 17:02:22 PDT
Comment on attachment 152555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=152555&action=review

r=me

> ChangeLog:10
> +        dependencies like pthreads (and avoid linking errors when it is not

Nit: "and avoid" => "which produces" OR "which causes"
Comment 18 Thiago Marcos P. Santos 2012-07-18 02:35:44 PDT
Created attachment 152970 [details]
Patch

Updated patch. Thanks for reviewing.
Comment 19 WebKit Review Bot 2012-07-18 04:15:53 PDT
Comment on attachment 152970 [details]
Patch

Clearing flags on attachment: 152970

Committed r122943: <http://trac.webkit.org/changeset/122943>
Comment 20 WebKit Review Bot 2012-07-18 04:15:59 PDT
All reviewed patches have been landed.  Closing bug.