Environment:
* RHEL 7.7 (Centos 7 for those playing at home I guess) in Azure.
* Toolchain: Software collection (SCL) devtoolset-9
* Yum installs native zlib-devel as a dependency for openssl-devel
* openssl-devel was installed in order to support PREFER_NATIVE= openssl
Observations:
In this environment because zlib-devel is installed, bootstrap by default picks up native zlib (/usr/include/zlib.h). When devel/libxml2 is then built, it is built against native zlib (libz.so.1 => /lib64/libz.so.1).
Next, some packages that also include "../../devel/zlib/buildlink3.mk" such nginx is built, it pulls in devel/zlib. This is weird because RHEL 7 includes zlib 1.2.7 which satisfies zlib>=1.2.3 in buildlink3.
What happens after is that libxml2 and downstream libxml2 dependencies (e.g. databases/postgresql) break because they see the pkgsrc zlib first:
/mnt/datadisk01/pkg/bin/postgres: /mnt/datadisk01/pkg/lib/libz.so.1: no version information available (required by /mnt/datadisk01/pkg/lib/libxml2.so.2)
# ldd /mnt/datadisk01/pkg/lib/libxml2.so.2
/mnt/datadisk01/pkg/lib/libxml2.so.2: /mnt/datadisk01/pkg/lib/libz.so.1: no version information available (required by /mnt/datadisk01/pkg/lib/libxml2.so.2)
/mnt/datadisk01/pkg/lib/libxml2.so.2: /mnt/datadisk01/pkg/lib/libz.so.1: no version information available (required by /mnt/datadisk01/pkg/lib/libxml2.so.2)
I worked around this by adding zlib to PREFER_NATIVE when re-building nginx, but is there a better way to resolve this? This looks somewhat related to the continuing "pkg_install fails when archivers/xz is installed" thread because RPATH manipulation could be involved, but I am opening a separate thread in case it is not.