conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
970 stars 1.78k forks source link

[package] xz_utils/5.4.4: build fails when using tools.microsoft.bash:subsystem=msys2 #20398

Open jwatson0 opened 1 year ago

jwatson0 commented 1 year ago

Description

When using a profile that includes:

[conf]                                                                                                                                                                                                              
tools.microsoft.bash:subsystem=msys2                                                                                                                                                                                
tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe                                                                                                                                                                

the xz_utils build fails with:

make: *** No rule to make target '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utce0acd9bceccd/b/src/Makefile.am', needed by '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utce0acd9bceccd/b/src/Makefile.in'.  Stop.                                                                                                                                                                                                   

Removing the tools.microsoft.bash lines from the profile allows this dependency build to succeed, but I need the bash settings for the main build.

Furthermore, attempting to unset the settings specific to xz_utils like this:

[conf]                                                                                                                                                                                                             
tools.microsoft.bash:subsystem=msys2                                                                                                                                                                               
tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe                                                                                                                                                               
xz_utils/*:tools.microsoft.bash:subsystem=!                                                                                                                                                                        
xz_utils/*:tools.microsoft.bash:path=!                                                                                                                                                                             

results in:

xz_utils/5.4.4: Generators folder: C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_ut91fdb0b70bf4a/b/build-release/conan                                                                                       
ERROR: xz_utils/5.4.4: Error in generate() method, line 86                                                                                                                                                          
        env.generate()                                                                                                                                                                                              
        ConanException: win_bash=True but tools.microsoft.bash:subsystem configuration not defined                                                                                                                  

Package and Environment Details

Conan profile

Host and build profiles are the same, except for [tool_requires] mingw-builds/11.2.0 on the host.

Host profile:                                                                                                                                                                                                       
[settings]                                                                                                                                                                                                          
arch=x86_64                                                                                                                                                                                                         
build_type=Release                                                                                                                                                                                                  
compiler=gcc                                                                                                                                                                                                        
compiler.cppstd=gnu11                                                                                                                                                                                               
compiler.exception=seh                                                                                                                                                                                              
compiler.libcxx=libstdc++11                                                                                                                                                                                         
compiler.threads=posix                                                                                                                                                                                              
compiler.version=11.2                                                                                                                                                                                               
os=Windows                                                                                                                                                                                                          
[tool_requires]                                                                                                                                                                                                     
*: mingw-builds/11.2.0                                                                                                                                                                                              
[conf]                                                                                                                                                                                                              
tools.microsoft.bash:subsystem=msys2                                                                                                                                                                                
tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe                                                                                                                                                                

Build profile:                                                                                                                                                                                                      
[settings]                                                                                                                                                                                                          
arch=x86_64                                                                                                                                                                                                         
build_type=Release                                                                                                                                                                                                  
compiler=gcc                                                                                                                                                                                                        
compiler.cppstd=gnu11                                                                                                                                                                                               
compiler.exception=seh                                                                                                                                                                                              
compiler.libcxx=libstdc++11                                                                                                                                                                                         
compiler.threads=posix                                                                                                                                                                                              
compiler.version=11.2                                                                                                                                                                                               
os=Windows                                                                                                                                                                                                          
[conf]                                                                                                                                                                                                              
tools.microsoft.bash:subsystem=msys2                                                                                                                                                                                
tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe                                                                                                                                                                

Steps to reproduce

conanfile.py:

from conan import ConanFile                                                                                                                                                                                         

class mingwxzutils(ConanFile):                                                                                                                                                                                      
    settings = "os", "arch", "compiler", "build_type"                                                                                                                                                               

    requires = "xz_utils/5.4.4"                                                                                                                                                                                                                                                                                                                                                                                                         

execute:

conan install . -pr:b windows-x86_64-default -pr:h windows-x86_64-gcc-11.2 --output-folder build --build 'xz_utils/5.4.4'

Failure summary:

...
config.status: creating po/Makefile                                                                                                                                                                                 

xz_utils/5.4.4: RUN: make -j4                                                                                                                                                                                       
make: *** No rule to make target '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utce0acd9bceccd/b/src/Makefile.am', needed by '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utce0acd9bceccd/b/src/Mak
efile.in'.  Stop.                                                                                                                                                                                                   

xz_utils/5.4.4: ERROR:                                                                                                                                                                                              
Package 'b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89' build failed                                                                                                                                                     

Logs

Click to expand log ``` # conan install . -pr:b windows-x86_64-default -pr:h windows-x86_64-gcc-11.2 --output-folder build --build 'xz_utils/5.4.4' ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu11 compiler.exception=seh compiler.libcxx=libstdc++11 compiler.threads=posix compiler.version=11.2 os=Windows [tool_requires] *: mingw-builds/11.2.0 [conf] tools.microsoft.bash:subsystem=msys2 tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe Profile build: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu11 compiler.exception=seh compiler.libcxx=libstdc++11 compiler.threads=posix compiler.version=11.2 os=Windows [conf] tools.microsoft.bash:subsystem=msys2 tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe ======== Computing dependency graph ======== Graph root conanfile.py: C:/Users/Administrator/mingw-xz_utils/conanfile.py Requirements xz_utils/5.4.4#f7cff24c0eadb6e51001dd86695e823d - Cache Build requirements 7zip/19.00#0aaab2a97444de6ab6828d3e4aa63151 - Cache lzma_sdk/9.20#f1fe20056422603432563a07b25f2ee3 - Cache make/4.3#f3747ef6e47bbd049f9f3f14a9e1d8ba - Cache mingw-builds/11.2.0#f826740f012267e6f1770bf717294607 - Cache ======== Computing necessary packages ======== xz_utils/5.4.4: Forced build from source Requirements xz_utils/5.4.4#f7cff24c0eadb6e51001dd86695e823d:b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89 - Build Build requirements mingw-builds/11.2.0#f826740f012267e6f1770bf717294607:f4943bfd33cc2961ebbb1d81bf8b090153522e1f#394f81d79847375cedbfa6f06baddba3 - Cache Skipped binaries 7zip/19.00, lzma_sdk/9.20, make/4.3 ======== Installing packages ======== mingw-builds/11.2.0: Already installed! (1 of 2) -------- Installing package xz_utils/5.4.4 (2 of 2) -------- xz_utils/5.4.4: Building from source xz_utils/5.4.4: Package xz_utils/5.4.4:b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89 xz_utils/5.4.4: Copying sources to build folder xz_utils/5.4.4: Building your package in C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b xz_utils/5.4.4: Calling generate() xz_utils/5.4.4: Generators folder: C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/build-release/conan xz_utils/5.4.4: Generating aggregated env files xz_utils/5.4.4: Generated aggregated env files: ['conanbuild.sh', 'conanrun.bat'] xz_utils/5.4.4: Calling build() xz_utils/5.4.4: apply_conandata_patches(): No patches defined in conandata xz_utils/5.4.4: Calling: > "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includ edir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc xz_utils/5.4.4: RUN: "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${pr efix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc configure: loading site script /etc/config.site XZ Utils 5.4.4 System type: checking build system type... x86_64-w64-mingw32 checking host system type... x86_64-w64-mingw32 Configure options: checking if debugging code should be compiled... no checking which encoders to build... lzma1 lzma2 delta x86 powerpc ia64 arm armthumb arm64 sparc checking which decoders to build... lzma1 lzma2 delta x86 powerpc ia64 arm armthumb arm64 sparc checking which match finders to build... hc3 hc4 bt2 bt3 bt4 checking which integrity checks to build... crc32 crc64 sha256 checking if external SHA-256 should be used... no checking if MicroLZMA support should be built... yes checking if .lz (lzip) decompression support should be built... yes checking if assembler optimizations should be used... no checking if small size is preferred over speed... no checking if threading support is wanted... yes, vista checking how much RAM to assume if the real amount is unknown... 128 MiB checking if sandboxing should be used... maybe (autodetect) checking for a shell that conforms to POSIX... /bin/sh Initializing Automake: checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-free mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether ln -s works... no, using cp -pR checking whether make supports the include directive... yes (GNU style) checking for gcc... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -g... yes checking for C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe option to enable C11 features... none needed checking whether C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe understands -c and -o together... yes checking dependency style of C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe... gcc3 checking dependency style of C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe... gcc3 checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for wchar.h... yes checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking whether _XOPEN_SOURCE should be defined... no checking for a sed that does not truncate output... /usr/bin/sed checking how to run the C preprocessor... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe options needed to detect all undeclared functions... none needed Initializing Libtool: checking how to print strings... printf checking for a sed that does not truncate output... (cached) /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe checking if the linker (C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/nm.exe checking the name lister (C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/nm.exe) interface... BSD nm checking the maximum length of command line arguments... 8192 checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32 checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32 checking for C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe option to reload object files... -r checking for file... file checking for objdump... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/objdump.exe checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL checking for dlltool... dlltool checking how to associate runtime and link libraries... func_cygming_dll_for_implib checking for archiver @FILE support... @ checking for strip... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/strip.exe checking for ranlib... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ranlib.exe checking command to parse C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/nm.exe output from C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... no checking if : is a manifest tool... no checking for dlfcn.h... no checking for as... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/as.exe checking for dlltool... (cached) dlltool checking for objdump... (cached) C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/objdump.exe checking for objdir... .libs checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe supports -fno-rtti -fno-exceptions... no checking for C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe option to produce PIC... -DDLL_EXPORT -DPIC checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe PIC flag -DDLL_EXPORT -DPIC works... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe static flag -static works... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe supports -c -o file.o... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe supports -c -o file.o... (cached) yes checking whether the C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe linker (C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe) supports shared libra ries... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... no checking whether to build static libraries... yes checking for windres... windres checking if library symbol versioning should be used... no Initializing gettext: checking whether NLS is requested... yes checking for msgfmt... /mingw64/bin/msgfmt checking for gmsgfmt... /mingw64/bin/msgfmt checking for xgettext... /mingw64/bin/xgettext checking for msgmerge... /mingw64/bin/msgmerge checking for ld... C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe checking if the linker (C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/ld.exe) is GNU ld... yes checking for shared library run path origin... done checking 32-bit host C ABI... no checking for ELF binary format... no checking for the common suffixes of directories in the library search path... lib,lib,lib checking for CFPreferencesCopyAppValue... no checking for CFLocaleCopyPreferredLanguages... no checking for GNU gettext in libc... no checking for iconv... yes checking for working iconv... yes checking for GNU gettext in libintl... no checking whether to use NLS... no System headers and functions: checking for fcntl.h... yes checking for limits.h... yes checking for sys/time.h... yes checking for immintrin.h... yes checking for cpuid.h... yes checking for _Bool... yes checking for stdbool.h that conforms to C99... yes checking for uint8_t... yes checking for uint16_t... yes checking for int32_t... yes checking for uint32_t... yes checking for int64_t... yes checking for uint64_t... yes checking for uintptr_t... yes checking size of size_t... 8 checking for struct stat.st_atim.tv_nsec... no checking for struct stat.st_atimespec.tv_nsec... no checking for struct stat.st_atimensec... no checking for struct stat.st_uatime... no checking for struct stat.st_atim.st__tim.tv_nsec... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking whether byte ordering is bigendian... no checking if __attribute__((__constructor__)) can be used... yes checking for getopt.h... yes checking for getopt_long... yes checking whether optreset is declared... no checking for futimens... no checking for futimes... no checking for futimesat... no checking for utimes... no checking for _futime... yes checking for posix_fadvise... no checking whether program_invocation_name is declared... no checking if __builtin_bswap16/32/64 are supported... yes checking if unaligned memory access should be used... yes checking if unsafe type punning should be used... no checking if __builtin_assume_aligned is supported... yes checking for sys/param.h... yes checking how to detect the amount of physical memory... special checking for sys/param.h... (cached) yes checking how to detect the number of available CPU cores... special checking whether mbrtowc and mbstate_t are properly declared... yes checking for wcwidth... no checking whether _mm_movemask_epi8 is declared... yes checking if _mm_clmulepi64_si128 is usable... yes checking for sys/capsicum.h... no checking whether cap_rights_limit is declared... no checking for pledge... no GCC extensions: checking whether the -Werror option is usable... yes checking for simple visibility declarations... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wall... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wextra... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wvla... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wc99-c11-compat... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wformat=2... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Winit-self... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wmissing-include-dirs... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wshift-overflow=2... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wstrict-overflow=3... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Walloc-zero... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wduplicated-cond... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wfloat-equal... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wundef... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wshadow... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wpointer-arith... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wbad-function-cast... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wwrite-strings... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wdate-time... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wsign-conversion... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wfloat-conversion... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wlogical-op... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Waggregate-return... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wstrict-prototypes... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wold-style-definition... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wmissing-prototypes... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wmissing-declarations... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wredundant-decls... yes checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wc99-compat... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wc11-extensions... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wc2x-compat... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wc2x-extensions... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wpre-c2x-compat... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Warray-bounds-pointer-arithmetic... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wassign-enum... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wconditional-uninitialized... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wdocumentation... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wduplicate-enum... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wempty-translation-unit... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wflexible-array-extensions... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wmissing-variable-declarations... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wnewline-eof... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wshift-sign-overflow... no checking if C:/Users/Administrator/mingw-xz_utils/.conan2/p/mingw79a0507ea39c7/p/bin/gcc.exe accepts -Wstring-conversion... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating po/Makefile.in config.status: creating lib/Makefile config.status: creating src/Makefile config.status: creating src/liblzma/Makefile config.status: creating src/liblzma/api/Makefile config.status: creating src/xz/Makefile config.status: creating src/xzdec/Makefile config.status: creating src/lzmainfo/Makefile config.status: creating src/scripts/Makefile config.status: creating tests/Makefile config.status: creating debug/Makefile config.status: creating src/scripts/xzdiff config.status: creating src/scripts/xzgrep config.status: creating src/scripts/xzmore config.status: creating src/scripts/xzless config.status: creating config.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing po-directories commands config.status: creating po/POTFILES config.status: creating po/Makefile xz_utils/5.4.4: RUN: make -j4 make: *** No rule to make target '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/src/Makefile.am', needed by '/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/src/Mak efile.in'. Stop. xz_utils/5.4.4: ERROR: Package 'b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89' build failed xz_utils/5.4.4: WARN: Build folder C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_utf24f2b19ee812/b/build-release ********************************************************* Recipe 'xz_utils/5.4.4' cannot build its binary It is possible that this recipe is not Conan 2.0 ready If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues If it is your recipe, check if it is updated to 2.0 ********************************************************* ERROR: xz_utils/5.4.4: Error in build() method, line 141 autotools.make() ConanException: Error 2 while executing ```
jwatson0 commented 1 year ago

Possibly related autotools and msys issues? https://github.com/conan-io/conan/issues/8476

SpaceIm commented 1 year ago

In which terminal do you run conan command? cmd? powershell? msys2?

If your terminal is msys2 or any bash terminal, you must add tools.microsoft.bash:active=True to your profile.

jwatson0 commented 1 year ago

Thanks, I hadn't seen that setting before. Yes I am using bash from msys2 with the env var MSYSTEM=MINGW64 set. I'll give that setting a try.

jwatson0 commented 1 year ago

Another possibly related: https://github.com/conan-io/conan-center-index/issues/20166

jwatson0 commented 1 year ago

Ok, when setting tools.microsoft.bash:active=True, I get a different error:

xz_utils/5.4.4:` Calling: > "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_ut8eae3c946c5a7/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc
xz_utils/5.4.4: RUN: "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_ut8eae3c946c5a7/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc
'.' is not recognized as an internal or external command, operable program or batch file.
Click to expand log ``` administrator@EC2AMAZ-XXXXXXX C:\Users\Administrator> C:\msys64\usr\bin\bash.exe Administrator@EC2AMAZ-XXXXXXX ~ # cd mingw-xz_utils/ Administrator@EC2AMAZ-XXXXXXX ~/mingw-xz_utils # export CONAN_HOME=$PWD/.conan2 Administrator@EC2AMAZ-XXXXXXX ~/mingw-xz_utils # source venv/bin/activate (venv) Administrator@EC2AMAZ-XXXXXXX ~/mingw-xz_utils # export MSYSTEM=MINGW64 (venv) Administrator@EC2AMAZ-HT71HOI MINGW64 ~/mingw-xz_utils # conan version version: 2.0.13 python version: 3.11.4 sys_version: 3.11.4 (main, Aug 7 2023, 17:01:05) [GCC 13.2.0 64 bit (AMD64)] (venv) Administrator@EC2AMAZ-XXXXXXX MINGW64 ~/mingw-xz_utils # conan install . -pr:b windows-x86_64-default -pr:h windows-x86_64-gcc-11.2 --output-folder build --build 'xz_utils/5.4.4' ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu11 compiler.exception=seh compiler.libcxx=libstdc++11 compiler.threads=posix compiler.version=11.2 os=Windows [tool_requires] *: mingw-builds/11.2.0 [conf] tools.microsoft.bash:active=True tools.microsoft.bash:subsystem=msys2 tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe Profile build: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu11 compiler.exception=seh compiler.libcxx=libstdc++11 compiler.threads=posix compiler.version=11.2 os=Windows [conf] tools.microsoft.bash:active=True tools.microsoft.bash:subsystem=msys2 tools.microsoft.bash:path=C:\msys64\usr\bin\bash.exe ======== Computing dependency graph ======== Graph root conanfile.py: C:/Users/Administrator/mingw-xz_utils/conanfile.py Requirements xz_utils/5.4.4#f7cff24c0eadb6e51001dd86695e823d - Cache Build requirements 7zip/19.00#0aaab2a97444de6ab6828d3e4aa63151 - Cache lzma_sdk/9.20#f1fe20056422603432563a07b25f2ee3 - Cache make/4.3#f3747ef6e47bbd049f9f3f14a9e1d8ba - Cache mingw-builds/11.2.0#f826740f012267e6f1770bf717294607 - Cache ======== Computing necessary packages ======== xz_utils/5.4.4: Forced build from source Requirements xz_utils/5.4.4#f7cff24c0eadb6e51001dd86695e823d:b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89 - Build Build requirements mingw-builds/11.2.0#f826740f012267e6f1770bf717294607:f4943bfd33cc2961ebbb1d81bf8b090153522e1f#394f81d79847375cedbfa6f06baddba3 - Cache Skipped binaries 7zip/19.00, lzma_sdk/9.20, make/4.3 ======== Installing packages ======== mingw-builds/11.2.0: Already installed! (1 of 2) -------- Installing package xz_utils/5.4.4 (2 of 2) -------- xz_utils/5.4.4: Building from source xz_utils/5.4.4: Package xz_utils/5.4.4:b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89 xz_utils/5.4.4: Copying sources to build folder xz_utils/5.4.4: Building your package in C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_ut03977eaeec587/b xz_utils/5.4.4: Calling generate() xz_utils/5.4.4: Generators folder: C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_ut03977eaeec587/b/build-release/conan xz_utils/5.4.4: Generating aggregated env files xz_utils/5.4.4: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] xz_utils/5.4.4: Calling build() xz_utils/5.4.4: apply_conandata_patches(): No patches defined in conandata xz_utils/5.4.4: Calling: > "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_ut03977eaeec587/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includ edir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc xz_utils/5.4.4: RUN: "/c/users/administrator/mingw-xz_utils/.conan2/p/b/xz_ut03977eaeec587/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${pr efix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --disable-doc '.' is not recognized as an internal or external command, operable program or batch file. xz_utils/5.4.4: ERROR: Package 'b9d2aecbbf6be9c625a496f6838bc0cb62ce1d89' build failed xz_utils/5.4.4: WARN: Build folder C:/Users/Administrator/mingw-xz_utils/.conan2/p/b/xz_ut03977eaeec587/b/build-release ********************************************************* Recipe 'xz_utils/5.4.4' cannot build its binary It is possible that this recipe is not Conan 2.0 ready If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues If it is your recipe, check if it is updated to 2.0 ********************************************************* ERROR: xz_utils/5.4.4: Error in build() method, line 140 autotools.configure() ConanException: Error 1 while executing ```

Again, removing all tools.microsoft.bash settings from both profiles allows the build to succeed.

jwatson0 commented 1 year ago

Ran across a similar error message here, also related to autotools: https://github.com/conan-io/conan-center-index/issues/2188

jwatson0 commented 1 year ago

The message

'.' is not recognized as an internal or external command, operable program or batch file.

seems to come from a bash command line such as ./test_package being executed with cmd.exe

jputcu commented 1 year ago

Also related conan-io/conan#14041 and conan-io/conan#12877

jwatson0 commented 1 year ago

@memsharded In the two above issues, you write

The new tools design tries hard to not make any guesses or auto-detect, but rely on explicit user inputs. In this case, if Conan is running already inside a subsystem, it is necessary to define:

tools.microsoft.bash:active=True tools.microsoft.bash:subsystem=msys2

To indicate that Conan is already inside the subsystem, and such command executions do not need to add the bash -c ... to run inside bash.

and

I cannot make something as simple as: import subprocess subprocess.call('.' "/home/myuser/file.sh"', shell=True)

I have been tracing into this and I think I see why that is happening.

When python on Windows uses subprocess.Popen(shell=True, ...), python specifically invokes cmd.exe or the value of the COMSPEC env var. See https://github.com/python/cpython/blob/3726cb0f146cb229a5e9db8d41c713b023dcd474/Lib/subprocess.py or the /usr/lib/python3.10/subprocess.py source file in your installation.

In the python Popen class, there is: self._execute_child(...) which has a different implementation based on if _mswindows. In the _mswindows implementation, (see https://github.com/python/cpython/blob/dcb16c98be61630369227f0d893f8d9262d25cac/Lib/subprocess.py#L1354), python specifically looks for the executable passed in, or COMSPEC env var, or cmd.exe:

            if shell:
                ...
                if not executable:
                    ...
                    comspec = os.environ.get('ComSpec')
                    if not comspec:
                        system_root = os.environ.get('SystemRoot', '')
                        comspec = os.path.join(system_root, 'System32', 'cmd.exe')

and even if you set COMSPEC, python assumes that it takes cmd.exe-style args with /c:

                args = '{} /c "{}"'.format (comspec, args)

So, basically, if you call subprocess.Popen() with shell=True on Windows, you need to be sending cmd.exe-style arguments to it, and not sh-style.

The docs at https://docs.python.org/3/library/subprocess.html say:

On Windows with shell=True, the COMSPEC environment variable specifies the default shell. The only time you need to specify shell=True on Windows is when the command you wish to execute is built into the shell (e.g. dir or copy). You do not need shell=True to run a batch file or console-based executable.

Currently, a command similar to . file.sh is being executed with cmd.exe, and that generates the error that '.' is not recognized.

I don't see how tools.microsoft.bash:active=True can work with shell=True because a bash wrapper will always be needed.

You could call something like:

  subprocess.Popen(executable="C:\\msys64\\usr\\bin\\bash.exe", shell=False, args=". C:/Users/Administrator/file.sh")

But more than one arg or a compound command will need a -c bash wrapper anyway.

This appears to work:

subprocess.Popen(executable="C:\\msys64\\usr\\bin\\bash.exe", shell=False, args=["bash", "-c", ". C:/Users/Administrator/file.sh
 && date"])

I've been trying to get a working fix applied in the conan source, but I'm currently running into issues with nested bash commands and command line escapes. Taking the cmd.exe out of the command pipeline probably makes things easier.

jwatson0 commented 1 year ago

Also, adding this python audit hook to the top of conanfile.py (outside the ConanFile class) helps with seeing exactly what is being executed:

# DEBUG: display subprocess.Popen events for executed commands
def audit(event, args):
    if 'subprocess.Popen' in event:
        print(f'+++ audit: event={event}, args={args}')
        #breakpoint()
import sys
sys.addaudithook(audit)

class MyConan(ConanFile):
   #...

example output:

openssl/1.1.1t: RUN: make -j4
+++ audit: event=subprocess.Popen, args=('C:\\Windows\\system32\\cmd.exe', 'C:\\Windows\\system32\\cmd.exe /c ""Z:\\dev\\mingw-openssl\\.conan2\\p\\b\\opensd87f5fa4d3dac\\b\\build-release\\conan\\msys2_mode.bat" && C:\\msys64\\usr\\bin\\bash.exe --login -c ^". \\^"Z:\\dev\\mingw-openssl\\.conan2\\p\\b\\opensd87f5fa4d3dac\\b\\build-release\\conan\\conanbuild.sh\\^" ^&^& make -j4^""', None, None
)