Re: Annoying build warnings from latest Apple toolchain
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2023-09-28T20:32:13Z
Lists: pgsql-hackers
Hi,
On 2023-09-27 16:52:44 -0400, Tom Lane wrote:
> I wrote:
> > I've not yet looked at the meson build infrastructure to
> > see if it needs a corresponding change.
>
> I think it doesn't, as long as all the relevant build targets
> write their dependencies with "frontend_code" before "libpq".
Hm, that's not great. I don't think that should be required. I'll try to take
a look at why that's needed.
> However, it's hard to test this, because the meson build
> seems completely broken on current macOS:
I am travelling and I don't quite dare to upgrade my mac mini remotely. So I
can't try Sonoma directly.
But CI worked after switching to sonoma - although installing packages from
macports took forever, due to macports building all packages locally.
https://cirrus-ci.com/task/5133869171605504
There's some weird warnings about hashlib/blake2, but it looks like that's a
python installation issue. Looks like this is with python from macports in
PATH.
[00:59:14.442] ERROR:root:code for hash blake2b was not found.
[00:59:14.442] Traceback (most recent call last):
[00:59:14.442] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/hashlib.py", line 307, in <module>
[00:59:14.442] globals()[__func_name] = __get_hash(__func_name)
[00:59:14.442] ^^^^^^^^^^^^^^^^^^^^^^^
[00:59:14.442] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/hashlib.py", line 129, in __get_openssl_constructor
[00:59:14.442] return __get_builtin_constructor(name)
[00:59:14.442] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:59:14.442] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
[00:59:14.442] raise ValueError('unsupported hash type ' + name)
[00:59:14.442] ValueError: unsupported hash type blake2b
This just happens whenever python's hashlib - supposedly in the standard
library - is imported.
There *are* some buildsystem warnings:
[00:59:27.289] [260/2328] Linking target src/interfaces/libpq/libpq.5.dylib
[00:59:27.289] ld: warning: -undefined error is deprecated
[00:59:27.289] ld: warning: ignoring -e, not used for output type
Full command:
[1/1] cc -o src/interfaces/libpq/libpq.5.dylib src/interfaces/libpq/libpq.5.dylib.p/fe-auth-scram.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-auth.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-connect.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-exec.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-lobj.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-misc.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-print.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-protocol3.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-secure.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-trace.c.o src/interfaces/libpq/libpq.5.dylib.p/legacy-pqsignal.c.o src/interfaces/libpq/libpq.5.dylib.p/libpq-events.c.o src/interfaces/libpq/libpq.5.dylib.p/pqexpbuffer.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-secure-common.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-secure-openssl.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-gssapi-common.c.o src/interfaces/libpq/libpq.5.dylib.p/fe-secure-gssapi.c.o -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -shared -install_name @rpath/libpq.5.dylib -compatibility_version 5 -current_version 5.17 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -Og -ggdb -Wl,-rpath,/opt/local/lib -Wl,-rpath,/opt/local/libexec/openssl3/lib src/common/libpgcommon_shlib.a src/port/libpgport_shlib.a -exported_symbols_list=/Users/admin/pgsql/build/src/interfaces/libpq/exports.list -lm /opt/local/lib/libintl.dylib /opt/local/lib/libgssapi_krb5.dylib /opt/local/lib/libldap.dylib /opt/local/lib/liblber.dylib /opt/local/libexec/openssl3/lib/libssl.dylib /opt/local/libexec/openssl3/lib/libcrypto.dylib /opt/local/lib/libz.dylib /opt/local/lib/libzstd.dylib
ld: warning: -undefined error is deprecated
ld: warning: ignoring -e, not used for output type
So we need to make the addition of -Wl,-undefined,error conditional, that
should be easy enough. Although I'm a bit confused about this being
deprecated.
For the -e bit, this seems to do the trick:
@@ -224,7 +224,7 @@ elif host_system == 'darwin'
library_path_var = 'DYLD_LIBRARY_PATH'
export_file_format = 'darwin'
- export_fmt = '-exported_symbols_list=@0@'
+ export_fmt = '-Wl,-exported_symbols_list,@0@'
mod_link_args_fmt = ['-bundle_loader', '@0@']
mod_link_with_dir = 'bindir'
It's quite annoying that apple is changing things option syntax.
> (I also tried with a more recent meson version, 1.1.1, with
> the same result.)
Looks like you need 1.2 for the new clang / ld output... Apparently apple's
linker changed the format of its version output :/.
Greetings,
Andres Freund
Commits
-
meson: macos: Avoid warnings on Sonoma
- a3da95deee38 17.0 landed
- 9158e4b9eb99 16.3 landed
-
Restore proper linkage of pg_char_to_encoding() and friends.
- b6c7cfac88c4 17.0 landed
-
meson: macos: Correct -exported_symbols_list syntax for Sonoma compat
- d5c5312dc8b6 16.1 landed
- b1a8dc846da4 17.0 landed
-
Suppress macOS warnings about duplicate libraries in link commands.
- e9d1560d3e4d 14.10 landed
- d8ceb98e4cb0 12.17 landed
- be3398ea155c 15.5 landed
- 75c562653cbe 16.1 landed
- 4d10fda52042 11.22 landed
- 1b64e374c981 13.13 landed
- 06843df4abc5 17.0 landed
-
Stop using "-multiply_defined suppress" on macOS.
- e73d6a0df42c 16.1 landed
- abe423712a12 12.17 landed
- 78f17fb97a7e 15.5 landed
- 5d60e8ed3f18 14.10 landed
- 53cc19bfa807 13.13 landed
- 3aa021b29b0e 17.0 landed
- 0e0de20c88b9 11.22 landed
-
Fix the inadvertent libpq ABI breakage discovered by Martin Pitt: the
- 8468146b03c8 8.3.0 cited
-
Cause libpq and ecpg libraries to be built as proper shared libraries
- 9df30869725a 8.0.0 cited