Bug 95237 - [EFL] Rewrite the EFL-related Find modules
Summary: [EFL] Rewrite the EFL-related Find modules
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Raphael Kubo da Costa (:rakuco)
URL:
Keywords:
Depends on: 84707 95320
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-28 13:12 PDT by Raphael Kubo da Costa (:rakuco)
Modified: 2012-09-11 08:33 PDT (History)
8 users (show)

See Also:


Attachments
Patch (48.92 KB, patch)
2012-08-28 13:14 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (49.11 KB, patch)
2012-08-28 15:59 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
New attempt with a better bot setup (49.11 KB, patch)
2012-08-28 18:21 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (49.10 KB, patch)
2012-08-29 04:30 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (49.26 KB, patch)
2012-08-29 09:08 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (49.26 KB, patch)
2012-08-29 12:36 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (49.39 KB, patch)
2012-08-29 15:05 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Make it build with SHARED_CORE=ON (49.45 KB, patch)
2012-08-30 07:06 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Rebased patch (49.32 KB, patch)
2012-09-11 06:42 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch for landing. Assign copyright ot Intel. (49.31 KB, patch)
2012-09-11 08:25 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Kubo da Costa (:rakuco) 2012-08-28 13:12:22 PDT
[EFL] Rewrite the EFL-related Find modules
Comment 1 Raphael Kubo da Costa (:rakuco) 2012-08-28 13:14:27 PDT
Created attachment 161046 [details]
Patch
Comment 2 Raphael Kubo da Costa (:rakuco) 2012-08-28 15:59:27 PDT
Created attachment 161078 [details]
Patch
Comment 3 Gyuyoung Kim 2012-08-28 17:52:58 PDT
Comment on attachment 161078 [details]
Patch

Attachment 161078 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13665455
Comment 4 Raphael Kubo da Costa (:rakuco) 2012-08-28 17:58:32 PDT
(In reply to comment #3)
> (From update of attachment 161078 [details])
> Attachment 161078 [details] did not pass efl-ews (efl):
> Output: http://queues.webkit.org/results/13665455

It looks like the bot has a bad setup and has an outdated version of the EFL installed in /usr.
Comment 5 Gyuyoung Kim 2012-08-28 18:07:23 PDT
Comment on attachment 161078 [details]
Patch

Attachment 161078 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13654579
Comment 6 Raphael Kubo da Costa (:rakuco) 2012-08-28 18:21:36 PDT
Created attachment 161109 [details]
New attempt with a better bot setup
Comment 7 Gyuyoung Kim 2012-08-28 20:21:22 PDT
Comment on attachment 161109 [details]
New attempt with a better bot setup

Attachment 161109 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13682032
Comment 8 Gyuyoung Kim 2012-08-28 20:42:22 PDT
Comment on attachment 161109 [details]
New attempt with a better bot setup

Attachment 161109 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13685018
Comment 9 Raphael Kubo da Costa (:rakuco) 2012-08-29 03:40:00 PDT
(In reply to comment #7)
> (From update of attachment 161109 [details])
> Attachment 161109 [details] did not pass efl-ews (efl):
> Output: http://queues.webkit.org/results/13682032

This one looks like <http://trac.webkit.org/changeset/120113> showing it should not have been committed. I'll ping drott about this.
Comment 10 Raphael Kubo da Costa (:rakuco) 2012-08-29 04:30:39 PDT
Created attachment 161181 [details]
Patch
Comment 11 Gyuyoung Kim 2012-08-29 05:03:23 PDT
Comment on attachment 161181 [details]
Patch

Attachment 161181 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13685183
Comment 12 Raphael Kubo da Costa (:rakuco) 2012-08-29 09:08:39 PDT
Created attachment 161243 [details]
Patch
Comment 13 Gyuyoung Kim 2012-08-29 11:26:11 PDT
Comment on attachment 161243 [details]
Patch

Attachment 161243 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13691305
Comment 14 Raphael Kubo da Costa (:rakuco) 2012-08-29 12:36:37 PDT
Created attachment 161284 [details]
Patch
Comment 15 Gyuyoung Kim 2012-08-29 14:40:56 PDT
Comment on attachment 161284 [details]
Patch

Attachment 161284 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13685442
Comment 16 Raphael Kubo da Costa (:rakuco) 2012-08-29 15:05:58 PDT
Created attachment 161324 [details]
Patch
Comment 17 Thiago Marcos P. Santos 2012-08-30 01:45:19 PDT
Comment on attachment 161324 [details]
Patch

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

Please try a clean build with shared core, because I did that locally and got some linking errors.

CMakeFiles/MiniBrowser.dir/__/__/EWebLauncher/url_bar.c.o:url_bar.c:function on_urlbar_key_down: error: undefined reference to 'ecore_file_exists'

> ChangeLog:16
> +        o It depended on pkg-config being present for the searches to
> +        succeed.

We have other libraries using pkg-config, we depend on it anyway.

> ChangeLog:22
> +        o It obtained the library definitions from pkg-config, so
> +        ${FOO_LIBRARIES} would be set to something like "foo;bar" which
> +        expanded to "-lfoo -lbar" to the linker. If a wrong -L<path> was
> +        passed before that, the wrong library installation would end up
> +        being picked up.

If the -L path supplied by pkgconfig is wrong, it should be fixed on the library .pc upstream (not hack a fix on WebKit). I'm not aware of any build error because of that anyway. IMO this change would make it much more difficult to maintain than blindly use PKG_CHECK_MODULES which AFAIK just works and takes a couple of lines of code.

> ChangeLog:29
> +        o Due to the problem above, we also needed to set the LINK_FLAGS
> +        property for each target with the value of ${FOO_LDFLAGS}, which was
> +        also obtained from pkg-config and sort of compensated the fact that
> +        the libraries did not use absolute paths and added the required -L
> +        paths. This also included dependencies for these libraries, so we
> +        ended up including libraries indirectly, which is bad.

LD_FLAGS are not evil, check the example bellow:
$ pkg-config --libs evas
-pthread -L/opt/tmpsantos/projects/webkit-efl-2/WebKitBuild/Dependencies/Root/lib -levas -leina -lrt

Looks like you are just ignoring -pthread, -leina and -lrt, since EVAS_LIBRARIES is set to the full path of libevas.so.
Comment 18 Raphael Kubo da Costa (:rakuco) 2012-08-30 07:06:52 PDT
Created attachment 161462 [details]
Make it build with SHARED_CORE=ON
Comment 19 Raphael Kubo da Costa (:rakuco) 2012-09-03 00:01:33 PDT
Long reply ahead :-)

(In reply to comment #17)
> Please try a clean build with shared core, because I did that locally and got some linking errors.

Fixed, thanks!

> > ChangeLog:16
> > +        o It depended on pkg-config being present for the searches to
> > +        succeed.
>
> We have other libraries using pkg-config, we depend on it anyway.

True enough, however our build system itself is progressively getting rid of the dependency on pkg-config and works fine without having to resort to .pc files; last time I checked there was some confusion the KDE and CMake communities as to how usable pkg-config was on platforms such as Windows, so not making things still work without having to rely on it is a plus.

> > ChangeLog:22
> > +        o It obtained the library definitions from pkg-config, so
> > +        ${FOO_LIBRARIES} would be set to something like "foo;bar" which
> > +        expanded to "-lfoo -lbar" to the linker. If a wrong -L<path> was
> > +        passed before that, the wrong library installation would end up
> > +        being picked up.
>
> If the -L path supplied by pkgconfig is wrong, it should be fixed on the library .pc upstream (not hack a fix on WebKit). I'm not aware of any build error because of that anyway. IMO this change would make it much more difficult to maintain than blindly use PKG_CHECK_MODULES which AFAIK just works and takes a couple of lines of code.

I disagree that this approach is a hack; it is quite the opposite, I'd say.

The .pc files normally provide the right -L flags; what usually causes problems is the way we use pkg-config's output as it is parsed by CMake without even using FIND_LIBRARY() and FIND_PATH().

pkg-config can output the values in a .pc in many different ways, and CMake creates many different variables corresponding to those output modes. One of those variables is ${FOO_LIBRARIES}, which contains the output of `pkg-config --libs-only-l'. Due to the naming similarity with the variable that is normally set by Find modules after a FIND_LIBRARY() call, we end up using that ${FOO_LIBRARIES} directly in TARGET_LINK_LIBRARIES() calls, even if, contrary to what would happen if we had correctly used FIND_LIBRARY(), the value obtained from pkg-config only contains entries such as "foo;bar" instead of "/path/to/libfoo.so;/other/path/to/libbar.so". This has caused problems such as the one solved by <http://trac.webkit.org/changeset/126178>, since if libfoo.so is not in a directory in the linker's standard path the lookup will fail if "-lfoo" is passed instead of its absolute path.

To work around that, we were setting the LINK_FLAGS target property on our libraries and executables with the value of ${FOO_LDFLAGS}, which contains the output of `pkg-config --libs'. Besides containing the "-L<dir>" values, it also contains output which is already part of --libs-only-l and thus duplicates the value in ${FOO_LIBRARIES}.

Could we use ${FOO_LIBRARY_DIRS} instead, which contains the output of `pkg-config --libs-only-L'? Maybe, but this is all work which could be avoided by simply using one CMake's core commands designed specifically for what we are trying to do.

In summary, we'd better use pkg-config only as a hint if it is available on the system, but not more than that.

> > ChangeLog:29
> > +        o Due to the problem above, we also needed to set the LINK_FLAGS
> > +        property for each target with the value of ${FOO_LDFLAGS}, which was
> > +        also obtained from pkg-config and sort of compensated the fact that
> > +        the libraries did not use absolute paths and added the required -L
> > +        paths. This also included dependencies for these libraries, so we
> > +        ended up including libraries indirectly, which is bad.
>
> LD_FLAGS are not evil, check the example bellow:
> $ pkg-config --libs evas
> -pthread -L/opt/tmpsantos/projects/webkit-efl-2/WebKitBuild/Dependencies/Root/lib -levas -leina -lrt

% ./Tools/efl/run-with-jhbuild pkg-config --libs evas
-levas -L/usr/home/rakuco/dev/WebKit/WebKitBuild/Dependencies/Root/lib -leina -pthread

Which means in some cases -levas could even be passed to the linker before its actual path.

> Looks like you are just ignoring -pthread, -leina and -lrt, since EVAS_LIBRARIES is set to the full path of libevas.so.

That is OK -- instead of obtaining these extra libraries implicitly and forwarding them to the linker, we should properly look for them in an explicitly way instead. This is exactly what happened in bug 93030, for example.
Comment 20 Thiago Marcos P. Santos 2012-09-11 05:19:47 PDT
Comment on attachment 161462 [details]
Make it build with SHARED_CORE=ON

LGTM.
Comment 21 Raphael Kubo da Costa (:rakuco) 2012-09-11 06:42:14 PDT
Created attachment 163351 [details]
Rebased patch
Comment 22 Kenneth Rohde Christiansen 2012-09-11 07:35:45 PDT
Comment on attachment 163351 [details]
Rebased patch

r=me as it is looked over by thiago santos
Comment 23 Raphael Kubo da Costa (:rakuco) 2012-09-11 08:25:04 PDT
Created attachment 163370 [details]
Patch for landing. Assign copyright ot Intel.
Comment 24 Raphael Kubo da Costa (:rakuco) 2012-09-11 08:33:30 PDT
And finally landed in <http://trac.webkit.org/changeset/128191> \o/