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

Allow static linking using meson wrap when -Ddefault_library=both #99

Open
kasper93 opened this issue May 10, 2024 · 1 comment
Open

Comments

@kasper93
Copy link

kasper93 commented May 10, 2024

Hi,

I'm trying to use rubberband as a meson wrap in clang Windows build. It looks like there is some trickery with static library in this cases EDIT: Clang build doesn't go into this branch, so it is different issue.

if cpp.get_id() == 'msvc'

I don't mind any of that, but currently it is impossible to link statically using meson wrap

[provide]
rubberband = rubberband_dep

rubberband/meson.build

Lines 622 to 625 in 5d29601

rubberband_dep = declare_dependency(
link_with: rubberband_library,
include_directories: '.',
)

doesn't work, because rubberband_library is always shared library, regardless of -Ddefault_library value.

I've noticed that there is declared dep for objs that could technically work, but include_directories are missing, so it doesn't.

[provide]
rubberband = rubberband_objlib_dep

rubberband/meson.build

Lines 576 to 578 in 5d29601

rubberband_objlib_dep = declare_dependency(
link_with: rubberband_objlib,
)

I could patch it myself, but would be great to have ability to use the project directly from wrapdb.

Thanks

EDIT:

Some more information. The issue is when get_option('default_library') is both.

rubberband| Message: Will build Rubber Band Library static library
rubberband| Message: Will build Rubber Band Library dynamic library

Target summary is:

rubberband| Message: {'Static library' : [true, 'Name: rubberband'], 'Dynamic library' : [true, 'Name: rubberband']}

As you can see both have the same name, the logic is not correct. And either way there is no dependency declared for static one in this case.

Although I have no idea where both comes from, I explicit set -Ddefault_library=static. Need to find what is overwriting that.

EDIT2:

default_options specify default_library=both so global option is not used. I needed to explicit override it for rubberband.

So the only remaining issue you might want to fix is to declare static dependency when default_library=both, because currently it is not possible to use it from wrap.

@kasper93 kasper93 changed the title Allow static linking in MSVC-like environment using meson wrap Allow static linking using meson wrap May 10, 2024
@kasper93 kasper93 changed the title Allow static linking using meson wrap Allow static linking using meson wrap when -Ddefault_library=both May 10, 2024
@cannam
Copy link
Member

cannam commented May 10, 2024

Thanks for the investigation! I will take a look.

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

2 participants