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

Steve Lhomme robux4 at ycbcr.xyz
Tue May 12 17:07:51 CEST 2020


On 2020-05-12 17:02, Rémi Denis-Courmont wrote:
> 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.

Your "generally" is not mine. Nor the one of the bots that do all our 
builds.

>> 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.

We already do it in the contribs. It's also done to generate the MSI 
package. This is done every night in the nightlies with the same build 
system.

> Besides we already test for native builds.

Let me know where we test how to run "host" code.

> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list