Attempting to build perl on mingw fails horribly with:

libtool: compile:  i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. 
-I../../../plugins/perl -I../.. -I../../../include -I../../include 
-I../../../common/include -I../../../common/utils -D_REENTRANT -D_GNU_SOURCE 
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe 
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv 
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/lib64/perl5/CORE -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -MT 
nbdkit_perl_plugin_la-perl.lo -MD -MP -MF .deps/nbdkit_perl_plugin_la-perl.Tpo 
-c ../../../plugins/perl/perl.c  -DDLL_EXPORT -DPIC -o 
.libs/nbdkit_perl_plugin_la-perl.o
Assembler messages:
Fatal error: no compiled in support for x86_64
cc1: error: plugin support is disabled; configure with --enable-plugin
cc1: sorry, unimplemented: 64-bit mode not compiled in

Let's catch this at configure time, at which point we no longer need
to explicitly enable/disable perl at CI time (although we still want
to force --enable-perl on at least some of our other containers).
---
 configure.ac         | 13 ++++++++++++-
 ci/build.sh          |  6 +++++-
 ci/gitlab/builds.yml |  8 ++++----
 ci/manifest.yml      |  6 ++++--
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9541b591..97a23b2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -806,7 +806,18 @@ AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != 
"xno"],[
     PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')"
     AC_MSG_RESULT([$PERL_LDOPTS])

-    dnl XXX Could check these actually work.
+    dnl Check these actually work.
+    AC_MSG_CHECKING([whether Perl modules will compile])
+    old_CFLAGS="$CFLAGS"
+    old_LIBS="$LIBS"
+    CFLAGS="$PERL_CFLAGS -I$PERL_ARCHLIB/CORE $CFLAGS"
+    LIBS="$PERL_LDOPTS $LIBS"
+    AC_CHECK_FUNCS([perl_alloc])
+    CFLAGS="$old_CFLAGS"
+    LIBS="$old_LIBS"
+    if test "x$ac_cv_func_perl_alloc" != xyes; then
+      enable_perl=no
+    fi
 ])
 AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != 
"xno"])
 AC_SUBST([PERL_ARCHLIB])
diff --git a/ci/build.sh b/ci/build.sh
index 241d0ef5..0eb07e93 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -70,6 +70,10 @@ main() {

     autoreconf -if

+    # These are options we want in all CI builds (if the container can't
+    # build it, we want an error). Options not mentioned here default to
+    # being auto-detected by the container, but can have explicit
+    # overrides below.
     CONFIG_ARGS="\
 --disable-libguestfs-tests
 --enable-gcc-warnings \
@@ -99,7 +103,7 @@ main() {
     if test "$PERL" = "skip"
     then
         CONFIG_ARGS="$CONFIG_ARGS --disable-perl"
-    else
+    elif test "$PERL" = "force"
         CONFIG_ARGS="$CONFIG_ARGS --enable-perl"
     fi

diff --git a/ci/gitlab/builds.yml b/ci/gitlab/builds.yml
index d0bc2653..185a1d83 100644
--- a/ci/gitlab/builds.yml
+++ b/ci/gitlab/builds.yml
@@ -169,6 +169,7 @@ x86_64-fedora-35-prebuilt-env:
   allow_failure: false
   variables:
     NAME: fedora-35
+    PERL: force

 x86_64-fedora-35-local-env:
   extends: .native_build_job_local_env
@@ -177,6 +178,7 @@ x86_64-fedora-35-local-env:
   variables:
     IMAGE: registry.fedoraproject.org/fedora:35
     NAME: fedora-35
+    PERL: force


 x86_64-fedora-rawhide-prebuilt-env:
@@ -187,6 +189,7 @@ x86_64-fedora-rawhide-prebuilt-env:
   allow_failure: false
   variables:
     NAME: fedora-rawhide
+    PERL: force

 x86_64-fedora-rawhide-local-env:
   extends: .native_build_job_local_env
@@ -195,6 +198,7 @@ x86_64-fedora-rawhide-local-env:
   variables:
     IMAGE: registry.fedoraproject.org/fedora:rawhide
     NAME: fedora-rawhide
+    PERL: force


 x86_64-fedora-rawhide-clang-prebuilt-env:
@@ -304,7 +308,6 @@ mingw32-fedora-35-prebuilt-env:
     CROSS: mingw32
     GOLANG: skip
     NAME: fedora-35
-    PERL: skip
     RUST: skip

 mingw32-fedora-35-local-env:
@@ -316,7 +319,6 @@ mingw32-fedora-35-local-env:
     GOLANG: skip
     IMAGE: registry.fedoraproject.org/fedora:35
     NAME: fedora-35
-    PERL: skip
     RUST: skip


@@ -330,7 +332,6 @@ mingw64-fedora-35-prebuilt-env:
     CROSS: mingw64
     GOLANG: skip
     NAME: fedora-35
-    PERL: skip
     RUST: skip

 mingw64-fedora-35-local-env:
@@ -342,7 +343,6 @@ mingw64-fedora-35-local-env:
     GOLANG: skip
     IMAGE: registry.fedoraproject.org/fedora:35
     NAME: fedora-35
-    PERL: skip
     RUST: skip


diff --git a/ci/manifest.yml b/ci/manifest.yml
index 6ef9f576..3de6b608 100644
--- a/ci/manifest.yml
+++ b/ci/manifest.yml
@@ -50,22 +50,24 @@ targets:
   fedora-35:
     jobs:
       - arch: x86_64
+        variables:
+          PERL: force

       - arch: mingw32
         variables:
-          PERL: skip
           RUST: skip
           GOLANG: skip

       - arch: mingw64
         variables:
-          PERL: skip
           RUST: skip
           GOLANG: skip

   fedora-rawhide:
     jobs:
       - arch: x86_64
+        variables:
+          PERL: force

       - arch: x86_64
         suffix: -clang
-- 
2.37.3

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to