errcodes.h and others not generated when compiling 13.6 on M1 Mac

Started by Sam Kidmanalmost 4 years ago9 messagesgeneral
Jump to latest
#1Sam Kidman
sam@fresho.com

Hello

I recently upgraded one of our applications to use postgres 13.6. When I
try to compile from a source checkout or by running asdf install (our
version manager which also compiles 13.6) I get the same error message:

../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h' file
not found

After digging around in the source it looks like it's supposed to be
generated. I can't figure out why this isn't working on my machine though.
It seems to happen on any M1 mac (my colleagues can reproduce it)

Any help on how to fix or debug this further would be appreciated.

Regards, Sam
www.fresho.com

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Sam Kidman (#1)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

On Wed, 2022-04-27 at 10:05 +1000, Sam Kidman wrote:

I recently upgraded one of our applications to use postgres 13.6. When I try to compile
from a source checkout or by running asdf install (our version manager which also compiles 13.6)
I get the same error message:

../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h' file not found

After digging around in the source it looks like it's supposed to be generated. I can't
figure out why this isn't working on my machine though. It seems to happen on any M1 mac
(my colleagues can reproduce it)

Any help on how to fix or debug this further would be appreciated.

I'd say that you didn't ./configure the PostgreSQL source.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Laurenz Albe (#2)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Wed, 2022-04-27 at 10:05 +1000, Sam Kidman wrote:

I recently upgraded one of our applications to use postgres 13.6. When I try to compile
from a source checkout or by running asdf install (our version manager which also compiles 13.6)
I get the same error message:

../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h' file not found

I'd say that you didn't ./configure the PostgreSQL source.

No, we dealt with that case long ago: you get

$ make
You need to run the 'configure' program first. See the file
'README.git' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html&gt;
make: *** [all] Error 1

Anyway, 13.6 certainly builds on my M1 laptop, as well as my
M1 buildfarm animal [1]https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=sifaka&amp;br=REL_13_STABLE, so it's not a case of "it's completely
broken". But you need the appropriate prerequisites, eg
an Xcode installation [2]https://www.postgresql.org/docs/devel/installation-platform-notes.html#INSTALLATION-NOTES-MACOS. I wonder exactly what configure
options the OP is using, and what's installed on his Mac
beyond bare macOS.

regards, tom lane

[1]: https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=sifaka&amp;br=REL_13_STABLE
[2]: https://www.postgresql.org/docs/devel/installation-platform-notes.html#INSTALLATION-NOTES-MACOS

#4Sam Kidman
sam@fresho.com
In reply to: Tom Lane (#3)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Ok, so apparently it's something wrong with our environments? Is it
possible something is failing silently? Any tips for how to troubleshoot?

BTW I'm not doing anything special when compiling, just git checkout
REL_13_6, ./configure, ./make (unless I am doing something wrong there?)

Also the README.md makes mention of an INSTALL file that contains
instructions about prerequisites for compilation but I couldn't find it in
the repository.

Regards, Sam

On Wed, Apr 27, 2022 at 11:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Wed, 2022-04-27 at 10:05 +1000, Sam Kidman wrote:

I recently upgraded one of our applications to use postgres 13.6. When

I try to compile

from a source checkout or by running asdf install (our version manager

which also compiles 13.6)

I get the same error message:

../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h'

file not found

I'd say that you didn't ./configure the PostgreSQL source.

No, we dealt with that case long ago: you get

$ make
You need to run the 'configure' program first. See the file
'README.git' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html&gt;
make: *** [all] Error 1

Anyway, 13.6 certainly builds on my M1 laptop, as well as my
M1 buildfarm animal [1], so it's not a case of "it's completely
broken". But you need the appropriate prerequisites, eg
an Xcode installation [2]. I wonder exactly what configure
options the OP is using, and what's installed on his Mac
beyond bare macOS.

regards, tom lane

[1]
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=sifaka&amp;br=REL_13_STABLE
[2]
https://www.postgresql.org/docs/devel/installation-platform-notes.html#INSTALLATION-NOTES-MACOS

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sam Kidman (#4)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Sam Kidman <sam@fresho.com> writes:

Ok, so apparently it's something wrong with our environments? Is it
possible something is failing silently? Any tips for how to troubleshoot?

Apparently so, but it's not very clear what. You didn't answer as to
what your build environment is, eg do you have any MacPorts or Homebrew
packages in play. The missing files are supposed to be generated by
Perl scripts, so I'm wondering if you have a broken Perl installation.
Apple's standard Perl works fine for this, which is why I'm suspicious
that you've got some other Perl installed that for some reason is
less fine.

BTW I'm not doing anything special when compiling, just git checkout
REL_13_6, ./configure, ./make (unless I am doing something wrong there?)

That's about what you need, yes.

Also the README.md makes mention of an INSTALL file that contains
instructions about prerequisites for compilation but I couldn't find it in
the repository.

?? There's no README.md in our git tree. There's no INSTALL there
either, because it's a generated file. But it's just a flat text
version of the same installation instructions I pointed you to before:

https://www.postgresql.org/docs/13/installation.html

regards, tom lane

#6Sam Kidman
sam@fresho.com
In reply to: Tom Lane (#3)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Actually I made some progress with this. I found if I:

cd src/backend
make generated-headers
cd ../..
make

it works.

So for some reason that submake-generated-headers target isn't getting
called for us.

On Wed, Apr 27, 2022 at 11:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Wed, 2022-04-27 at 10:05 +1000, Sam Kidman wrote:

I recently upgraded one of our applications to use postgres 13.6. When

I try to compile

from a source checkout or by running asdf install (our version manager

which also compiles 13.6)

I get the same error message:

../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h'

file not found

I'd say that you didn't ./configure the PostgreSQL source.

No, we dealt with that case long ago: you get

$ make
You need to run the 'configure' program first. See the file
'README.git' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html&gt;
make: *** [all] Error 1

Anyway, 13.6 certainly builds on my M1 laptop, as well as my
M1 buildfarm animal [1], so it's not a case of "it's completely
broken". But you need the appropriate prerequisites, eg
an Xcode installation [2]. I wonder exactly what configure
options the OP is using, and what's installed on his Mac
beyond bare macOS.

regards, tom lane

[1]
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=sifaka&amp;br=REL_13_STABLE
[2]
https://www.postgresql.org/docs/devel/installation-platform-notes.html#INSTALLATION-NOTES-MACOS

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sam Kidman (#6)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Sam Kidman <sam@fresho.com> writes:

So for some reason that submake-generated-headers target isn't getting
called for us.

Hmph. What "make" version are you using exactly? Are you using
any nondefault make options? Are you invoking our Makefile from
some make script of your own? (There are some hacks involving
toplevel vs not-top-level Makefiles that you might be falling
foul of.)

regards, tom lane

#8Sam Kidman
sam@fresho.com
In reply to: Tom Lane (#7)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Are you using any nondefault make options? Are you invoking our Makefile

from some make script of your own?
This all came about because we use asdf as a version manager which compiles
the versions of various programs you want to use. There's potentially a
problem with the asdf plugin for postgres which I'd like to fix. I couldn't
make head nor tails of the problem with asdf, so I cloned the source and
started trying to compile it myself. The error I get when I compile it
myself and when asdf does it are the same (the problem with header files
not being generated)

When I compile it myself I'm not doing anything more complicated than:
git checkout REL_13_6
./configure
./make

modulo running git clean -f -d -X and make clean to get back to a clean
source checkout.

You didn't answer as to what your build environment is, eg do you have

any MacPorts or Homebrew packages in play.
Sorry, it's difficult to answer as I'm not sure exactly what you're asking.
But I do use homebrew. I do NOT use MacPorts.
AFAIK, the version of perl that is used is the system version. I do have
the xcode dev tools installed. I can provide more information, but I'll
need more specific questions.

What "make" version are you using exactly?

➜ postgres git:(d7db957207) make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

On Fri, Apr 29, 2022 at 10:16 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

Sam Kidman <sam@fresho.com> writes:

So for some reason that submake-generated-headers target isn't getting
called for us.

Hmph. What "make" version are you using exactly? Are you using
any nondefault make options? Are you invoking our Makefile from
some make script of your own? (There are some hacks involving
toplevel vs not-top-level Makefiles that you might be falling
foul of.)

regards, tom lane

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sam Kidman (#8)
Re: errcodes.h and others not generated when compiling 13.6 on M1 Mac

Sam Kidman <sam@fresho.com> writes:

Are you using any nondefault make options? Are you invoking our Makefile
from some make script of your own?

This all came about because we use asdf as a version manager which compiles
the versions of various programs you want to use. There's potentially a
problem with the asdf plugin for postgres which I'd like to fix. I couldn't
make head nor tails of the problem with asdf, so I cloned the source and
started trying to compile it myself. The error I get when I compile it
myself and when asdf does it are the same (the problem with header files
not being generated)

Our manual recommends doing it this way if you invoke PG's build from
an upper-level makefile:

build-postgresql:
$(MAKE) -C postgresql MAKELEVEL=0 all

I don't know anything about asdf, but if it uses make scripts then a
likely explanation for the problem is lack of the "MAKELEVEL=0" bit.

regards, tom lane