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 788772 - meson installs gdb scripts incorrectly
meson installs gdb scripts incorrectly
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
2.54.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 783270
 
 
Reported: 2017-10-10 11:49 UTC by Jan Alexander Steffens (heftig)
Modified: 2017-11-02 04:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] meson: Fix GDB scripts install_dir (1.40 KB, patch)
2017-10-10 11:49 UTC, Jan Alexander Steffens (heftig)
none Details | Review
[PATCH] meson: Fix GDB scripts install_dir for *nix (1.79 KB, patch)
2017-10-24 14:55 UTC, Jan Alexander Steffens (heftig)
committed Details | Review

Description Jan Alexander Steffens (heftig) 2017-10-10 11:49:14 UTC
Created attachment 361244 [details] [review]
[PATCH] meson: Fix GDB scripts install_dir

autotools (--prefix=/usr) installs the GDB scripts as:

usr/share/gdb/auto-load/usr/lib/libglib-2.0.so.0.5400.0-gdb.py
usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.5400.0-gdb.py

Meson installs them as:

usr/share/gdb/auto-loadlib/libglib-2.0.so.0.5400.0-gdb.py
usr/share/gdb/auto-load/lib/libgobject-2.0.so.0.5400.0-gdb.py

Which does not work correctly.
Comment 1 Emmanuele Bassi (:ebassi) 2017-10-10 11:53:58 UTC
Review of attachment 361244 [details] [review]:

::: glib/meson.build
@@ +285,3 @@
   configuration: gdb_conf,
   install: true,
+  install_dir: join_paths(get_option('datadir'), 'gdb/auto-load' + glib_libdir)

This can be written as:

```
  install_dir: join_paths(glib_datadir, 'gdb', 'auto-load', glib_libdir)
```

`glib_datadir` is `get_option('datadir')` plus the prefix.

::: gobject/meson.build
@@ +103,3 @@
   configuration: gdb_conf,
   install: true,
+  install_dir: join_paths(get_option('datadir'), 'gdb/auto-load/' + glib_libdir)

Same as above
Comment 2 Jan Alexander Steffens (heftig) 2017-10-10 11:58:44 UTC
Actually, no, because glib_libdir is an absolute path.
Comment 3 Emmanuele Bassi (:ebassi) 2017-10-10 12:04:15 UTC
Ah, yes: you're right.

It should just be `join_paths(glib_datadir, 'gdb', 'auto-load', 'lib')`, then.
Comment 4 Emmanuele Bassi (:ebassi) 2017-10-10 12:04:55 UTC
Unless, of course, GDB is insane enough and uses a `lib`/`lib64` split under `gdb/auto-load`.
Comment 5 Jan Alexander Steffens (heftig) 2017-10-10 12:06:30 UTC
Should it really be
  /usr/share/gdb/auto-load/lib/*.py
instead of
  /usr/share/gdb/auto-load/usr/lib/*.py
?

On Arch Linux, GCC installs
  /usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.24-gdb.py
Comment 6 Jan Alexander Steffens (heftig) 2017-10-10 12:12:50 UTC
https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html says:

> script-name is formed by ensuring that the file name of
> objfile is absolute, following all symlinks, and resolving
> . and .. components, and appending the -gdb.ext suffix. If
> this file exists and is readable, GDB will evaluate it as
> a script in the specified extension language.

Which suggests that the usr/ is indeed needed.
Comment 7 Emmanuele Bassi (:ebassi) 2017-10-24 13:25:30 UTC
Okay, so it must be:

  join_paths(glib_datadir, 'gdb', 'auto-load', glib_libdir)

since we install the library name under glib_libdir.
Comment 8 Jan Alexander Steffens (heftig) 2017-10-24 14:19:11 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #7)

I already mentioned in comment #2 that this won't work as glib_libdir is absolute; join_paths will throw away everything else.

Perhaps '.' + glib_libdir will work? I don't see any methods to slice off the initial '/'.
Comment 9 Emmanuele Bassi (:ebassi) 2017-10-24 14:23:33 UTC
Let's use string concatenation, and hope that `glib_libdir` never looks like `C:/mingw64/build`.
Comment 10 Jan Alexander Steffens (heftig) 2017-10-24 14:55:10 UTC
Created attachment 362191 [details] [review]
[PATCH] meson: Fix GDB scripts install_dir for *nix

Disable installation on Windows for now as this would use a colon in the
directory name.
Comment 11 Nirbheek Chauhan 2017-11-02 04:26:30 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #9)
> Let's use string concatenation, and hope that `glib_libdir` never looks like
> `C:/mingw64/build`.

We already had this problem: https://bugzilla.gnome.org/show_bug.cgi?id=783270#c61, which is why that code is in place.

(In reply to Jan Alexander Steffens (heftig) from comment #10)
> Created attachment 362191 [details] [review] [review]
> [PATCH] meson: Fix GDB scripts install_dir for *nix
> 
> Disable installation on Windows for now as this would use a colon in the
> directory name.

This workaround is fine. Anything better requires API in meson to fetch the prefix as a relative path which will remove the leading '/' and any drive letters on Windows, or some other way to join absolute paths.
Comment 12 Nirbheek Chauhan 2017-11-02 04:34:56 UTC
Comment on attachment 362191 [details] [review]
[PATCH] meson: Fix GDB scripts install_dir for *nix

I pushed the patch but git bz messed up a bit and didn't close the bug. Closing manually.