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

error in get_option for a subproject #122

Closed
satk0 opened this issue Jan 27, 2025 · 3 comments
Closed

error in get_option for a subproject #122

satk0 opened this issue Jan 27, 2025 · 3 comments

Comments

@satk0
Copy link

satk0 commented Jan 27, 2025

It seems like, muon can't yield superproject options to subprojects. For instance, having specified plugins option in radare2 project, I still get the following error when I try to get_option from capstone-v5 subproject:

/home/satk0/Desktop/Programs/opensource/mine/radare2/subprojects/capstone-v5/meson.build:85:27: error undefined option
 85 | user_plugins = get_option('plugins').split(',')
                                ^________
/home/satk0/Desktop/Programs/opensource/mine/radare2/subprojects/capstone-v5/meson.build:85:16: error in get_option
 85 | user_plugins = get_option('plugins').split(',')
                     ^____________________
/home/satk0/Desktop/Programs/opensource/mine/radare2/shlr/meson.build:30:10: error in subproject
 30 |     cs = subproject('capstone-v5')
               ^________________________
/home/satk0/Desktop/Programs/opensource/mine/radare2/meson.build:585:1: error in subdir
585 | subdir('shlr')

Is there any way to resolve it? Meson in this case works fine and transmits the option down to subproject.

@annacrombie
Copy link
Collaborator

Hey, thanks for the bug report! Could you provide a few more details? muon appears to work as expected given a minimal reproducer:

meson.build:

project('project')                                                                                                        
message(get_option('opt'))                                                                                                
subproject('a')                                                                                                           

meson.options:

option('opt', type: 'string', value: '')

subprojects/a/meson.build:

project('subproject')                                                                                                                                                                                      
message(get_option('opt'))                                                                                                

subprojects/a/meson.options:

option('opt', type: 'string', yield: true, value: '')

output:

$ muon setup -Dopt='test' build
configuring 'project', version: undefined
message test 
[a] entering subproject 'a'
[a] configuring 'subproject', version: undefined
message test 

setup complete

I also tried to repro with radare2 but I don't think the code you are working with is available yet? It isn't on master at least.

@satk0
Copy link
Author

satk0 commented Jan 28, 2025

Hi, it works perfectly now, thanks a lot for the explanation, here it the PR: radareorg/radare2#23932.

I simply forgot about defining meson_options.txt in a subproject (and this amazing yield option), but nevertheless the strange thing is that meson somehow builds without it, and muon not.

Once again thanks a ton and sorry for the hussle, I am not so "meson-savvy" 😅

@annacrombie
Copy link
Collaborator

No problem. I'm not sure what you were doing before but you must each project's options separately, even if they are shared. I can't figure out how meson was working, for me it appears to give the same error muon does:

$ git checkout capstone-subproject
$ rm -f subprojects/capstone-v5/meson_options.txt subprojects/packagefiles/capstone-v5/meson_options.txt
$ meson setup build
...
subprojects/capstone-v5/meson.build:85:15: ERROR: Tried to access unknown option 'plugins'.

I'll close this issue though since it seems like you figured it out!

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