Repository: conan-io/conan-center-index

Issue:
[package] libx264/20191217: Build failed on Windows x86
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **libx264/20191217**
  * Operating System+version: **Windows 10 x86**
  * Compiler+version: **MSVC 2017**
  * Conan version: **conan 1.30.2**
  * Python version: **Python 3.8.5**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
os=Windows
os_build=Windows
arch=x86
arch_build=x86_64
compiler=Visual Studio
compiler.version=15
build_type=Release
[options]
[build_requires]
[env]

```


### Steps to reproduce (Include if Applicable)
conan install libx264/20191217@ --profile default_x86 --build missing


### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
conan install libx264/20191217@ --profile default_x86 --build missing
Configuration:
[settings]
arch=x86
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Installing package: libx264/20191217
Requirements
    libx264/20191217 from 'CENTER' - Cache
Packages
    libx264/20191217:19957240422ee89c99e438edcf1b694bdedd61da - Build
Build requirements
    msys2/20190524 from 'CENTER' - Cache
    nasm/2.13.02 from 'CENTER' - Cache
Build requirements packages
    msys2/20190524:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache
    nasm/2.13.02:456f15897172eef340fcbac8a70811f2beb26a93 - Cache

Cross-build from 'Windows:x86_64' to 'Windows:x86'
Installing (downloading, building) binaries...
msys2/20190524: Already installed!
msys2/20190524: Creating MSYS_ROOT env var : C:\.conan\216d45\1\bin
msys2/20190524: Creating MSYS_BIN env var : C:\.conan\216d45\1\bin\usr\bin
msys2/20190524: Appending PATH env var with : C:\.conan\216d45\1\bin\usr\bin
nasm/2.13.02: Already installed!
nasm/2.13.02: Appending PATH environment variable: C:\Users\Nico\.conan\data\nasm\2.13.02\_\_\package\456f15897172eef340fcbac8a70811f2beb26a93\bin
libx264/20191217: Applying build-requirement: nasm/2.13.02
libx264/20191217: Applying build-requirement: msys2/20190524
libx264/20191217: WARN: Build folder is dirty, removing it: C:\Users\Nico\.conan\data\libx264\20191217\_\_\build\19957240422ee89c99e438edcf1b694bdedd61da
libx264/20191217: Copying sources to build folder
libx264/20191217: Building your package in C:\Users\Nico\.conan\data\libx264\20191217\_\_\build\19957240422ee89c99e438edcf1b694bdedd61da
libx264/20191217: Generator txt created conanbuildinfo.txt
libx264/20191217: Calling build()
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.28
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
libx264/20191217: run_in_windows_bash: C:\.conan\216d45\1\bin\usr\bin\bash.exe --login -c ^"cd \^"/c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da\^" ^&^& PATH=\^"/c/users/nico/.conan/data/nasm/2.13.02/_/_/package/456f15897172eef340fcbac8a70811f2beb26a93/bin:/c/.conan/216d45/1/bin/usr/bin:$PATH\^" ^&^& /c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da/source_subfolder/configure --help ^"
Usage: ./configure [options]

Help:
  -h, --help               print this message

Standard options:
  --prefix=PREFIX          install architecture-independent files in PREFIX
                           [/usr/local]
  --exec-prefix=EPREFIX    install architecture-dependent files in EPREFIX
                           [PREFIX]
  --bindir=DIR             install binaries in DIR [EPREFIX/bin]
  --libdir=DIR             install libs in DIR [EPREFIX/lib]
  --includedir=DIR         install includes in DIR [PREFIX/include]
  --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS
  --extra-rcflags=ERCFLAGS add ERCFLAGS to RCFLAGS

Configuration options:
  --disable-cli            disable cli
  --system-libx264         use system libx264 instead of internal
  --enable-shared          build shared library
  --enable-static          build static library
  --disable-opencl         disable OpenCL features
  --disable-gpl            disable GPL-only features
  --disable-thread         disable multithreaded encoding
  --disable-win32thread    disable win32threads (windows only)
  --disable-interlaced     disable interlaced encoding support
  --bit-depth=BIT_DEPTH    set output bit depth (8, 10, all) [all]
  --chroma-format=FORMAT   output chroma format (400, 420, 422, 444, all) [all]

Advanced options:
  --disable-asm            disable platform-specific assembly optimizations
  --enable-lto             enable link-time optimization
  --enable-debug           add -g
  --enable-gprof           add -pg
  --enable-strip           add -s
  --enable-pic             build position-independent code

Cross-compilation:
  --host=HOST              build programs to run on HOST
  --cross-prefix=PREFIX    use PREFIX for compilation tools
  --sysroot=SYSROOT        root of cross-build tree

External library support:
  --disable-avs            disable avisynth support
  --disable-swscale        disable swscale support
  --disable-lavf           disable libavformat support
  --disable-ffms           disable ffmpegsource support
  --disable-gpac           disable gpac support
  --disable-lsmash         disable lsmash support

libx264/20191217: WARN: Error running `configure --help`: Error 1 while executing /c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da/source_subfolder/configure --help
libx264/20191217: Calling:
 > /c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da/source_subfolder/configure --disable-cli --prefix=/c/users/nico/.conan/data/libx264/20191217/_/_/package/19957240422ee89c99e438edcf1b694bdedd61da --enable-static --bit-depth=all --host=i686-windows-msvc
libx264/20191217: run_in_windows_bash: C:\.conan\216d45\1\bin\usr\bin\bash.exe --login -c ^"cd \^"/c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da\^" ^&^& PATH=\^"/c/users/nico/.conan/data/nasm/2.13.02/_/_/package/456f15897172eef340fcbac8a70811f2beb26a93/bin:/c/.conan/216d45/1/bin/usr/bin:$PATH\^" ^&^& /c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da/source_subfolder/configure --disable-cli --prefix=/c/users/nico/.conan/data/libx264/20191217/_/_/package/19957240422ee89c99e438edcf1b694bdedd61da --enable-static --bit-depth=all --host=i686-windows-msvc ^"
Invalid configuration `i686-windows-msvc': system `msvc' not recognized
Unknown system , edit the configure
libx264/20191217:
libx264/20191217: ERROR: Package '19957240422ee89c99e438edcf1b694bdedd61da' build failed
libx264/20191217: WARN: Build folder C:\Users\Nico\.conan\data\libx264\20191217\_\_\build\19957240422ee89c99e438edcf1b694bdedd61da
ERROR: libx264/20191217: Error in build() method, line 97
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 92
        self._autotools.configure(args=args, build=False, vars=self._override_env, configure_dir=self._source_subfolder)
        ConanException: Error 1 while executing /c/users/nico/.conan/data/libx264/20191217/_/_/build/19957240422ee89c99e438edcf1b694bdedd61da/source_subfolder/configure --disable-cli --prefix=/c/users/nico/.conan/data/libx264/20191217/_/_/package/19957240422ee89c99e438edcf1b694bdedd61da --enable-static --bit-depth=all --host=i686-windows-msvc
```

</details>



Discussion:
Autotools does not recognize the canonical names of MSVC.
Can you try applying the changes from https://github.com/conan-io/conan-center-index/pull/2250, but on libx264?
OK thanks for the info. Yes it works well with these changes !
If you want to, you can open a pull request.

Resolving patch:
diff --git a/recipes/libx264/all/conanfile.py b/recipes/libx264/all/conanfile.py
--- a/recipes/libx264/all/conanfile.py
+++ b/recipes/libx264/all/conanfile.py
@@ -89,7 +89,14 @@ def _configure_autotools(self):
             if tools.is_apple_os(self.settings.os) and self.settings.get_safe("os.version"):
                 self._autotools.flags.append(tools.apple_deployment_target_flag(self.settings.os,
                                                                                 self.settings.os.version))
-            self._autotools.configure(args=args, build=False, vars=self._override_env, configure_dir=self._source_subfolder)
+            build_canonical_name = None
+            host_canonical_name = None
+            if self.settings.compiler == "Visual Studio":
+                # autotools does not know about the msvc canonical name(s)
+                build_canonical_name = False
+                host_canonical_name = False
+            self._autotools.configure(args=args, vars=self._override_env, configure_dir=self._source_subfolder, build=build_canonical_name, host=host_canonical_name)
+
         return self._autotools
 
     def build(self):


Test patch: