determine_rpath_dirs() can return paths to external dependencies not
in the build dir and passing them first as a link path leads to
g-ir-scanner for example linking against the already installed library
instead of the just built one.
This was reported in g-i: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/272
and comes up quite often when a library adds some new symbols which aren't present in the
system library, which then makes linking fail.
The first place where the order is changed is _scan_gir_targets(), which looks like an unintentional
change in the refactoring in 8377ea45aa
The second place in _get_link_args() has always been that way and only the rpath order is changed,
but it looks to me as if the same rules should apply here too.
pull/5437/head
parent
9491878681
commit
20eb948b97
5 changed files with 107 additions and 8 deletions
@ -0,0 +1,42 @@ |
||||
#include "meson-sample.h" |
||||
|
||||
struct _MesonSample { |
||||
GObject parent_instance; |
||||
}; |
||||
|
||||
G_DEFINE_TYPE (MesonSample, meson_sample, G_TYPE_OBJECT) |
||||
|
||||
/**
|
||||
* meson_sample_new: |
||||
* |
||||
* Allocates a new #MesonSample. |
||||
* |
||||
* Returns: (transfer full): a #MesonSample. |
||||
*/ |
||||
MesonSample * |
||||
meson_sample_new (void) |
||||
{ |
||||
return g_object_new (MESON_TYPE_SAMPLE, NULL); |
||||
} |
||||
|
||||
static void |
||||
meson_sample_class_init (MesonSampleClass *klass) |
||||
{ |
||||
} |
||||
|
||||
static void |
||||
meson_sample_init (MesonSample *self) |
||||
{ |
||||
} |
||||
|
||||
/**
|
||||
* meson_sample_print_message: |
||||
* @self: a #MesonSample. |
||||
* |
||||
* Prints a message. |
||||
*/ |
||||
void |
||||
meson_sample_print_message (MesonSample *self) |
||||
{ |
||||
g_return_if_fail (MESON_IS_SAMPLE (self)); |
||||
} |
@ -0,0 +1,17 @@ |
||||
#ifndef MESON_SAMPLE_H |
||||
#define MESON_SAMPLE_H |
||||
|
||||
#include <glib-object.h> |
||||
|
||||
G_BEGIN_DECLS |
||||
|
||||
#define MESON_TYPE_SAMPLE (meson_sample_get_type()) |
||||
|
||||
G_DECLARE_FINAL_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject) |
||||
|
||||
MesonSample *meson_sample_new (void); |
||||
void meson_sample_print_message (MesonSample *self); |
||||
|
||||
G_END_DECLS |
||||
|
||||
#endif /* MESON_SAMPLE_H */ |
@ -0,0 +1,35 @@ |
||||
project('gir link order 2', 'c') |
||||
|
||||
if not dependency('gobject-2.0', required : false).found() |
||||
error('MESON_SKIP_TEST gobject not found.') |
||||
endif |
||||
|
||||
gnome = import('gnome') |
||||
gobject = dependency('gobject-2.0') |
||||
|
||||
# This builds a dummy libsample under samelibname that's not really used |
||||
subdir('samelibname') |
||||
|
||||
# This builds the real libsample |
||||
meson_sample_sources = ['meson-sample.c', 'meson-sample.h'] |
||||
meson_sample_lib = shared_library( |
||||
'sample', |
||||
sources : meson_sample_sources, |
||||
dependencies : [gobject], |
||||
link_with: [samelibname], |
||||
install : false, |
||||
) |
||||
|
||||
# g-ir-scanner should get the linker paths in the right order so it links first |
||||
# against the target libsample and not the dummy one that's just a dependency |
||||
# https://github.com/mesonbuild/meson/pull/5423 |
||||
gnome.generate_gir( |
||||
meson_sample_lib, |
||||
sources : meson_sample_sources, |
||||
nsversion : '1.0', |
||||
namespace : 'Meson', |
||||
symbol_prefix : 'meson', |
||||
identifier_prefix : 'Meson', |
||||
install : false, |
||||
build_by_default: true, |
||||
) |
@ -0,0 +1,5 @@ |
||||
samelibname = shared_library( |
||||
'sample', |
||||
sources : [], |
||||
install : false, |
||||
) |
Loading…
Reference in new issue