Source: screen
Version: 4.9.1-1
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

Hi,

screen fails to cross build from source:

| mips64el-linux-gnuabi64-gcc -c -I. -I..  -Wdate-time -D_FORTIFY_SOURCE=2 
-DETCSCREENRC='"/etc/screenrc"' 
-DSCREENENCODINGS='"/usr/share/screen/utf8encodings"' -DHAVE_CONFIG_H 
-DGIT_REV=\"\" \
|      -g -O2 -Werror=implicit-function-declaration 
-ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat 
-Werror=format-security -Wall -Wextra -Wno-unused-parameter 
-Wno-missing-field-initializers -D_GNU_SOURCE ../pty.c
| ../pty.c: In function ‘OpenPTY’:
| ../pty.c:338:7: error: implicit declaration of function ‘openpty’; did you 
mean ‘OpenPTY’? [-Werror=implicit-function-declaration]
|   338 |   if (openpty(&f, &s, TtyName, NULL, NULL) != 0)
|       |       ^~~~~~~
|       |       OpenPTY

The real cause here is that screen exercises a non-standard code path
due to configure time misdetection. It skips the SVR4 /dev/ptmx check in
cross compilation and directly falls back to openpty, which apparently
no longer works.

The "test -c /dev/ptmx" is conditionalized to not being performed during
cross compilation and doing it there would be confusing build and host.
However, AC_CHECK_FILE exists for this very purpose. During native
compilation, it becomes a simple test and during cross compilation it
becomes a hard failure where a user must supply the check result. Then
also supplying the result makes screen cross buildable again. I'm
attaching a patch for your convenience.

Note that with this patch applied, crossqa.debian.net will always
report screen as failed, because it does not supply this check result.
If you want to do this explicitly, you may add the following snippet to
d/rules:

    ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
    ifeq ($(DEB_HOST_ARCH_OS),linux)
    export ac_cv_file__dev_ptmx = yes
    endif
    endif

Or you may leave this to the builder at your choice, but there is no
sane way to detect this during build.

Helmut
--- screen-4.9.1.orig/configure.ac
+++ screen-4.9.1/configure.ac
@@ -756,10 +756,10 @@
 fi
 fi
 
-if test "$cross_compiling" = no ; then
+AC_CHECK_FILE([/dev/ptmx])
 AC_CHECKING(for SVR4 ptys)
 sysvr4ptys=
-if test -c /dev/ptmx ; then
+if test "x$ac_cv_file__dev_ptmx" = xyes ; then
 AC_TRY_LINK([
     #include <stdlib.h>
 ], [
@@ -767,7 +767,6 @@
 ],[AC_DEFINE(HAVE_SVR4_PTYS)
 sysvr4ptys=1])
 fi
-fi
 
 AC_CHECK_FUNCS(getpt)
 

Reply via email to