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

add meson build system #297

Closed
wants to merge 1 commit into from
Closed

add meson build system #297

wants to merge 1 commit into from

Conversation

eszlari
Copy link

@eszlari eszlari commented Feb 9, 2021

No description provided.

@axboe
Copy link
Owner

axboe commented Feb 9, 2021

Neither the commit nor the pull request has any details on what meson is and why this is a valuable addition. I'm generally not opposed to including things that make it easier for folks to integrate, but there's an associated cost with adding another build system. Hence I'd really like to get some justification for why this is useful and necessary.

@eszlari
Copy link
Author

eszlari commented Feb 9, 2021

Sorry, I guess meson is not (yet) well known among kernel people.

why this is useful

$ scc
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
C                          106     23479     3552      1000    18927       3638
Meson                        8       384       23         0      361          5
C Header                     4      1088      139       181      768         15
Makefile                     4       455       58         2      395          2
Shell                        4       586       69        81      436         56
License                      3       558       94         0      464          0
Autoconf                     2        19        2         3       14          0
C++                          1        45        8         5       32          6
YAML                         1        22        0         0       22          0
gitignore                    1       124        6         0      118          0
───────────────────────────────────────────────────────────────────────────────
Total                      134     26760     3951      1272    21537       3722
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $678,328
Estimated Schedule Effort 11.867553 months
Estimated People Required 5.078021
───────────────────────────────────────────────────────────────────────────────
Processed 567943 bytes, 0.568 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

and necessary.

I certainly wouldn't call it "necessary". It surely is more common for desktop stuff (gnome, x11, mesa), but some low level projects (systemd, qemu) have adopted it too. Since liburing is a rather small codebase, the speed and simplicity advantages in this case are not so huge as with other projects:

  • It provides some nice features (e.g. out-of-source builds) out of box, that one would need to implement in shell.
  • Other projects that use meson could integrate liburing easily into their build system by using meson's subproject() functionality.
  • Meson provides some useful editor/IDE integration, e.g. by generating compile_commands.json for clangd.
  • Distro maintainers I could image, wouldn't mind having most of their packages built with a "standard" build system.

@axboe
Copy link
Owner

axboe commented Feb 10, 2021

Can you add that description to the actual commit message? And also please remember to add your Signed-off-by line to the bottom of the commit as well.

@eszlari
Copy link
Author

eszlari commented Feb 11, 2021

@axboe Done.

Meson is a fast and simple build system. Adoption started mainly in the
desktop space (Gnome, X11, Mesa) to replace autotools, but since then,
some low level projects (systemd, qemu) have switched to it too.

Since liburing is a rather small codebase, the difference in
speed and simplicity are not as huge as with other projects.
Nonetheless, there are still some advantages:

* It comes with some nice features (e.g. out-of-source builds),
  that one would need to implement in shell otherwise.
* Other projects that use Meson could integrate liburing easily
  into their build system by using Meson's subproject() functionality.
* Meson provides some useful editor/IDE integration,
  e.g. by generating compile_commands.json for clangd.
* Distribution packagers are provided with a "standard" build system,
  with well known options/features/behavior, that is actively developed.

Signed-off-by: Peter Eszlari <[email protected]>
@ddiss
Copy link
Contributor

ddiss commented Apr 20, 2021

I'm not familiar with Meson, but just wanted to mention that I find the existing make based build process really nice.

Comment on lines +25 to +33
code = '''#include <linux/fs.h>
int main(int argc, char **argv)
{
__kernel_rwf_t x;
x = 0;
return x;
}
'''
has__kernel_rwf_t = cc.compiles(code, name : '__kernel_rwf_t')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
code = '''#include <linux/fs.h>
int main(int argc, char **argv)
{
__kernel_rwf_t x;
x = 0;
return x;
}
'''
has__kernel_rwf_t = cc.compiles(code, name : '__kernel_rwf_t')
has__kernel_rwf_t = cc.has_type('__kernel_rwf_t', prefix: '#include <linux/fs.h>')

Comment on lines +35 to +45
code = '''#include <linux/time.h>
#include <linux/time_types.h>
int main(int argc, char **argv)
{
struct __kernel_timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1;
return 0;
}
'''
has__kernel_timespec = cc.compiles(code, name : '__kernel_timespec')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
code = '''#include <linux/time.h>
#include <linux/time_types.h>
int main(int argc, char **argv)
{
struct __kernel_timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1;
return 0;
}
'''
has__kernel_timespec = cc.compiles(code, name : '__kernel_timespec')
has__kernel_timespec = cc.has_members('struct __kernel_timespec', 'tv_sec', 'tv_nsec', prefix : '#include <linux/time.h>')

Comment on lines +77 to +86
cpp = meson.get_compiler('cpp')

code = '''#include <iostream>
int main(int argc, char **argv)
{
std::cout << "Test";
return 0;
}
'''
has_cxx = cpp.compiles(code, name : 'C++')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't meson fail if cpp is in the project description but isn't available? If C++ should be optional there might be another way. I remember that we optionally add objective c in JackTrip if we compile on Darwin.

