[build2] [bug] Crash - Buffer Overrun when using different (unsupported?) directory layout
Boris Kolpackov
boris at codesynthesis.com
Tue Feb 20 12:08:33 UTC 2018
Klaim - Joël Lamotte <mjklaim at gmail.com> writes:
> You will find in this email, below the "----", the error log and a link to
> the zip that contain all the repro case (it's pretty simple).
Thanks for the test case. I've managed to reproduce it and have fixed
the assertion (it was not a buffer overrun). The layout is still invalid,
though (see below).
> 1. build2 expect the following directory layout:
> /target-sources/buildfile
> /target-sources/manifest
> /target-sources/build/root.build
> /target-sources/build/bootstrap.build
>
> We learn that from the toolchain intro document, but I didn't find yet
> where it is specified what is actually allowed or required. I didn't
> finish reading all the available documentation, so could you point me
> to where it is specified, if it exists?
It is not yet documented precisely so the best way for now is to try
to mimick existing projects. But in short:
1. The build/ subdirectory signifies the project root. It must contain
bootstrap.build and may contain root.build.
2. All source code belonging to the project should be under the project
root (naturally).
> [...] I planned to add a directory named build2 to it's root directory
> and to all the build2-related stuffs in there. That is:
>
> /library-sources/build2/buildfile
> /library-sources/build2/manifest
> /library-sources/build2/root.build
> /library-sources/build2/bootstrap.build
> /library-sources/src/...
>
> Unfortunately it behaved in weird ways that I failed to understand [...]
Right, this is an invalid layout (it has no build/ subdirectory).
> I guessed that a "build/" directory was required to find the .build files
> so I moved the .build files in a new one below the directory containing
> my buildfile and tried again:
>
> /library-sources/build2/buildfile
> /library-sources/build2/manifest
> /library-sources/build2/build/root.build
> /library-sources/build2/build/bootstrap.build
> /library-sources/src/...
This is also an invalid layout (it has source files outside of the project
root).
> After Boris pointed me to the repos of build2 dependencies, I realized
> that the only layout actually tested (which makes sense for packaging
> these libraries) is one where the actual sources (or subrepo) is below
> the root dir.
>
> /my-build2-pkg/buildfile
> /my-build2-pkg/manifest
> /my-build2-pkg/build/root.build
> /my-build2-pkg/build/bootstrap.build
> /my-build2-pkg/library-sources/...
>
> This work as expected of course, so I will continue with it. I'm still
> surprised that the other layout are failing.
It appears a lot of people don't realize what a monumental task it is
to design and implement a single sane C++ project layout that is capable
of handling modern requirements (out of source builds, subprojects,
amalgamation, etc). Let a lot several such sane layouts. And we are not
even talking about insane layouts like the ones you've presented ;-).
So, in short, build2 will only ever support single, "true" layout that
all the existing projects/examples are using. Life is hard enough as it
is.
Boris
More information about the users
mailing list