conan icon indicating copy to clipboard operation
conan copied to clipboard

[bug] '.' is not recognized as an internal or external command on windows in 2.0.0-beta2

Open ssrobins opened this issue 3 years ago • 5 comments

Environment Details (include every applicable attribute)

  • Operating System+version: Windows 10 21H1 19043.1826
  • Compiler+version: msvc 193
  • Conan version: 2.0.0-beta2
  • Python version: 3.10.5

Steps to reproduce (Include if Applicable)

  1. git clone https://github.com/ssrobins/conan-recipes.git
  2. cd conan-recipes\recipes\box2d
  3. Then run any of these variations of the conan create command (tried to 'black-box' a workaround :P)
    • The path . after --user: conan create --update --user ssrobins . -pr:h=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x86 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x64 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/default -s build_type=Debug

    • The path . at the end: conan create --update --user ssrobins -pr:h=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x86 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x64 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/default -s build_type=Debug .

    • Full path at the end: conan create --update --user ssrobins -pr:h=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x86 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x64 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/default -s build_type=Debug C:\Users\Steve\Code\conan-recipes\recipes\box2d

    • All backslashes: conan create --update --user ssrobins -pr:h=C:\Users\Steve\Code\conan-recipes\scripts\..\profiles\windows_x86 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts\..\profiles\windows_x64 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts\..\profiles\default -s build_type=Debug C:\Users\Steve\Code\conan-recipes\recipes\box2d

    • All forward slashes: conan create --update --user ssrobins -pr:h=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/windows_x86 -pr:b=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/windows_x64 -pr:b=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/default -s build_type=Debug C:/Users/Steve/Code/conan-recipes/recipes/box2d

  • Did not hit an issue on macOS or linux with 2.0.0-beta2
  • Was not a problem on any platform with 2.0.0-beta1
  • Made no difference calling the conan command from PowerShell or command prompt

Logs (Executed commands with output) (Include/Attach if Applicable)

PS C:\Users\Steve\Code\conan-recipes\recipes\box2d> conan create --update --user ssrobins -pr:h=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/windows_x86 -pr:b=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/windows_x64 -pr:b=C:/Users/Steve/Code/conan-recipes/scripts/../profiles/default -s build_type=Debug C:/Users/Steve/Code/conan-recipes/recipes/box2d
Exporting the recipe
box2d/2.3.1@ssrobins: Exporting package recipe
box2d/2.3.1@ssrobins: Copied 1 '.txt' file: CMakeLists.txt
box2d/2.3.1@ssrobins exports_sources: Copied 1 '.txt' file: CMakeLists.txt
box2d/2.3.1@ssrobins: Using git commit as the recipe revision: 1ca81b59bdbee2f25d7ab8874433204c675a8a0a
box2d/2.3.1@ssrobins: A new conanfile.py version was exported
box2d/2.3.1@ssrobins: Folder: C:\Users\Steve\.conan2\p\35637fee2dd57b87\e        
box2d/2.3.1@ssrobins: Exported revision: 1ca81b59bdbee2f25d7ab8874433204c675a8a0a

-------- Input profiles --------
Profile host:
[settings]
arch=x86
build_type=Debug
compiler=msvc
compiler.cppstd=17
compiler.runtime=static
compiler.runtime_type=Debug
compiler.version=193
os=Windows

Profile build:
[settings]
arch=x86_64


-------- Computing dependency graph --------
box2d/2.3.1@ssrobins: Checking remote: conancenter
box2d/2.3.1@ssrobins: Checking remote: artifactory-ssrobins
cmake_utils/10.0.1@ssrobins: Checking remote: conancenter
cmake_utils/10.0.1@ssrobins: Checking remote: artifactory-ssrobins
Graph root
    box2d/2.3.1@ssrobins (test package): C:/Users/Steve/Code/conan-recipes/recipes/box2d\test_package\conanfile.py    
Requirements
    box2d/2.3.1@ssrobins#1ca81b59bdbee2f25d7ab8874433204c675a8a0a - Newer
    cmake_utils/10.0.1@ssrobins#4df6c2a676799323bffe5eba925901075d70d104 - Cache (artifactory-ssrobins)