Comment on lines +88 to +96
code = '''#include <ucontext.h>
int main(int argc, char **argv)
{
ucontext_t ctx;
getcontext(&ctx);
return 0;
}
'''
has_ucontext = cc.compiles(code, name : 'ucontext')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
code = '''#include <ucontext.h>
int main(int argc, char **argv)
{
ucontext_t ctx;
getcontext(&ctx);
return 0;
}
'''
has_ucontext = cc.compiles(code, name : 'ucontext')
has_ucontext = cc.has_type('ucontext_t', prefix: '#include <ucontext.h>')

fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 5, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
@fischerling
Copy link
Contributor

I have a two branches introducing meson as a build system on top of master as well as liburing-2.0 containing the suggested changes from @ntonnaett.
The branch based on liburing-2.0 is submitted to be included into the meson wrapdb so it can be easily consumed using meson wrap.

@eszlari if you are still interested in this PR feel free to use my changes otherwise I would open a new pull request with my branch.

fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 8, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
@fischerling fischerling mentioned this pull request Aug 9, 2021
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
eli-schwartz pushed a commit to fischerling/wrapdb that referenced this pull request Aug 23, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
fischerling added a commit to fischerling/wrapdb that referenced this pull request Aug 25, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
jpakkane pushed a commit to mesonbuild/wrapdb that referenced this pull request Aug 26, 2021
The meson build files for liburing-2.0 are taken from
https://github.com/fischerling/liburing/tree/2.0-meson
and are based upon
axboe/liburing#297
@stalkerg
Copy link

meson file for each folder is probably too much (I mean for include dir mostly).

@fischerling
Copy link
Contributor

meson file for each folder is probably too much (I mean for include dir mostly).

What is the reason to drop the include/meson.build file? To reduce the diff because someone complained in #438?

@fischerling
Copy link
Contributor

For anyone interested I updated the meson build code for liburing-2.2 at fischerling/liburing/meson-liburing-2.2 and submitted a pull request to update the version included in the meson wrapdb.

@stalkerg
Copy link

To reduce the diff because someone complained in #438?

for example, but I suppose the smallest diff it's better anyway, I believe Meson Build is not a Makefile replacement as is and creating a new file on each level is legacy.
This PR here since 2021. Will be good to upstream it, and comments from CMake friends do not help us. :(
@axboe please reconsider this, because using Meson in Dockerfile or during RPM/DEB/Ebuild is much clear and simpler. It should help package maintainers.

@stalkerg
Copy link

included in the meson wrapdb.

I prefer the idea of upstreaming current PR instead do it for wrapdb.

@fischerling
Copy link
Contributor

included in the meson wrapdb.

I prefer the idea of upstreaming current PR instead do it for wrapdb.

I also prefer having the meson changes upstream. But since this PR has no real activity or interest, using the meson wrapdb solves all my problems by making liburing easy consumable from other meson projects.

@axboe Do you consider changing the build system at all? Should I open a new PR with the meson changes based on liburing-2.2?

@axboe
Copy link
Owner

axboe commented Jun 27, 2022

Do you consider changing the build system at all? Should I open a new PR with the meson changes based on liburing-2.2?

It's not that I'm vehemently against changing the build system, but my main issue is that it's something that I have to support. And I don't know anything about meson, but to be honest, I know very little about make either but enough to fake it.

On top of that, then you get people that take that side very seriously, and then I end up in a situation where everybody wants their favorite build system added. And that is certainly a path I'm not interested in at all. Whatever we end up doing, a single build system that is maintainable and broadly usable by everyone is important. The latter really is key, too.

The hand rolled configure and basic makefiles are definitely a bit archaic, but It Works and is simpler to build and grok for everyone. Which is why I haven't changed it so far.

@axboe
Copy link
Owner

axboe commented Jun 27, 2022

Guess I didn't answer the specific question - yes, let's see a meson patch for the current branch and we can take a closer look at this.

@axboe axboe mentioned this pull request Jun 27, 2022
@axboe
Copy link
Owner

axboe commented Jun 27, 2022

And further, I'm not at all interested in a dump-and-run build system conversion. If you submit one and are asking for it to be merged, I fully expect YOU to know be the build system maintainer for liburing. It's a small project and should not be a lot of work, but you need to put up with my stupid questions and have time to devote to it. Initially I'm sure a bit more than in the long run, but you are on the hook for that. That means I need a way to contact you that isn't github (as that's purely a secondary thing for me), eg I need to know who you are and what your email is, and others do too.

Hence if you do go forward with this, make sure this information is in the git tree somehow. Thanks!

@tp-m
Copy link

tp-m commented Jun 27, 2022

I would also be happy to maintain or help maintain a meson build system going forward.

@kloczek
Copy link

kloczek commented Jun 27, 2022

                      '-Wno-unused-parameter',
                      '-Wno-sign-compare',
                      '-fomit-frame-pointer',

Hardcoding warning and optimistation flags is alway bad practice.

It would be good to update version in PR to be able to test that with last release.

@fischerling
Copy link
Contributor

If I am not alone maintaining and being responsible for the meson code as @tp-m comment shows, I would also happily maintain and provide help for a build system based on meson.

@stalkerg
Copy link

I also can help with Meson.

And I don't know anything about meson

luckily, the Meson is a very simple build system and one or two days is enough to start working with.

@axboe axboe closed this Dec 8, 2022
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

Successfully merging this pull request may close these issues.

8 participants