[vlc-devel] [PATCH 1/7] configure: detect if we can run win32 executables

Rémi Denis-Courmont remi at remlab.net
Tue May 12 17:02:54 CEST 2020


Le tiistaina 12. toukokuuta 2020, 13.28.02 EEST Steve Lhomme a écrit :
> It is possible to run win32 executables when cross compiling with mingw64.

Generally no, and even then you're really not supposed to do that.

> It's even mandatory to build contribs as it needs to call fxc.exe
> (currently hardcoded to use wine).
> 
> Whether it's in WSL, msys2 or wine, we can run them.
> ---
>  configure.ac | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 4b13af45e46a..19e3f8aed7a9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -140,6 +140,7 @@ case "${host_cpu}" in
>          ;;
>  esac
> 
> +RUN_HOST_CMD=
>  case "${host_os}" in
>    "")
>      SYS=unknown
> @@ -1291,6 +1292,33 @@ if test "${ac_cv_c_attribute_packed}" != "no"; then
>    AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed))
> for structs) fi
> 
> +AS_IF([test "${SYS}" = "mingw32"], [
> +    dnl
> +    dnl Detect if we can call windows apps
> +    dnl
> +    AC_MSG_CHECKING([whether we can call win32 executables])
> +    AC_TRY_LINK([#include <stdio.h>], [char buf[100]; fgets(buf,
> sizeof(buf), stdin);], [ +      win32_run_cmd=no
> +      for run_win in "" "wine"
> +      do
> +        ac_try="$run_win ./conftest$ac_exeext"
> +        (eval "$ac_try") 2>&5
> +        ac_status=$?
> +        if test $ac_status = 0; then
> +          win32_run_cmd=$run_win
> +          break
> +        fi
> +      done
> +      AS_IF([test "x${win32_run_cmd}" != "xno"],[
> +        HAVE_RUN_HOST="1"
> +        RUN_HOST_CMD=${win32_run_cmd}
> +        AC_MSG_RESULT([using '${win32_run_cmd} app.exe'])
> +      ],[
> +        AC_MSG_RESULT([not found])
> +      ])
> +    ])
> +])
> +

Running WINE in the build system is a very bad idea as it depends on the 
display server. And running executables is a bad idea of its own as the 
failure modes may be very weird, e.g. spawning the GUI crash handlers.

Besides we already test for native builds.

-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list