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

Prebuilt libraries: whole-archive and linker argument rewriting breaking build #10388

Open
magnusmarc opened this issue May 12, 2022 · 0 comments

Comments

@magnusmarc
Copy link

This is in regards to using DPDK as a prebuilt library (but can be abstracted to any prebuilt). Package config file is used to determine correct linking.

DPDK is a fairly complex set of libraries. The package config linking portion is structured somewhat like this.

-Wl,--whole-archive -L{libdir} -l:somestaticlib.a -l:example.a -l:dog -l:cat

DPDK uses Meson to write this pkgconf file. On its own, it works fine. (not invoked in Meson)

Main Issue:
Using Meson to invoke this has issues. I prefer not to use dependency() here due to these problems below, if they were resolved-- it would work fine.

  1. If you use the pkgconf lookup in dependency, it will not correctly take '--static' as it is intended under pkgconf. (libpcap and rte_bpf will have conflicting symbols when both linked as static)
  2. You have to set the pkgconf path to that prebuilt directory before invoking meson (rather than setting an environment with dependency())
  3. A Meson generated pkgconf file should use the same logic used for parsing (dependency() lookup) as it does for generating the file . Right now, the behavior for linking is different than the intended methods used when generating the package config file.

Attempted Workaround:
I am trying to use pkgconf flags directly by calling pkgconf within meson as a workaround to the problems above. However, I noticed that meson will take any link_with arguments and rewrite them. This leads to the main problem here which meson does not preserve whole-archive as a linker argument. This is with meson 0.62.1.

DPDK must have some libraries linked with whole-archive because there are some initialization functions that are not invoked otherwise.

Suggestion for Prebuilts:
As a separate note, it would be nice if we had a way to generate prebuilt libraries that we can store upstream and pull with meson.build. Instead of using pkgconf, it would be neat if we had a archive generated with a meson.build file within with all the find_library() calls to built libraries within that generated archive. It can be done manually, but it seems Meson does something similar with pkgconf now anyway. Is there any method or way to pull that logic being generated for the pkgconf files?

Several questions and issues here, but I appreciate the help. :)

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

No branches or pull requests

1 participant