Skip to content

gnome.generate_gir should set LD_LIBRARY_PATHs to use the dependent built libraries #16127

Description

@3v1n0

Describe the bug
In GLib we're generating gir against libraries we build incrementally:

  • libglib is a dependency of libgobject that is a dependency of libgio

Now when generating the gir for gio we should make sure that the built version of libgobject and libglib are used as dependencies for the g-ir-scanner and other tools.

To workaround this we used something like:

if host_system in ['ios', 'darwin']
  glib_exec_var_library_path = 'DYLD_LIBRARY_PATH'
  glib_exec_var_preload = 'DYLD_INSERT_LIBRARIES'
  glib_exec_var_preload_separator = ':'
else
  glib_exec_var_library_path = 'LD_LIBRARY_PATH'
  glib_exec_var_preload = 'LD_PRELOAD'
  glib_exec_var_preload_separator = ' '
endif

# ... 

gi_gen_env_variables = environment()

# Use currently built libraries to run g-ir-scanner and the various tools
# this may not happen if we don't set the library paths.
gi_gen_env_variables.prepend(glib_exec_var_library_path,
  fs.parent(libglib.full_path()), fs.parent(libgobject.full_path()),
  fs.parent(libgmodule.full_path()), fs.parent(libgio.full_path()))

# And then we build gio with

gio_gir = gnome.generate_gir(libgio,
  sources: gio_gir_sources,
  namespace: 'Gio',
  nsversion: '2.0',
  identifier_prefix: gi_identifier_prefix,
  symbol_prefix: gi_symbol_prefix,
  export_packages: gio_gir_packages,
  header: 'gio/gio.h',
  includes: [ glib_gir[0], gmodule_gir[0], gobject_gir[0] ],
  install: true,
  install_dir_gir: glib_girdir,
  dependencies: gi_gen_shared_dependencies + [
    libglib_dep,
    libgobject_dep,
    libgmodule_dep,
  ],
  env: gi_gen_env_variables,
  extra_args: gir_args + gio_gir_args,
)

But the gi_gen_env_variables workaround (used in this GLib commit) should really be not needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions