Thread: Building 12.3 from source on Mac

Building 12.3 from source on Mac

From
Paul Förster
Date:
Hi,

I'm not sure this is the right list, but I have a problem concerning building PostgreSQL 12.3 from source on a Mac.

I do:

./configure \
    --prefix=${pgTargetDir} \
    --enable-nls \
    --with-perl \
    --with-python \
    --with-libxml \
    --with-tclconfig=/usr/lib64 \
    PG_SYSROOT=$(xcodebuild -version -sdk macosx Path)

and I get:

...
checking for __cpuid... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... no
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... yes
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... no
checking which CRC-32C implementation to use... SSE 4.2 with runtime check
checking which semaphore API to use... System V
checking for /dev/urandom... yes
checking which random number source to use... /dev/urandom
checking for library containing bind_textdomain_codeset... no
configure: error: a gettext implementation is required for NLS

If I leave out --enable-nls then building works fine and I get everything without error. But why is there a problem
withgettext? 

My Mac:

MacBook Pro (Retina, 15-inch, Late 2013)
macOS Catalina 10.15.6 (all updates installed)
Xcode 11.6 (11E708) w/ command line tools installed
No brew, no MacPorts, or other stuff like this is installed.

Does anyone have an idea? Thanks in advance.

Cheers,
Paul


Re: Building 12.3 from source on Mac

From
Daniel Gustafsson
Date:
> On 23 Jul 2020, at 12:01, Paul Förster <paul.foerster@gmail.com> wrote:

> If I leave out --enable-nls then building works fine and I get everything without error. But why is there a problem
withgettext? 

gettext is not shipped by default with macOS, you will have to install it
separately via your favourite package manager or by building from source.  To
verify you can always search your system for the required header file:

    mdfind -name libintl.h

See https://www.postgresql.org/docs/current/install-requirements.html for more
information on build-time requirements.

cheers ./daniel


Re: Building 12.3 from source on Mac

From
Paul Förster
Date:
Hi Daniel,

> On 23. Jul, 2020, at 12:37, Daniel Gustafsson <daniel@yesql.se> wrote:
> gettext is not shipped by default with macOS, you will have to install it
> separately via your favourite package manager or by building from source.  To
> verify you can always search your system for the required header file:
>
>    mdfind -name libintl.h
>
> See https://www.postgresql.org/docs/current/install-requirements.html for more
> information on build-time requirements.

thanks for the answer and the pointer.

But I am still wondering: mdfind spits out libintl.h without me installing the gettext library:

paul@meerkat:~$ mdfind -name libintl.h
/usr/local/include/libintl.h

Why is that? Did I miss something?

Cheers,
Paul


Re: Building 12.3 from source on Mac

From
Tom Lane
Date:
=?utf-8?Q?Paul_F=C3=B6rster?= <paul.foerster@gmail.com> writes:
>> On 23. Jul, 2020, at 12:37, Daniel Gustafsson <daniel@yesql.se> wrote:
>> gettext is not shipped by default with macOS, you will have to install it
>> separately via your favourite package manager or by building from source.

> But I am still wondering: mdfind spits out libintl.h without me installing the gettext library:
> paul@meerkat:~$ mdfind -name libintl.h
> /usr/local/include/libintl.h

Kind of looks like you *did* install gettext as Daniel suggested
(macOS proper would never put anything under /usr/local).  Maybe
you did not ask for that specifically, but installed some package
that requires it?

However, Apple's toolchain doesn't search /usr/local by default,
I believe.  You'll need to add something along the line of

    --with-includes=/usr/local/include --with-libs=/usr/local/lib

to your configure command.

            regards, tom lane



Re: Building 12.3 from source on Mac

From
Paul Förster
Date:
Hi Tom,

> On 23. Jul, 2020, at 15:42, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Kind of looks like you *did* install gettext as Daniel suggested
> (macOS proper would never put anything under /usr/local).  Maybe
> you did not ask for that specifically, but installed some package
> that requires it?
>
> However, Apple's toolchain doesn't search /usr/local by default,
> I believe.  You'll need to add something along the line of
>
>    --with-includes=/usr/local/include --with-libs=/usr/local/lib
>
> to your configure command.

I tried with your options. Still, same effect. Ok, worth a try.

I found:

paul@meerkat:~$ mdfind -name gettext | egrep -vi "/(share|man|bin|system)/"
/usr/local/info/gettext.info
/usr/local/lib/gettext
/Library/i-Installer/Receipts/gettext.ii2receipt
/usr/local/include/gettext-po.h

paul@meerkat:~$ mdfind -name libintl | egrep -vi "/(share|man|bin|system)/"
/usr/local/lib/libintl.3.4.3.dylib
/usr/local/lib/libintl.a
/usr/local/lib/libintl.la
/usr/local/include/libintl.h

But I did not *knowingly* install that. I guess it comes as part of Xcode but I really don't know. I'm not a developer,
Ijust want to build PostgreSQL for my Mac. 

Cheers,
Paul


Re: Building 12.3 from source on Mac

From
Tom Lane
Date:
=?utf-8?Q?Paul_F=C3=B6rster?= <paul.foerster@gmail.com> writes:
>> On 23. Jul, 2020, at 15:42, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> However, Apple's toolchain doesn't search /usr/local by default,
>> I believe.  You'll need to add something along the line of
>> --with-includes=/usr/local/include --with-libs=/usr/local/lib
>> to your configure command.

> I tried with your options. Still, same effect. Ok, worth a try.

I might be wrong about that.  But this shows another issue:

> paul@meerkat:~$ mdfind -name libintl | egrep -vi "/(share|man|bin|system)/"
> /usr/local/lib/libintl.3.4.3.dylib
> /usr/local/lib/libintl.a
> /usr/local/lib/libintl.la
> /usr/local/include/libintl.h

Looks like what you lack is a symlink libintl.dylib -> libintl.3.4.3.dylib
in /usr/local/lib.  It's not real clear to me why you'd have .a and .la
files and no versionless symlink, because all of those files would
just be used for linking dependent software.

> But I did not *knowingly* install that. I guess it comes as part of Xcode but I really don't know. I'm not a
developer,I just want to build PostgreSQL for my Mac. 

These files absolutely, positively, gold-plated 100% did not come
with XCode.  Homebrew installs stuff under /usr/local though.
Not sure about MacPorts.

            regards, tom lane



Re: Building 12.3 from source on Mac

From
Paul Förster
Date:
Hi Tom,

> On 23. Jul, 2020, at 16:03, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Looks like what you lack is a symlink libintl.dylib -> libintl.3.4.3.dylib
> in /usr/local/lib.  It's not real clear to me why you'd have .a and .la
> files and no versionless symlink, because all of those files would
> just be used for linking dependent software.

there is not a single symlink in /usr/local/lib:

paul@meerkat:~$ ll /usr/local/lib
total 113968
drwxr-xr-x  4 root  wheel      128 Oct 17  2014 ImageMagick-6.3.3
-rw-r--r--+ 1 root  wheel      606 May 14  2010 charset.alias
drwxr-xr-x  6 root  wheel      192 Oct 17  2014 gettext
-rwxr-xr-x+ 1 root  wheel  4244568 Mar  6  2007 libMagick++.10.0.7.dylib
-rw-r--r--+ 1 root  wheel  4722468 Mar  6  2007 libMagick++.a
-rwxr-xr-x+ 1 root  wheel      980 Mar  6  2007 libMagick++.la
-rwxr-xr-x+ 1 root  wheel  8414800 Mar  6  2007 libMagick.10.0.7.dylib
-rw-r--r--+ 1 root  wheel  8129604 Mar  6  2007 libMagick.a
-rwxr-xr-x+ 1 root  wheel      912 Mar  6  2007 libMagick.la
-rwxr-xr-x+ 1 root  wheel  2416164 Mar  6  2007 libWand.10.0.7.dylib
-rw-r--r--+ 1 root  wheel  3354004 Mar  6  2007 libWand.a
-rwxr-xr-x+ 1 root  wheel      926 Mar  6  2007 libWand.la
-rwxr-xr-x+ 1 root  wheel   737672 Sep 23  2006 libasprintf.0.0.0.dylib
-rw-r--r--+ 1 root  wheel    47704 Sep 23  2006 libasprintf.a
-rwxr-xr-x+ 1 root  wheel      832 Sep 23  2006 libasprintf.la
-rwxr-xr-x+ 1 root  wheel  4024172 Mar  6  2007 libfreetype.6.3.12.dylib
-rw-r--r--+ 1 root  wheel  4240572 Mar  6  2007 libfreetype.a
-rwxr-xr-x+ 1 root  wheel      838 Mar  6  2007 libfreetype.la
-rwxr-xr-x+ 1 root  wheel  3429720 Mar 13  2007 libgdraw.1.0.14.dylib
-rwxr-xr-x+ 1 root  wheel      891 Mar 13  2007 libgdraw.la
-rwxr-xr-x+ 1 root  wheel   485908 Sep 23  2006 libgettextlib-0.14.5.dylib
-rwxr-xr-x+ 1 root  wheel      908 Sep 23  2006 libgettextlib.la
-rwxr-xr-x+ 1 root  wheel    79480 Sep 23  2006 libgettextpo.0.1.0.dylib
-rw-r--r--+ 1 root  wheel    62136 Sep 23  2006 libgettextpo.a
-rwxr-xr-x+ 1 root  wheel      954 Sep 23  2006 libgettextpo.la
-rwxr-xr-x+ 1 root  wheel  1097632 Sep 23  2006 libgettextsrc-0.14.5.dylib
-rwxr-xr-x+ 1 root  wheel      940 Sep 23  2006 libgettextsrc.la
-rwxr-xr-x+ 1 root  wheel  5713584 Mar 13  2007 libgunicode.2.0.3.dylib
-rwxr-xr-x+ 1 root  wheel      877 Mar 13  2007 libgunicode.la
-rw-r--r--+ 1 root  wheel   253512 Sep 23  2006 libintl.3.4.3.dylib
-rw-r--r--+ 1 root  wheel   286284 Sep 23  2006 libintl.a
-rw-r--r--+ 1 root  wheel      829 Sep 23  2006 libintl.la
-rwxr-xr-x+ 1 root  wheel  2121700 Mar 13  2007 libuninameslist-fr.0.0.1.dylib
-rwxr-xr-x+ 1 root  wheel      774 Mar 13  2007 libuninameslist-fr.la
-rwxr-xr-x+ 1 root  wheel  2148388 Mar 13  2007 libuninameslist.0.0.1.dylib
-rwxr-xr-x+ 1 root  wheel      756 Mar 13  2007 libuninameslist.la
-rw-r--r--+ 1 root  wheel  1670612 Sep 28  2006 libwmf.a
-rwxr-xr-x+ 1 root  wheel      913 Sep 28  2006 libwmf.la
-rw-r--r--+ 1 root  wheel   571300 Sep 28  2006 libwmflite.a
-rwxr-xr-x+ 1 root  wheel      751 Sep 28  2006 libwmflite.la
drwxr-xr-x  7 root  wheel      224 Oct 17  2014 pkgconfig

> These files absolutely, positively, gold-plated 100% did not come
> with XCode.  Homebrew installs stuff under /usr/local though.
> Not sure about MacPorts.

but I didn't install Homebrew, MacPorts, Fink or other package managers.

Are they leftovers from old OS versions? After all, I started with don't know what macOS (Mavericks or Yosemite?) back
thenand always upgraded the OS, one major release after the other and it has always been working fine with no problem
atall. And now, as I mentioned before, it's Catalina and still works with not a single reinstall. 

paul@meerkat:~$ uname -a
Darwin meerkat.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul  5 00:43:10 PDT 2020;
root:xnu-6153.141.1~9/RELEASE_X86_64x86_64 

Cheers,
Paul




Re: Building 12.3 from source on Mac

From
Tom Lane
Date:
=?utf-8?Q?Paul_F=C3=B6rster?= <paul.foerster@gmail.com> writes:
> there is not a single symlink in /usr/local/lib:

Not only that, but look at the file dates:

> -rw-r--r--+ 1 root  wheel   253512 Sep 23  2006 libintl.3.4.3.dylib
> -rw-r--r--+ 1 root  wheel   286284 Sep 23  2006 libintl.a
> -rw-r--r--+ 1 root  wheel      829 Sep 23  2006 libintl.la

You should see what "file" reports these as, but there's a good
bet that these are 32-bit code and won't even run on Catalina.

>> These files absolutely, positively, gold-plated 100% did not come
>> with XCode.  Homebrew installs stuff under /usr/local though.
>> Not sure about MacPorts.

> but I didn't install Homebrew, MacPorts, Fink or other package managers.

You apparently installed *something*, or several somethings, back
in ought-six or so.  Do you really remember what you were doing
back then?

Anyway, now that we realize these are ancient history, you likely
need to install a more modern version anyway.

            regards, tom lane



Re: Building 12.3 from source on Mac

From
Paul Förster
Date:
Hi Tom,

> On 23. Jul, 2020, at 16:50, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> You should see what "file" reports these as, but there's a good
> bet that these are 32-bit code and won't even run on Catalina.

yes, they seem pretty old:

paul@meerkat:/usr/local/lib$ file libintl.*
libintl.3.4.3.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386]
[ppc:Mach-Odynamically linked shared library ppc] 
libintl.3.4.3.dylib (for architecture i386):    Mach-O dynamically linked shared library i386
libintl.3.4.3.dylib (for architecture ppc):    Mach-O dynamically linked shared library ppc
libintl.a:           Mach-O universal binary with 2 architectures: [i386:current ar archive random library]
[ppc:currentar archive random library] 
libintl.a (for architecture i386):    current ar archive random library
libintl.a (for architecture ppc):    current ar archive random library
libintl.la:          libtool library file, ASCII text

> You apparently installed *something*, or several somethings, back
> in ought-six or so.  Do you really remember what you were doing
> back then?

I used to have an old iMac. And when I got this laptop, I did a time machine backup then and restored it to this laptop
tonot have to install all my software from scratch. Maybe it's old stuff from Java installations. I also have XQuartz
runningsince ages now which has been updated from version to version, currently 2.7.11. I don't know which it could be
thatcould be that old. 

Seems like a lot of old stuff:

paul@meerkat:/usr/local/lib$ file * | egrep "(i386|ppc)" | awk '{ print $1 }' | tr -d ':' | sort -u
libMagick++.10.0.7.dylib
libMagick++.a
libMagick.10.0.7.dylib
libMagick.a
libWand.10.0.7.dylib
libWand.a
libasprintf.0.0.0.dylib
libasprintf.a
libfreetype.6.3.12.dylib
libfreetype.a
libgdraw.1.0.14.dylib
libgettextlib-0.14.5.dylib
libgettextpo.0.1.0.dylib
libgettextpo.a
libgettextsrc-0.14.5.dylib
libgunicode.2.0.3.dylib
libintl.3.4.3.dylib
libintl.a
libuninameslist-fr.0.0.1.dylib
libuninameslist.0.0.1.dylib
libwmf.a
libwmflite.a

> Anyway, now that we realize these are ancient history, you likely
> need to install a more modern version anyway.

will try, thanks. :-)

Cheers,
Paul




Re: Building 12.3 from source on Mac

From
Pavel Borisov
Date:
I'd like to add that MacPorts installs everything to /opt/ and /opt/local unless someone configures other path.
You can also easily check is something from homebrew installation by running 'brew config' and looking at HOMEBREW_PREFIX entry.

Regards,
Pavel 

чт, 23 июл. 2020 г. в 19:05, Paul Förster <paul.foerster@gmail.com>:
Hi Tom,

> On 23. Jul, 2020, at 16:50, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> You should see what "file" reports these as, but there's a good
> bet that these are 32-bit code and won't even run on Catalina.

yes, they seem pretty old:

paul@meerkat:/usr/local/lib$ file libintl.*         
libintl.3.4.3.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [ppc:Mach-O dynamically linked shared library ppc]
libintl.3.4.3.dylib (for architecture i386):    Mach-O dynamically linked shared library i386
libintl.3.4.3.dylib (for architecture ppc):     Mach-O dynamically linked shared library ppc
libintl.a:           Mach-O universal binary with 2 architectures: [i386:current ar archive random library] [ppc:current ar archive random library]
libintl.a (for architecture i386):      current ar archive random library
libintl.a (for architecture ppc):       current ar archive random library
libintl.la:          libtool library file, ASCII text

> You apparently installed *something*, or several somethings, back
> in ought-six or so.  Do you really remember what you were doing
> back then?

I used to have an old iMac. And when I got this laptop, I did a time machine backup then and restored it to this laptop to not have to install all my software from scratch. Maybe it's old stuff from Java installations. I also have XQuartz running since ages now which has been updated from version to version, currently 2.7.11. I don't know which it could be that could be that old.

Seems like a lot of old stuff:

paul@meerkat:/usr/local/lib$ file * | egrep "(i386|ppc)" | awk '{ print $1 }' | tr -d ':' | sort -u
libMagick++.10.0.7.dylib
libMagick++.a
libMagick.10.0.7.dylib
libMagick.a
libWand.10.0.7.dylib
libWand.a
libasprintf.0.0.0.dylib
libasprintf.a
libfreetype.6.3.12.dylib
libfreetype.a
libgdraw.1.0.14.dylib
libgettextlib-0.14.5.dylib
libgettextpo.0.1.0.dylib
libgettextpo.a
libgettextsrc-0.14.5.dylib
libgunicode.2.0.3.dylib
libintl.3.4.3.dylib
libintl.a
libuninameslist-fr.0.0.1.dylib
libuninameslist.0.0.1.dylib
libwmf.a
libwmflite.a

> Anyway, now that we realize these are ancient history, you likely
> need to install a more modern version anyway.

will try, thanks. :-)

Cheers,
Paul