-------- Computing necessary packages --------
cmake_utils/10.0.1@ssrobins: Current package revision is newer than the remote one
box2d/2.3.1@ssrobins: Forced build from source
Requirements
    box2d/2.3.1@ssrobins#1ca81b59bdbee2f25d7ab8874433204c675a8a0a:d3783581517e3aa396229673622090255a79473d - Build    
    cmake_utils/10.0.1@ssrobins#4df6c2a676799323bffe5eba925901075d70d104:da39a3ee5e6b4b0d3255bfef95601890afd80709#1b5381bb8d70c7c5fa0ac23004eee6c9 - Cache

-------- Installing packages --------

-------- Installing (downloading, building) binaries... --------
cmake_utils/10.0.1@ssrobins: Already installed!
box2d/2.3.1@ssrobins: Calling source() in C:\Users\Steve\.conan2\p\35637fee2dd57b87\s
Downloading v2.3.1.tar.gz

box2d/2.3.1@ssrobins: Copying sources to build folder
box2d/2.3.1@ssrobins: Building your package in C:\Users\Steve\.conan2\p\tmp\e9cad6ee425da214\b
box2d/2.3.1@ssrobins: Generator 'CMakeDeps' calling 'generate()'
box2d/2.3.1@ssrobins: Calling generate()
box2d/2.3.1@ssrobins: Aggregating env generators
box2d/2.3.1@ssrobins: Calling build()
box2d/2.3.1@ssrobins: CMake command: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="C:/Users/Steve/.conan2/p/tmp/e9cad6ee425da214/b/build/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Steve/.conan2/p/tmp/e9cad6ee425da214/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:\Users\Steve\.conan2\p\tmp\e9cad6ee425da214\b"
box2d/2.3.1@ssrobins: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="C:/Users/Steve/.conan2/p/tmp/e9cad6ee425da214/b/build/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Steve/.conan2/p/tmp/e9cad6ee425da214/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:\Users\Steve\.conan2\p\tmp\e9cad6ee425da214\b"
'.' is not recognized as an internal or external command,
operable program or batch file.
box2d/2.3.1@ssrobins: ERROR: 
Package 'd3783581517e3aa396229673622090255a79473d' build failed
box2d/2.3.1@ssrobins: WARN: Build folder C:\Users\Steve\.conan2\p\tmp\e9cad6ee425da214\b\build
ERROR: box2d/2.3.1@ssrobins: Error in build() method, line 54
        cmake.configure()
        ConanException: Error 1 while executing

ssrobins avatar Jul 29 '22 07:07 ssrobins

Looks like in Windows, argparse requires the positional argument (the path to the conanfile, in this case the .) to be in the first position after the create, otherwise it gets confused. So, try this and let me know if it works:

conan create . --update --user ssrobins -pr:h=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x86 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/windows_x64 -pr:b=C:\Users\Steve\Code\conan-recipes\scripts/../profiles/default -s build_type=Debug

lasote avatar Jul 29 '22 07:07 lasote

I still get the same error with that change.

ssrobins avatar Jul 29 '22 08:07 ssrobins

Ok, I've been able to reproduce on my windows machine. I'll debug and come back with a fix.

lasote avatar Jul 29 '22 09:07 lasote

Hi, I've opened a PR but only improved the error message, the "bug" is on your side. You need to specify the "os" in your build profile, otherwise, Windows fails to know how to call external programs like CMake (prepending the build environment launcher). So I also noticed that you were applying two profiles, the windows_x64 and the default but the default is empty in that directory: C:\Users\Steve\Code\conan-recipes\scripts/../profiles/default so not "os" is declared.

lasote avatar Jul 29 '22 10:07 lasote

Thanks, I appreciate the help! There was lots of great error feedback when I was setting up the profiles and this will be a nice addition. I think I set up that file to force the x64 msvc tools to be used in my Windows x86 build. I put as little in it as possible to get the build I want and not get Conan errors. It was a hasty fix, not surprised I messed it up.

ssrobins avatar Jul 29 '22 17:07 ssrobins

Fixed in https://github.com/conan-io/conan/pull/11728, will be released in 2.0-beta.3

memsharded avatar Aug 15 '22 21:08 memsharded