After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773656 - Fix various g-ir-scanner failures after switching to cmake
Fix various g-ir-scanner failures after switching to cmake
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
3.23.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2016-10-29 05:01 UTC by Ting-Wei Lan
Modified: 2016-10-31 14:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove unused INTROSPECTION_SCANNER_FLAGS variable (1.04 KB, patch)
2016-10-29 05:03 UTC, Ting-Wei Lan
committed Details | Review
Fix mixed indent in GObjectIntrospection.cmake (910 bytes, patch)
2016-10-29 05:04 UTC, Ting-Wei Lan
committed Details | Review
Fix undefined reference error when g-ir-scanner links the temporary executable (2.11 KB, patch)
2016-10-29 05:04 UTC, Ting-Wei Lan
committed Details | Review
Fix undefined symbol error when g-ir-scanner runs the temporary executable (4.23 KB, patch)
2016-10-29 05:04 UTC, Ting-Wei Lan
committed Details | Review
Add missing dependencies listed in gir_libdirs (1.54 KB, patch)
2016-10-29 05:04 UTC, Ting-Wei Lan
committed Details | Review
Remove useless _INCLUDE_DIRS arguments in gir_cflags (2.93 KB, patch)
2016-10-29 05:04 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-10-29 05:01:44 UTC
I know Bug 773360 is already resolved, but there are still many other cases that can cause g-ir-scanner to fail to link or run the temporary executable. I will upload several patches here to fix all problems I found.
Comment 1 Ting-Wei Lan 2016-10-29 05:03:36 UTC
Created attachment 338759 [details] [review]
Remove unused INTROSPECTION_SCANNER_FLAGS variable
Comment 2 Ting-Wei Lan 2016-10-29 05:04:00 UTC
Created attachment 338760 [details] [review]
Fix mixed indent in GObjectIntrospection.cmake
Comment 3 Ting-Wei Lan 2016-10-29 05:04:08 UTC
Created attachment 338761 [details] [review]
Fix undefined reference error when g-ir-scanner links the temporary executable

When running g-ir-scanner with --no-libtool, g-ir-scanner automatically
adds arguments from CFLAGS, CPPFLAGS and LDFLAGS environment variables
before adding arguments supplied from the command line. This is fine
for CFLAGS and CPPFLAGS because arguments listed later can be used to
override the same or opposite arguments listed earlier.

However, LDFLAGS is usually a list of -L arguments, which are used to
specify an ordered list of directories to be searched by the linker.
Thie means arguments listed earlier have precedence over arguments
listed later, so it is not possible to change the order by adding more
arguments.

Therefore, if an old version of evolution-data-server is already
installed in the prefix, it will be used when linking the temporary
executable, instead of the newly built one. This causes linking error
to happen if the new version adds new functions:

EBookContacts-1.2.o: undefined reference to `e_name_western_get_type'
EBookContacts-1.2.o: undefined reference to `e_address_western_get_type'

In order to resolve the linking issue, LDFLAGS is unset before running
g-ir-scanner, and required -L arguments are specified on g-ir-scanner
command line instead.
Comment 4 Ting-Wei Lan 2016-10-29 05:04:14 UTC
Created attachment 338762 [details] [review]
Fix undefined symbol error when g-ir-scanner runs the temporary executable

When running g-ir-scanner with --no-libtool, g-ir-scanner uses python
distutils instead of libtool to link the temporary executable. Unlike
libtool, which generates a wrapper script to setup the environment for
running the uninstalled executable, python distutils puts the output
executable at the specified location directly, without knowing how to
run the file. To keep the executable runnable without setting
additional environment variables, g-ir-scanner uses -rpath option to
hardcode the library search path into the executable.

It is fine if the path is hardcoded with DT_RPATH attribute in dynamic
section because it cannot be overrided by the environment. However,
python distutils automatically passes --enable-new-dtags option to the
linker on some systems, so DT_RUNPATH attribute is used instead of
DT_RPATH on these systems.

Therefore, when running the build in a JHBuild environment, which
always has LD_LIBRARY_PATH environment variable set, DT_RUNPATH written
in the executable is overrided by LD_LIBRARY_PATH set in the
environment. This means the old version of libraries installed in the
prefix will be found first, instead of the newly built ones. This
causes the executable to fail to run if the new version requires newly
added functions:

EBookContacts-1.2: undefined symbol: e_name_western_get_type
EBookContacts-1.2: undefined symbol: e_address_western_get_type

To keep the executable runnable regardless of additional flags added by
python distutils, directories used for searching libraries specified on
g-ir-scanner command line are prepended to LD_LIBRARY_PATH environment
variable before running g-ir-scanner. The code used here is largely
based on file Source/WebKit2/PlatformGTK.cmake of WebKit project.
Comment 5 Ting-Wei Lan 2016-10-29 05:04:20 UTC
Created attachment 338763 [details] [review]
Add missing dependencies listed in gir_libdirs

If not all dependent libraries are listed, the linker will use the old
version of libraries installed in the prefix instead of newly built
ones, causing undefined reference error to be shown.
Comment 6 Ting-Wei Lan 2016-10-29 05:04:34 UTC
Created attachment 338764 [details] [review]
Remove useless _INCLUDE_DIRS arguments in gir_cflags

Since _INCLUDE_DIRS arguments are not prefixed with -I, GCC ignores
them and shows a lot of warnings.

These arguments also cause problems when compiling with Clang, which
doesn't seem to ignore them and show error messages:

clang-cpp: error: cannot specify -o when generating multiple output files
Comment 7 Milan Crha 2016-10-31 14:03:36 UTC
Thanks for a bug report and patches. They didn't break anything here, and I hope they will fix things elsewhere, thus I'm going to commit them.

As a side note, I do not like many small patches, thus I merged them into one. It's a headache to change status of the all patches in the bugzilla to refreck the right state. All your notes are here, which is fine (that's one of the reasons why there is the bug reference in the commit message, from my point of view).

Created commit 69e54a3 in eds master (3.23.2+)