12

I've encountered some projects which uses meson to organize their building system. But when I want to debug their building system, I found it's difficult. The most important task is observing the building system's variable during its running. I could use message() function to show the variables of types, e.g.

integer
string
lists (of string/integer/lists)

But if the variable is dictionary type, the message() will refuse to display any information in the variable.

Does meson have a general function to display any type's variable just like python's print() function? If not, do we have any solution to do this?

Thanks in advance.

5
  • 2
    It's painful to learn and try those new building systems, since they are designed by different engieers and have different style, So this kind of general solutions could help us saving time and accelerate our working process. Unfortunately, they don't always exist. Commented Mar 10, 2021 at 6:56
  • 1
    Did you solve this problem?
    – Elvis Oric
    Commented Mar 11, 2021 at 21:13
  • @ElvisOric no. But it seems we could print out any types variable just like what python could do. So maybe, we could answer this question as: No. Let's still wait for a little longer time for some real expert from meson building system to come provide solid answer. Commented Mar 12, 2021 at 12:45
  • 1
    What build system support this kind of stuff? I tried with dictionary type and message print the value.
    – Elvis Oric
    Commented Mar 12, 2021 at 18:29
  • @ElvisOric I could use $(info ) function in makefile to output value of variables, but because meson is a newer building system which I'm not familiar, so I wish it could support python style print() function then it could be very easy for use to debug and learn Commented Mar 15, 2021 at 6:40

3 Answers 3

5

It is probably hard for the maintainers of meson to print out every object that is available in the meson.build script.

deps = []

# add some dependencies to the deps list or obtain the deps elsewhere

message('the depencies are: ')
foreach dep : deps
    message(' - ', dep.name())
endforeach

For me this results in:

Message: the depencies are: 
Message:  -  glib-2.0
Message:  -  gobject-2.0
Message:  -  gtk4
Message:  -  epoxy

You can't print/message a dependency, but you can print the name of the dependency :-)

1

You can print any object with:

message('@0@'.format(f))

Source: https://github.com/mesonbuild/meson/issues/9575#issuecomment-969053569

0

Maybe this function will help you and This function prints its argument to stdout

void message(text,more_text,...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.