Issues cross-compiling libpq 14.x to MacOS armv8

2021-11-30 Thread Vincas Dargis

Hi list,

I wanted to update [0] Conan package for building libpq 14.1. Usually it's enough to add new tarball and declare it's 
hash, but it seems that since 14.0 cross-compiling to armv8 MacOS now fails, and I *guess* it's due to removed 
`--disable-strong-random` option.


Here's some snippets from build log: [1]

```
...
Cross-build from 'Macos:x86_64' to 'Macos:armv8'
...
checking which random number source to use... /dev/urandom
checking for /dev/urandom... libpq/14.1:
libpq/14.1: WARN: Build folder is dirty, removing it: 
/Users/jenkins/w/BuildSingleReference@2/.conan/data/libpq/14.1/_/_/build/30acef53c04f36d5f9412c84a1b3a7434a1f10fb

configure: WARNING: unrecognized options: --disable-strong-random
configure: WARNING: using cross tools not prefixed with host triplet
configure: error: cannot check for file existence when cross compiling
libpq/14.1: ERROR: Package '30acef53c04f36d5f9412c84a1b3a7434a1f10fb' build 
failed
```

Could this mean that building on armv8 Macos cannot work with "strong random", or at least in the way PostgreSQL 
configure script expect that to be detected to work?


Thanks!

P.S. there was earlier attempt by another contributor to update Conan package to 14.0, which also failed in the same 
manner [2].


[0] https://github.com/conan-io/conan-center-index/pull/8109
[1] 
https://c3i.jfrog.io/c3i/misc/logs/pr/8109/2-configs/macos-m1-clang/libpq/14.1//30acef53c04f36d5f9412c84a1b3a7434a1f10fb-build.txt

[2] https://github.com/conan-io/conan-center-index/pull/7676




Re: Issues cross-compiling libpq 14.x to MacOS armv8

2021-12-02 Thread Vincas Dargis

Thanks Tom!

Should we expect this fix in the next 14 patch release, or only in 15.x?

If latter, I would add this patch into Conan package itself, to make it work 
earlier.

On 2021-11-30 23:33, Tom Lane wrote:

I wrote:

It seems like a useful test when *not* cross compiling, which is most
of the time.  I'd just wrap that bit in
 if test "$cross_compiling" = no; then


Or actually, since we should print something, it looks like this will do:

diff --git a/configure.ac b/configure.ac
index a5c10b8d56..7257afda20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2287,6 +2287,8 @@ if test x"$with_ssl" = x"openssl" ; then
AC_MSG_RESULT([OpenSSL])
  elif test x"$PORTNAME" = x"win32" ; then
AC_MSG_RESULT([Windows native])
+elif test x"$cross_compiling" = x"yes"; then
+  AC_MSG_RESULT([assuming /dev/urandom])
  else
AC_MSG_RESULT([/dev/urandom])
AC_CHECK_FILE([/dev/urandom], [], [])

Off to see if I can verify that before pushing.

regards, tom lane