Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows clang compilation (non-msvc) #295

Closed
AndreyMlashkin opened this issue Jul 19, 2021 · 7 comments
Closed

Windows clang compilation (non-msvc) #295

AndreyMlashkin opened this issue Jul 19, 2021 · 7 comments

Comments

@AndreyMlashkin
Copy link

Description of Problem, Request, or Question

Environment Details

  • Operating System: Windows
  • Operation System Version: Windows 10

Steps to reproduce (Include if Applicable)

clone a repository git@github.com:AndreyMlashkin/windows-clang-conan.git
docker build .

Build logs (Include if Available)

windows-clang-conan> docker build .
Sending build context to Docker daemon 64kB
Step 1/8 : FROM mcr.microsoft.com/windows/servercore:1909
---> 14b4902a3f0f
Step 2/8 : SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue';"]
---> Using cache
---> 21eb6e210729
Step 3/8 : RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
---> Using cache
---> b675b6f86e1a
Step 4/8 : RUN choco install llvm --version 11.0 -y
---> Using cache
---> 1c6bd3ee8d27
Step 5/8 : RUN choco install Ninja -y
---> Running in 6df9cde7e8a3
Chocolatey v0.10.15
Installing the following packages:
Ninja
By installing you accept licenses for the packages.
Progress: Downloading ninja 1.10.2... 100%

ninja v1.10.2 [Approved]
ninja package files install completed. Performing other installation steps.
Extracting C:\ProgramData\chocolatey\lib\ninja\tools\ninja-win_x32.zip to C:\ProgramData\chocolatey\lib\ninja\tools...
C:\ProgramData\chocolatey\lib\ninja\tools
Installed to: 'C:\ProgramData\chocolatey\lib\ninja\tools'
ShimGen has successfully created a shim for ninja.exe
The install of ninja was successful.
Software installed to 'C:\ProgramData\chocolatey\lib\ninja\tools'

Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Removing intermediate container 6df9cde7e8a3
---> b9538f621a27
Step 6/8 : RUN choco install conan -y
---> Running in c3bf5106354a
Chocolatey v0.10.15
Installing the following packages:
conan
By installing you accept licenses for the packages.
Progress: Downloading conan 1.38.0... 100%

conan v1.38.0 [Approved]
conan package files install completed. Performing other installation steps.
Downloading conan 64 bit
from 'https://github.com/conan-io/conan/releases/download/1.38.0/conan-win-64.exe'
Progress: 100% - Completed download of C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\conan\1.38.0\conan-win-64.exe (15.73 MB).
Download of conan-win-64.exe (15.73 MB) completed.
Hashes match.
Installing conan...
conan has been installed.
conan can be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type refreshenv).
The install of conan was successful.
Software installed to 'C:\Program Files\Conan'

Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Removing intermediate container c3bf5106354a
---> 4e7bc63c1e3b
Step 7/8 : ADD profile C:\Users\ContainerAdministrator.conan\profiles\default
---> 008458ce4e90
Step 8/8 : RUN conan install zlib/1.2.11@ --build ""
---> Running in 32d581619691
ERROR: Invalid setting '12.0' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4.0', '5.0', '6.0', '7.0', '7.1', '8', '9', '10', '11', '12']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; conan install zlib/1.2.11@ --build "
"' returned a non-zero code: 1
PS E:\sources\windows-clang-conan> docker build .
Sending build context to Docker daemon 64kB
Step 1/8 : FROM mcr.microsoft.com/windows/servercore:1909
---> 14b4902a3f0f
Step 2/8 : SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue';"]
---> Using cache
---> 21eb6e210729
Step 3/8 : RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
---> Using cache
---> b675b6f86e1a
Step 4/8 : RUN choco install llvm --version 11.0 -y
---> Using cache
---> 1c6bd3ee8d27
Step 5/8 : RUN choco install Ninja -y
---> Using cache
---> b9538f621a27
Step 6/8 : RUN choco install conan -y
---> Using cache
---> 4e7bc63c1e3b
Step 7/8 : ADD profile C:\Users\ContainerAdministrator.conan\profiles\default
---> Using cache
---> 008458ce4e90
Step 8/8 : RUN conan install zlib/1.2.11@ --build ""
---> Running in e577762a20f1
ERROR: Invalid setting '12.0' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4.0', '5.0', '6.0', '7.0', '7.1', '8', '9', '10', '11', '12']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; conan install zlib/1.2.11@ --build "
"' returned a non-zero code: 1

@AndreyMlashkin
Copy link
Author

Even if I change settings.yml to reflect 12.0, it still does not work for me.

@uilianries
Copy link
Member

@AndreyMlashkin We don't have a Docker image for Clang on Windows. Please, check with the author, AndreyMlashkin.

@AndreyMlashkin
Copy link
Author

Haha, wittily.

@AndreyMlashkin
Copy link
Author

AndreyMlashkin commented Aug 3, 2021

I have created a Dockerfile to demonstrate a problem using clang compiler with conan. Dockerfile is a best way to demonstrate problem, as it does not have side effects from 3rd party software and paths defined on your host machine.

So, currently it complains for:

Click to expand log

Step 13/13 : RUN conan create . hello/0.1@ -m v2_cmake -c tools.env.virtualenv:auto_use=True
 ---> Running in 88c1ea2ec077
Exporting package recipe
hello/0.1 exports_sources: Copied 1 '.txt' file: CMakeLists.txt
hello/0.1 exports_sources: Copied 1 '.cpp' file: hello.cpp
hello/0.1 exports_sources: Copied 1 '.h' file: hello.h
hello/0.1: A new conanfile.py version was exported
hello/0.1: Folder: C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\export
hello/0.1: Exported revision: 433e00605e6b7db954049ae82d12ddec
Configuration:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.version=12
os=Windows
[options]
[build_requires]
[env]
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:auto_use=True
hello/0.1: Forced build from source
hello/0.1 (test package): Installing package
Requirements
    hello/0.1 from local cache - Cache
Packages
    hello/0.1:953141255571f930532512aaa0e30f6ab1eec04c - Build

Installing (downloading, building) binaries...
hello/0.1: Configuring sources in C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\source
hello/0.1: Copying sources to build folder
hello/0.1: Building your package in C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\build\953141255571f930532512aaa0e30f6ab1eec04c
hello/0.1: Generator txt created conanbuildinfo.txt
hello/0.1: Calling generate()
hello/0.1: Calling build()
hello/0.1: CMake command: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/package/953141255571f930532512aaa0e30f6ab1eec04c" "C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\build\953141255571f930532512aaa0e30f6ab1eec04c\src"
Configuring environment variables
Using Conan toolchain through C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/generators/conan_toolchain.cmake.
-- Conan toolchain: Setting BUILD_SHARED_LIBS= OFF
-- The CXX compiler identification is Clang 12.0.0 with MSVC-like command-line
-- Detecting CXX compiler ABI info
Using Conan toolchain through .
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe
Using Conan toolchain through .
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:59 (message):
  The C++ compiler

    "C:/Program Files/LLVM/bin/clang-cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/Release/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_a4c40 && [1/2] Building CXX object CMakeFiles\cmTC_a4c40.dir\testCXXCompiler.cxx.obj
    [2/2] Linking CXX executable cmTC_a4c40.exe
    FAILED: cmTC_a4c40.exe
    cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_a4c40.dir --rc="C:\Program Files\LLVM\bin\clang-cl.exe" --mt=CMAKE_MT-NOTFOUND --manifests  -- "C:\Program Files\LLVM\bin\lld-link.exe" /nologo CMakeFiles\cmTC_a4c40.dir\testCXXCompiler.cxx.obj  /out:cmTC_a4c40.exe /implib:cmTC_a4c40.lib /pdb:cmTC_a4c40.pdb /version:0.0 -m64 /machine:x64  /INCREMENTAL:NO /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    LINK: command "C:\Program Files\LLVM\bin\lld-link.exe /nologo CMakeFiles\cmTC_a4c40.dir\testCXXCompiler.cxx.obj /out:cmTC_a4c40.exe /implib:cmTC_a4c40.lib /pdb:cmTC_a4c40.pdb /version:0.0 -m64 /machine:x64 /INCREMENTAL:NO /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:cmTC_a4c40.exe.manifest" failed (exit code 1) with the following output:
    lld-link: warning: ignoring unknown argument '-m64'
    lld-link: error: could not open 'kernel32.lib': no such file or directory
    lld-link: error: could not open 'user32.lib': no such file or directory
    lld-link: error: could not open 'gdi32.lib': no such file or directory
    lld-link: error: could not open 'winspool.lib': no such file or directory
    lld-link: error: could not open 'shell32.lib': no such file or directory
    lld-link: error: could not open 'ole32.lib': no such file or directory
    lld-link: error: could not open 'oleaut32.lib': no such file or directory
    lld-link: error: could not open 'uuid.lib': no such file or directory
    lld-link: error: could not open 'comdlg32.lib': no such file or directory
    lld-link: error: could not open 'advapi32.lib': no such file or directory
    lld-link: error: could not open 'msvcrt.lib': no such file or directory
    lld-link: error: could not open 'oldnames.lib': no such file or directory
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/Release/CMakeFiles/CMakeError.log".
hello/0.1:
WARN: Remotes registry file missing, creating default one in C:\Users\ContainerAdministrator\.conan\remotes.json
hello/0.1: ERROR: Package '953141255571f930532512aaa0e30f6ab1eec04c' build failed
hello/0.1: WARN: Build folder C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\build\953141255571f930532512aaa0e30f6ab1eec04c\build/Release
ERROR: hello/0.1: Error in build() method, line 39
        cmake.configure()
        ConanException: Error 1 while executing "C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\build\953141255571f930532512aaa0e30f6ab1eec04c\build/generators\conanbuildenv.bat" && cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/build/953141255571f930532512aaa0e30f6ab1eec04c/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/ContainerAdministrator/.conan/data/hello/0.1/_/_/package/953141255571f930532512aaa0e30f6ab1eec04c" "C:\Users\ContainerAdministrator\.conan\data\hello\0.1\_\_\build\953141255571f930532512aaa0e30f6ab1eec04c\src"
The command 'powershell -Command $ErrorActionPreference = 'Stop'; conan create . hello/0.1@ -m v2_cmake -c tools.env.virtualenv:auto_use=True' returned a non-zero code: 1

@uilianries
Copy link
Member

Ah, sorry, I didn't see you are the author actually 😅

@uilianries
Copy link
Member

@AndreyMlashkin I suggest you moving this question to https://github.com/conan-io/conan/issues, because is related to Conan client itself, not to the official Docker images. Also take a look on conan-io/conan#1839

Regards.

@AndreyMlashkin
Copy link
Author

Relates to conan-io/conan#9295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants