Repository: conan-io/conan-center-index

Issue:
[package] libpq/11.5: Cannot be cross compiled
Using the default `build.py` script created when calling `conan new` will not compile. This is a huge problem since building a package from source which depends on libpq using the conan package tools will fail by default. Additionally, if you really want to cross compile (which I intend to do) it will definitively fail.

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **libpq/11.5**
  * Operating System+version: **Manjaro Linux 64 Bit**
  * Docker image: **conanio/gcc8**
  * Conan version: **conan 1.21.0**
  * Python version: **Python 3.7.1**


### Conan profile
```
+--------------------+
| Profile            |
|--------------------|
| include(default)   |
|                    |
| [settings]         |
| arch=x86           |
| build_type=Release |
| compiler=gcc       |
| compiler.version=8 |
| [options]          |
| libpq:shared=True  |
| [env]              |
|                    |
| [build_requires]   |
+--------------------+
```


### Steps to reproduce
* create new directory
* copy default `build.py` into directory
* copy `conanfile.py` and `conandata.yml` from repository into directory
* create Dockerfile in directory and insert following content:
```
FROM conanio/gcc8

RUN sudo pip install --upgrade conan_package_tools && \ 
    conan user

ENV CONAN_USERNAME="<some-user-name>" \
    CONAN_REFERENCE="libpq/11.5" \
    CONAN_CHANNEL="testing" \
    CONAN_GCC_VERSIONS="8"

COPY *.py .
COPY *.yml .
RUN python build.py
```
* run `docker build .` from within the directory


### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
****************************************************************************************************

   ____ ____ _____    __   ____                          ____            _                      _____           _      __  
  / ___|  _ \_   _|  / /  / ___|___  _ __   __ _ _ __   |  _ \ __ _  ___| | ____ _  __ _  ___  |_   _|__   ___ | |___  \ \ 
 | |   | |_) || |   | |  | |   / _ \| '_ \ / _` | '_ \  | |_) / _` |/ __| |/ / _` |/ _` |/ _ \   | |/ _ \ / _ \| / __|  | |
 | |___|  __/ | |   | |  | |__| (_) | | | | (_| | | | | |  __/ (_| | (__|   < (_| | (_| |  __/   | | (_) | (_) | \__ \  | |
  \____|_|    |_|   | |   \____\___/|_| |_|\__,_|_| |_| |_|   \__,_|\___|_|\_\__,_|\__, |\___|   |_|\___/ \___/|_|___/  | |
                     \_\                                                           |___/                               /_/ 

Version: 0.30.4fatal: not a git repository (or any of the parent directories): .git

 >> Branch detected
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

[local_vars]
+---------------------------+---------------+
| Configuration             | value         |
|---------------------------+---------------|
| cwd                       | /home/conan   |
| username                  | Psy-Kai       |
| skip_check_credentials    | False         |
| upload_only_when_stable   | False         |
| upload_only_when_tag      | False         |
| upload_only_recipe        | False         |
| stable_channel            | stable        |
| partial_reference         | libpq/11.5    |
| channel                   | testing       |
| conanfile                 | conanfile.py  |
| use_docker                | False         |
| docker_conan_home         | /home/conan   |
| sudo_docker_command       | sudo -E       |
| sudo_pip_command          |               |
| pip_command               | pip           |
| docker_shell              | /bin/sh -c    |
| docker_platform_param     |               |
| lcow_user_workaround      |               |
| exclude_vcvars_precommand | False         |
| upload_dependencies       |               |
| update_dependencies       | False         |
| docker_32_images          | False         |
| force_selinux             | False         |
| conan_pip_package         | conan==1.21.0 |
| vs10_x86_64_enabled       | False         |
| builds_in_current_page    | []            |
| skip_recipe_export        | False         |
+---------------------------+---------------+

 >> Running builds...
fatal: not a git repository (or any of the parent directories): .git

[pip_update]
Page: 1/1
+-----+--------------------+------------+--------------+--------+----------------+
|   # |   compiler.version | compiler   | build_type   | arch   | libpq:shared   |
|-----+--------------------+------------+--------------+--------+----------------|
|   1 |                  8 | gcc        | Release      | x86    | True           |
|   2 |                  8 | gcc        | Debug        | x86    | True           |
|   3 |                  8 | gcc        | Release      | x86    | False          |
|   4 |                  8 | gcc        | Debug        | x86    | False          |
|   5 |                  8 | gcc        | Release      | x86_64 | True           |
|   6 |                  8 | gcc        | Debug        | x86_64 | True           |
|   7 |                  8 | gcc        | Release      | x86_64 | False          |
|   8 |                  8 | gcc        | Debug        | x86_64 | False          |
+-----+--------------------+------------+--------------+--------+----------------+


 >> Build: 1/8
CC and CXX: /usr/bin/gcc, /usr/bin/g++ 
Found gcc 8
gcc>=5, using the major as version

************************* WARNING: GCC OLD ABI COMPATIBILITY ***********************
 
Conan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to
'libstdc++' for backwards compatibility.
Your compiler is likely using the new CXX11 ABI by default (libstdc++11).

If you want Conan to use the new ABI for the default profile, run:

    $ conan profile update settings.compiler.libcxx=libstdc++11 default

Or edit '/home/conan/.conan/profiles/default' and set compiler.libcxx=libstdc++11

************************************************************************************



Profile created with detected settings: /home/conan/.conan/profiles/default

****************************************************************************************************
+--------------------+
| Profile            |
|--------------------|
| include(default)   |
|                    |
| [settings]         |
| arch=x86           |
| build_type=Release |
| compiler=gcc       |
| compiler.version=8 |
| [options]          |
| libpq:shared=True  |
| [env]              |
|                    |
| [build_requires]   |
+--------------------+

[conan_create]

 >> Calling 'conan create'
+-----------------+------------------------------------------------------+
| Configuration   | value                                                |
|-----------------+------------------------------------------------------|
| name            | libpq                                                |
| version         | 11.5                                                 |
| user            | Psy-Kai                                              |
| channel         | testing                                              |
| build_modes     |                                                      |
| profile_name    | /tmp/tmplw4vog7tconan_package_tools_profiles/profile |
+-----------------+------------------------------------------------------+
Exporting package recipe
libpq/11.5@Psy-Kai/testing exports: File 'conandata.yml' found. Exporting it...
libpq/11.5@Psy-Kai/testing exports: Copied 1 '.yml' file: conandata.yml
libpq/11.5@Psy-Kai/testing: A new conanfile.py version was exported
libpq/11.5@Psy-Kai/testing: Folder: /home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/export
libpq/11.5@Psy-Kai/testing: Exported revision: aea41c6956e53b4fce2775522019c575
Configuration:
[settings]
arch=x86
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=8
os=Linux
os_build=Linux
[options]
libpq:shared=True
[build_requires]
[env]

zlib/1.2.11: Not found in local cache, looking in remotes...
zlib/1.2.11: Trying with 'conan-center'...
Downloading conanmanifest.txt completed [0.29k]                                          
Downloading conanfile.py completed [7.55k]                                               
Downloading conan_export.tgz completed [0.23k]                                           
Decompressing conan_export.tgz completed [0.00k]                                         
zlib/1.2.11: Downloaded recipe revision 0
libpq/11.5@Psy-Kai/testing: Forced build from source
Installing package: libpq/11.5@Psy-Kai/testing
Requirements
    libpq/11.5@Psy-Kai/testing from local cache - Cache
    zlib/1.2.11 from 'conan-center' - Downloaded
Packages
    libpq/11.5@Psy-Kai/testing:410bb37ddabe63f8649ebe4bf96986a8331091ac - Build
    zlib/1.2.11:1abd7c1ee1c95ef7eb8701f64d57dee2fbf6def4 - Download

Cross-build from 'Linux:x86_64' to 'Linux:x86'
zlib/1.2.11: Retrieving package 1abd7c1ee1c95ef7eb8701f64d57dee2fbf6def4 from remote 'conan-center' 
Downloading conanmanifest.txt completed [0.25k]                                          
Downloading conaninfo.txt completed [0.41k]                                              
Downloading conan_package.tgz completed [92.15k]                                         
Decompressing conan_package.tgz completed [0.00k]                                        
zlib/1.2.11: Package installed 1abd7c1ee1c95ef7eb8701f64d57dee2fbf6def4
zlib/1.2.11: Downloaded package revision 0
libpq/11.5@Psy-Kai/testing: Configuring sources in /home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/source
Downloading postgresql-11.5.tar.gz completed [25332.63k]                                 

libpq/11.5@Psy-Kai/testing: Copying sources to build folder
libpq/11.5@Psy-Kai/testing: Building your package in /home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/build/410bb37ddabe63f8649ebe4bf96986a8331091ac
libpq/11.5@Psy-Kai/testing: Generator txt created conanbuildinfo.txt
libpq/11.5@Psy-Kai/testing: Calling build()
libpq/11.5@Psy-Kai/testing: Calling:
 > ./configure '--without-readline' '--with-zlib' '--without-openssl' '--prefix=/home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/package/410bb37ddabe63f8649ebe4bf96986a8331091ac' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-linux-gnu --host=x86-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86-unknown-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for x86-linux-gnu-gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/g++ accepts -g... yes
checking for gawk... no
checking for mawk... mawk
checking whether /usr/bin/gcc supports -Wdeclaration-after-statement, for CFLAGS... yes
checking whether /usr/bin/gcc supports -Wendif-labels, for CFLAGS... yes
checking whether /usr/bin/g++ supports -Wendif-labels, for CXXFLAGS... yes
checking whether /usr/bin/gcc supports -Wmissing-format-attribute, for CFLAGS... yes
checking whether /usr/bin/g++ supports -Wmissing-format-attribute, for CXXFLAGS... yes
checking whether /usr/bin/gcc supports -Wformat-security, for CFLAGS... yes
checking whether /usr/bin/g++ supports -Wformat-security, for CXXFLAGS... yes
checking whether /usr/bin/gcc supports -fno-strict-aliasing, for CFLAGS... yes
checking whether /usr/bin/g++ supports -fno-strict-aliasing, for CXXFLAGS... yes
checking whether /usr/bin/gcc supports -fwrapv, for CFLAGS... yes
checking whether /usr/bin/g++ supports -fwrapv, for CXXFLAGS... yes
checking whether /usr/bin/gcc supports -fexcess-precision=standard, for CFLAGS... yes
checking whether /usr/bin/g++ supports -fexcess-precision=standard, for CXXFLAGS... no
checking whether /usr/bin/gcc supports -funroll-loops, for CFLAGS_VECTOR... yes
checking whether /usr/bin/gcc supports -ftree-vectorize, for CFLAGS_VECTOR... yes
checking whether /usr/bin/gcc supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... no
checking whether /usr/bin/gcc supports -Wformat-truncation, for NOT_THE_CFLAGS... yes
checking whether /usr/bin/gcc supports -Wstringop-truncation, for NOT_THE_CFLAGS... yes
checking whether the C compiler still works... yes
checking how to run the C preprocessor... /usr/bin/gcc -E
checking allow thread-safe client libraries... yes
checking whether to build with ICU support... no
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with PAM support... no
checking whether to build with BSD Authentication support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with OpenSSL support... no
checking whether to build with SELinux support... no
checking whether to build with systemd support... no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for x86-linux-gnu-ranlib... no
checking for ranlib... ranlib
configure: WARNING: using cross tools not prefixed with host triplet
checking for x86-linux-gnu-strip... no
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for x86-linux-gnu-ar... no
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for tar... /bin/tar
checking whether ln -s works... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for bison... no
configure: WARNING:
*** Without Bison you will not be able to build PostgreSQL from Git nor
*** change any of the parser definition files.  You can obtain Bison from
*** a GNU mirror site.  (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)
checking for flex... no
configure: WARNING:
*** Without Flex you will not be able to build PostgreSQL from Git nor
*** change any of the scanner definition files.  You can obtain Flex from
*** a GNU mirror site.  (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)
checking for perl... /usr/bin/perl
configure: using perl 5.26.1
checking for zic... /usr/sbin/zic
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if compiler needs certain flags to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... yes
checking for getpwuid_r... yes
checking for gethostbyname_r... yes
checking whether strerror_r returns int... no
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlopen... -ldl
checking for library containing socket... none required
checking for library containing shl_load... no
checking for library containing getopt_long... none required
checking for library containing crypt... -lcrypt
checking for library containing shm_open... -lrt
checking for library containing shm_unlink... none required
checking for library containing clock_gettime... none required
checking for library containing fdatasync... none required
checking for library containing sched_yield... none required
checking for library containing gethostbyname_r... none required
checking for library containing shmget... none required
checking for inflate in -lz... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking crypt.h usability... yes
checking crypt.h presence... yes
checking for crypt.h... yes
checking dld.h usability... no
checking dld.h presence... no
checking for dld.h... no
checking fp_class.h usability... no
checking fp_class.h presence... no
checking for fp_class.h... no
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking mbarrier.h usability... no
checking mbarrier.h presence... no
checking for mbarrier.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/pstat.h usability... no
checking sys/pstat.h presence... no
checking for sys/pstat.h... no
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/sem.h usability... yes
checking sys/sem.h presence... yes
checking for sys/sem.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking sys/tas.h usability... no
checking sys/tas.h presence... no
checking for sys/tas.h... no
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking ucred.h usability... no
checking ucred.h presence... no
checking for ucred.h... no
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for net/if.h... yes
checking for sys/ucred.h... no
checking for netinet/tcp.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for printf format archetype... gnu_printf
checking for flexible array members... yes
checking for signed types... yes
checking for __func__... yes
checking for _Static_assert... yes
checking for typeof... typeof
checking for __builtin_types_compatible_p... yes
checking for __builtin_bswap16... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for __builtin_constant_p... yes
checking for __builtin_unreachable... yes
checking for computed goto support... yes
checking for __VA_ARGS__... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for tzname... yes
checking for union semun... no
checking for struct sockaddr_un... yes
checking for struct sockaddr_storage... yes
checking for struct sockaddr_storage.ss_family... yes
checking for struct sockaddr_storage.__ss_family... no
checking for struct sockaddr_storage.ss_len... no
checking for struct sockaddr_storage.__ss_len... no
checking for struct sockaddr.sa_len... no
checking for struct addrinfo... yes
checking for intptr_t... yes
checking for uintptr_t... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking for locale_t... yes
checking for C/C++ restrict keyword... __restrict
checking for struct cmsgcred... no
checking for struct option... yes
checking for z_streamp... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking size of off_t... 8
checking size of bool... 1
checking for int timezone... yes
checking types of arguments for accept()... int, int, struct sockaddr *, size_t *
checking whether gettimeofday takes only one argument... no
checking for wcstombs_l declaration... no
checking for cbrt... yes
checking for clock_gettime... yes
checking for dlopen... yes
checking for fdatasync... yes
checking for getifaddrs... yes
checking for getpeerucred... no
checking for getrlimit... yes
checking for mbstowcs_l... no
checking for memmove... yes
checking for poll... yes
checking for posix_fallocate... yes
checking for pstat... no
checking for pthread_is_threaded_np... no
checking for readlink... yes
checking for setproctitle... no
checking for setsid... yes
checking for shm_open... yes
checking for symlink... yes
checking for sync_file_range... yes
checking for uselocale... yes
checking for utime... yes
checking for utimes... yes
checking for wcstombs_l... no
checking for fseeko... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking how /usr/bin/gcc reports undeclared, standard C functions... error
checking for posix_fadvise... yes
checking whether posix_fadvise is declared... yes
checking whether fdatasync is declared... yes
checking whether strlcat is declared... no
checking whether strlcpy is declared... no
checking whether strnlen is declared... yes
checking whether F_FULLFSYNC is declared... no
checking for struct sockaddr_in6... yes
checking for PS_STRINGS... no
checking for snprintf... yes
checking for vsnprintf... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking for isinf... yes
checking for crypt... yes
checking for fls... no
checking for getopt... yes
checking for getrusage... yes
checking for inet_aton... yes
checking for mkdtemp... yes
checking for random... yes
checking for rint... yes
checking for srandom... yes
checking for strerror... yes
checking for strlcat... no
checking for strlcpy... no
checking for strnlen... yes
checking for unsetenv... yes
checking for getpeereid... no
checking for getaddrinfo... yes
checking for getopt_long... yes
checking whether sys_siglist is declared... yes
checking for syslog... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for opterr... yes
checking for optreset... no
checking for strtoll... yes
checking for strtoull... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking test program... cross-compiling
checking whether long int is 64 bits... no
checking whether long long int is 64 bits... yes
checking whether snprintf supports the %z modifier... cross
checking for __builtin_mul_overflow... yes
checking size of void *... 4
checking size of size_t... 4
checking size of long... 4
checking whether to build with float4 passed by value... yes
checking whether to build with float8 passed by value... no
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 4
checking alignment of long long int... 4
checking alignment of double... 4
checking for int8... no
checking for uint8... no
checking for int64... no
checking for uint64... no
checking for __int128... no
checking for builtin __sync char locking functions... yes
checking for builtin __sync int32 locking functions... yes
checking for builtin __sync int32 atomic operations... yes
checking for builtin __sync int64 atomic operations... yes
checking for builtin __atomic int32 atomic operations... yes
checking for builtin __atomic int64 atomic operations... yes
checking for __get_cpuid... yes
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 for library containing sem_init... -lpthread
checking which semaphore API to use... unnamed POSIX
checking for /dev/urandom... configure: error: cannot check for file existence when cross compiling
libpq/11.5@Psy-Kai/testing: 
libpq/11.5@Psy-Kai/testing: ERROR: Package '410bb37ddabe63f8649ebe4bf96986a8331091ac' build failed
libpq/11.5@Psy-Kai/testing: WARN: Build folder /home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/build/410bb37ddabe63f8649ebe4bf96986a8331091ac
Traceback (most recent call last):
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/errors.py", line 34, in conanfile_exception_formatter
    yield
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 123, in _build
    conanfile.build()
  File "/home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/export/conanfile.py", line 116, in build
    autotools = self._configure_autotools()
  File "/home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/export/conanfile.py", line 72, in _configure_autotools
    self._autotools.configure(args=args)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/build/autotools_environment.py", line 189, in configure
    self._conanfile.run(command, win_bash=self._win_bash, subsystem=self.subsystem)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/model/conan_file.py", line 262, in run
    raise ConanException("Error %d while executing %s" % (retcode, command))
conans.errors.ConanException: Error 1 while executing ./configure '--without-readline' '--with-zlib' '--without-openssl' '--prefix=/home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/package/410bb37ddabe63f8649ebe4bf96986a8331091ac' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-linux-gnu --host=x86-linux-gnu

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "build.py", line 7, in <module>
    builder.run()
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/cpt/packager.py", line 517, in run
    self.run_builds(base_profile_name=base_profile_name)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/cpt/packager.py", line 605, in run_builds
    r.run()
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/cpt/runner.py", line 122, in run
    update=self._update_dependencies)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/conan_api.py", line 81, in wrapper
    return f(api, *args, **kwargs)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/conan_api.py", line 364, in create
    test_build_folder, test_folder, conanfile_path, recorder=recorder)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/cmd/create.py", line 57, in create
    recorder=recorder)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/manager.py", line 68, in deps_install
    graph_info=graph_info)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 308, in install
    self._build(nodes_by_level, keep_build, root_node, graph_info, remotes, build_mode, update)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 332, in _build
    self._handle_node_cache(node, keep_build, processed_package_refs, remotes)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 398, in _handle_node_cache
    pref = self._build_package(node, output, keep_build, remotes)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 442, in _build_package
    pref = builder.build_package(node, keep_build, self._recorder, remotes)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 222, in build_package
    raise exc
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 208, in build_package
    self._build(conanfile, pref, build_folder)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 134, in _build
    raise exc
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/installer.py", line 123, in _build
    conanfile.build()
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/errors.py", line 40, in conanfile_exception_formatter
    raise ConanExceptionInUserConanfileMethod(msg)
conans.errors.ConanExceptionInUserConanfileMethod: libpq/11.5@Psy-Kai/testing: Error in build() method, line 116
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 72
        self._autotools.configure(args=args)
        ConanException: Error 1 while executing ./configure '--without-readline' '--with-zlib' '--without-openssl' '--prefix=/home/conan/.conan/data/libpq/11.5/Psy-Kai/testing/package/410bb37ddabe63f8649ebe4bf96986a8331091ac' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-linux-gnu --host=x86-linux-gnu
```

</details>



Discussion:
similar report: https://curl.haxx.se/mail/lib-2010-05/0174.html
for the record, issue appears here: https://github.com/postgres/postgres/blob/master/configure#L17858
possible fix (apply here: https://github.com/conan-io/conan-center-index/blob/master/recipes/libpq/all/conanfile.py#L64):
```
    if tools.cross_building(self.settings):
        args.append("ac_cv_file__dev_urandom=no")
```
@Psy-Kai could you test this locally?

I am able to build if I add
```
    if tools.cross_building(self.settings) and not self.options.with_openssl:
        args.append("--disable-strong-random")
```
Tested with and without openssl.
@Psy-Kai great, feel free to make pull request

Resolving patch:
diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py
--- a/recipes/libpq/all/conanfile.py
+++ b/recipes/libpq/all/conanfile.py
@@ -64,6 +64,8 @@ def _configure_autotools(self):
             args = ['--without-readline']
             args.append('--with-zlib' if self.options.with_zlib else '--without-zlib')
             args.append('--with-openssl' if self.options.with_openssl else '--without-openssl')
+            if tools.cross_building(self.settings) and not self.options.with_openssl:
+                args.append("--disable-strong-random")
             if self.settings.os != "Windows" and self.options.disable_rpath:
                 args.append('--disable-rpath')
             if self._is_clang8_x86:


Test patch: