Обсуждение: Re: pgsql: meson: Add initial version of meson based build system

Поиск
Список
Период
Сортировка

Re: pgsql: meson: Add initial version of meson based build system

От
Christoph Berg
Дата:
Re: Andres Freund
> https://git.postgresql.org/pg/commitdiff/e6927270cd18d535b77cbe79c55c6584351524be

This commit broke VPATH builds when the original source directory
contains symlinks.

The $PWD is /home/myon/postgresql/pg/master, but the actual directory
is /home/myon/projects/postgresql/pg/postgresql. When I
  mkdir build; cd build && ../configure
there, I get a build directory missing a lot of files/directories:

$ ls build/
config.log  config.status*  GNUmakefile  meson.build  src/
$ ls build/src/
backend/  include/  interfaces/  Makefile.global  Makefile.port@
$ ls build/src/backend/
port/

Given there are no other changes I think this bit is at fault:

> Modified Files
> --------------
> configure.ac                                       |    6 +

+# Ensure that any meson build directories would reconfigure and see that
+# there's a conflicting in-tree build and can error out.
+if test "$vpath_build"="no"; then
+  touch meson.build
+fi

Christoph



Re: pgsql: meson: Add initial version of meson based build system

От
Andres Freund
Дата:
Hi,

Uh, huh.

On 2024-04-17 15:42:28 +0200, Christoph Berg wrote:
> Re: Andres Freund
> > https://git.postgresql.org/pg/commitdiff/e6927270cd18d535b77cbe79c55c6584351524be
>
> This commit broke VPATH builds when the original source directory
> contains symlinks.

I.e. a symlink to the source directory, not a symlink inside the source
directory.


> Given there are no other changes I think this bit is at fault:
>
> > Modified Files
> > --------------
> > configure.ac                                       |    6 +
>
> +# Ensure that any meson build directories would reconfigure and see that
> +# there's a conflicting in-tree build and can error out.
> +if test "$vpath_build"="no"; then
> +  touch meson.build
> +fi

Argh, this is missing spaces around the '=', leading to the branch always
being entered.

What I don't understand is how that possibly could affect the prep_buildtree
step, that happens earlier.

Hm.

Uh, I don't think it does? Afaict this failure is entirely unrelated to 'touch
meson.build'?  From what I can tell the problem is that config/prep_buildtree
is invoked with the symlinked path, and that that doesn't seem to work:

bash -x /home/andres/src/postgresql-via-symlink/config/prep_buildtree /home/andres/src/postgresql-via-symlink .
++ basename /home/andres/src/postgresql-via-symlink/config/prep_buildtree
+ me=prep_buildtree
+ help='Usage: prep_buildtree sourcetree [buildtree]'
+ test -z /home/andres/src/postgresql-via-symlink
+ test x/home/andres/src/postgresql-via-symlink = x--help
+ unset CDPATH
++ cd /home/andres/src/postgresql-via-symlink
++ pwd
+ sourcetree=/home/andres/src/postgresql-via-symlink
++ cd .
++ pwd
+ buildtree=/tmp/pgs
++ find /home/andres/src/postgresql-via-symlink -type d '(' '(' -name CVS -prune ')' -o '(' -name .git -prune ')' -o
-print')'
 
++ grep -v '/home/andres/src/postgresql-via-symlink/doc/src/sgml/\+'
++ find /home/andres/src/postgresql-via-symlink -name Makefile -print -o -name GNUmakefile -print
++ grep -v /home/andres/src/postgresql-via-symlink/doc/src/sgml/images/
+ exit 0

Note that the find does not return anything.

Greetings,

Andres Freund



Re: pgsql: meson: Add initial version of meson based build system

От
Christoph Berg
Дата:
Re: Andres Freund
> > This commit broke VPATH builds when the original source directory
> > contains symlinks.
> 
> I.e. a symlink to the source directory, not a symlink inside the source
> directory.

Yes.

> Argh, this is missing spaces around the '=', leading to the branch always
> being entered.

Glad I found at least something :)

> Uh, I don't think it does? Afaict this failure is entirely unrelated to 'touch
> meson.build'?  From what I can tell the problem is that config/prep_buildtree
> is invoked with the symlinked path, and that that doesn't seem to work:

Apparently I messed up both the git bisect run and manually
confirm the problem later. Trying again now, the problem has been
existing at least since 2002, probably earlier.

I've been using this directory layout for years, apparently so far
I've always only used non-VPATH builds or dpkg-buildpackage, which
probably canonicalizes the path before building, given it works.

Since no one else has been complaining, it might not be worth fixing.

Sorry for the noise!

Christoph



Re: pgsql: meson: Add initial version of meson based build system

От
Andres Freund
Дата:
Hi,

On 2024-04-18 10:54:18 +0200, Christoph Berg wrote:
> Re: Andres Freund
> > > This commit broke VPATH builds when the original source directory
> > > contains symlinks.
> > Argh, this is missing spaces around the '=', leading to the branch always
> > being entered.
> 
> Glad I found at least something :)

Yep :). I pushed a fix to that now.


> I've been using this directory layout for years, apparently so far
> I've always only used non-VPATH builds or dpkg-buildpackage, which
> probably canonicalizes the path before building, given it works.

I wonder if perhaps find's behaviour might have changed at some point?


> Since no one else has been complaining, it might not be worth fixing.

I'm personally not excited about working on fixing this, but if somebody else
wants to spend the cycles to make this work reliably...

It's certainly interesting that we have some code worrying about symlinks in
configure.ac:
# prepare build tree if outside source tree
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
# Note 2: /bin/pwd might be better than shell's built-in at getting
#         a symlink-free name.

But we only use this to determine if we're doing a vpath build, not as the
path passed to prep_buildtree...

Greetings,

Andres Freund