valum icon indicating copy to clipboard operation
valum copied to clipboard

vsgi-server-module.vala:67: libvsgi-http.so: cannot open shared object file: No such file or directory

Open devnix opened this issue 6 years ago • 9 comments

Hi! As soon as I include a gnome.compile_resources line in my meson.build, I'm getting a runtime error like the one of the title:

 ** (process:1): CRITICAL **: vsgi-server-module.vala:67: libvsgi-http.so: cannot open shared object file: No such file or director
 ** (process:1): CRITICAL **: vsgi_server_run: assertion 'self != NULL' failed

My meson.build looks like this:

project('valabb', 'c', 'vala')
gnome = import('gnome')

dependencies = [
	dependency('glib-2.0'),
	dependency('gobject-2.0'),
	dependency('gio-2.0'),
	dependency('libsoup-2.4'),
	dependency('vsgi-0.3'),
	dependency('valum-0.3'),
	dependency('template-glib-1.0'),
]

sources = files(
	'src/Application.vala',
	'src/Controller/IndexController.vala',
	'src/Controller/RegisterController.vala',
	'src/Controller/Admin/IndexController.vala',
)

sources += gnome.compile_resources(
	'template-glib-resources',
	'resources/app.gresource.xml',
	source_dir: './src'
)

vala_flags = '--gresourcesdir=' + join_paths(meson.current_source_dir(), 'resources')

executable(
	'valabb',
	sources,
	dependencies: dependencies,
	vala_args: vala_flags
)

If this is not related at all with Valum, please just let me know to open an issue somewhere else :smile:

devnix avatar Apr 08 '19 06:04 devnix

Server modules are loaded dynamically using -rtpath and $ORIGIN and I noticed it's not very robust in some linking setup.

Have you tried to use Meson built-in support for GResource?

arteymix avatar Apr 08 '19 19:04 arteymix

I don't know any other way to use gresource with Meson, I thought that gnome.compile_resources was the supported method...

devnix avatar Apr 09 '19 15:04 devnix

You shouldn't have to pass --gresourcedir if you already pass the result of gnome.compile_resources to your target.

There's a working example in https://github.com/valum-framework/valum/blob/master/examples/app/meson.build

I'm currently investigating how libgda does load its providers.

arteymix avatar Apr 09 '19 16:04 arteymix

In my first attempts I was not passing any --gresourcedir. I've modified again my meson.build to look a little more like the example you are showing me but with the same results:

project('valabb', 'c', 'vala')
gnome = import('gnome')

dependencies = [
	dependency('glib-2.0'),
	dependency('gobject-2.0'),
	dependency('gio-2.0'),
	dependency('libsoup-2.4'),
	dependency('vsgi-0.3'),
	dependency('valum-0.3'),
	dependency('template-glib-1.0'),
]

sources = [
	'src/Application.vala',
	'src/Controller/IndexController.vala',
	'src/Controller/RegisterController.vala',
	'src/Controller/Admin/IndexController.vala',
]

sources += gnome.compile_resources(
	'template-glib-resources',
	'resources/app.gresource.xml',
	source_dir: './src'
)

executable(
	'valabb',
	sources,
	dependencies: dependencies
)

By the way, my initial work was based on https://github.com/valum-framework/valum/blob/master/examples/template-glib/meson.build

devnix avatar Apr 10 '19 13:04 devnix

Some problem

msmaldi avatar Oct 04 '19 12:10 msmaldi

Is this still happening in the current trunk? I think we've addressed this in https://github.com/valum-framework/vsgi/pull/6 by passing -Wl,--disable-new-dtags.

Maybe @colinkiama could have a look?

arteymix avatar Nov 11 '21 23:11 arteymix

I replicated the template-glib example and managed to get it working but only after adding the linker flags and rpath like I did in valum-framework/vsgi#6

Here's what the meson.build file looks like:

sources = [
  'main.vala'
]

sources += gnome.compile_resources(
  'template-glib-resources',
  'app.gresource.xml',
  source_dir: '.'
)

executable('valabb',
  sources,
  dependencies: dependencies,
  link_args: ['-Wl,--disable-new-dtags'],
  build_rpath: join_paths(get_option('prefix'), get_option('libdir'), 'vsgi-@0@/servers'.format('0.4')),
  install: true)

colinkiama avatar Nov 17 '21 21:11 colinkiama

It's about time we get this fixed.

The -rpath trick I've been using does not reliably work. We need a solution that works both when compiling as a Meson subproject and when linking against a regular installation.

arteymix avatar Sep 10 '22 04:09 arteymix

I suggest introducing some sort of configuration file system that allows us to load modules dynamically, like Apache and NGINX do.

What do you think?

colinkiama avatar Sep 15 '22 17:09 colinkiama