Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies missing with static libraries #2893

Closed
inigomartinez opened this issue Jan 7, 2018 · 2 comments
Closed

Dependencies missing with static libraries #2893

inigomartinez opened this issue Jan 7, 2018 · 2 comments

Comments

@inigomartinez
Copy link
Contributor

NetworkManager has recently merged meson support. While improving it, I have noticed that some static libraries which depends on generated sources, are not building properly.

I don't know if this should be its normal behaviour, but this seems to be happening due to missing dependencies in ninja rules.

You can find this behaviour when building the libNetworkManagerBase.a library. One of its dependencies is libnmdbus, which is a static library built by a set of sources that are generated at build time. However, when building libNetworkManagerBase.a, I was expecting it to force the building of libnmdbus.a and finally the generated source, but it doesn't trigger their rules.

The ninja rule is as follows:

build src/libNetworkManagerBase.a: STATIC_LINKER src/NetworkManagerBase@sta/dhcp_nm-dhcp-client.c.o src/NetworkManagerBase@sta/dhcp_nm-dhcp-manager.c.o src/NetworkManagerBase@sta/dhcp_nm-dhcp-systemd.c.o src/NetworkManagerBase@sta/dhcp_nm-dhcp-utils.c.o src/NetworkManagerBase@sta/ndisc_nm-lndp-ndisc.c.o src/NetworkManagerBase@sta/ndisc_nm-ndisc.c.o src/NetworkManagerBase@sta/platform_wifi_wifi-utils-nl80211.c.o src/NetworkManagerBase@sta/platform_wifi_wifi-utils.c.o src/NetworkManagerBase@sta/platform_nm-linux-platform.c.o src/NetworkManagerBase@sta/platform_nm-platform.c.o src/NetworkManagerBase@sta/platform_nm-platform-utils.c.o src/NetworkManagerBase@sta/platform_nmp-netns.c.o src/NetworkManagerBase@sta/platform_nmp-object.c.o src/NetworkManagerBase@sta/main-utils.c.o src/NetworkManagerBase@sta/NetworkManagerUtils.c.o src/NetworkManagerBase@sta/nm-core-utils.c.o src/NetworkManagerBase@sta/nm-exported-object.c.o src/NetworkManagerBase@sta/nm-ip4-config.c.o src/NetworkManagerBase@sta/nm-ip6-config.c.o src/NetworkManagerBase@sta/nm-logging.c.o src/NetworkManagerBase@sta/platform_wifi_wifi-utils-wext.c.o
 LINK_ARGS = csrD

The libnmdbus.a target is missing, which should force the generation of files needed by libNetworkManagerBase.a.

@jpakkane
Copy link
Member

jpakkane commented Jan 7, 2018

If nmdbus has generated headers that base.a uses, then those need to be explicitly put in the source list of base.a somehow (usually by a declare_dependency whose sources includes said headers). Simply having a link with between two static libraries does not add a link between them because the dependency .a file does not need to exist before building the dependent .a. Enforcing this kind of serialisation would inhibit build parallelism.

If this is not enough to fix the issue, please post the full error message you get when compiling.

@inigomartinez
Copy link
Contributor Author

You're right, and I suspected that that was the right answer. Actually, the headers can't be used directly because those sources are generated using gnome.gdbus_codegen which returns an opaque object. I have included a FIXME comment in a path that I have sent today, though I wasn't fully sure.

The main issue with glib's gdbus-codegen is that it generates the header and the body file at the same time. However, there are some patches on the way.

Thank you for your kind support,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants