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

[package] boost/1.85.0: Unable to build boost python on Windows #26187

Open
Todiq opened this issue Dec 14, 2024 · 0 comments
Open

[package] boost/1.85.0: Unable to build boost python on Windows #26187

Todiq opened this issue Dec 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Todiq
Copy link

Todiq commented Dec 14, 2024

Description

Hello, I am unable to build boost python on a Windows Docker image that has been built using this file:

# syntax=docker/dockerfile:1.2

ARG VIRTUAL_ENV="C:\\venv"
ARG GIT="C:\\git"

FROM python:3.9-windowsservercore-ltsc2022 AS pip-requirements

ARG VIRTUAL_ENV

ENV LANG=C.UTF-8 \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

RUN [Environment]::SetEnvironmentVariable('Path', $env:VIRTUAL_ENV + '\Scripts;' + $env:Path, [EnvironmentVariableTarget]::Machine)

COPY "requirements.txt" .

RUN python -m venv "${env:VIRTUAL_ENV}"; \
    python -m pip install --requirement requirements.txt --no-cache-dir

FROM mcr.microsoft.com/windows/servercore:ltsc2022-KB5044281 AS git

SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]

ARG GIT
ARG GIT_VERSION=2.47.0
ARG GIT_URL="https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/Git-${GIT_VERSION}-64-bit.exe"

RUN "$ProgressPreference = 'SilentlyContinue' ; Invoke-WebRequest -Uri ${env:GIT_URL} -OutFile git.exe"

RUN .\git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /DIR="${env:GIT}"

FROM python:3.9-windowsservercore-ltsc2022 AS final

ARG BUILD_TOOLS="C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools"
ARG VIRTUAL_ENV
ARG GIT
# Build tools v17.11.5. Taken from https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
ARG VS_BUILD_TOOLS="https://download.visualstudio.microsoft.com/download/pr/69e24482-3b48-44d3-af65-51f866a08313/471c9a89fa8ba27d356748ae0cf25eb1f362184992dc0bb6e9ccf10178c43c27/vs_BuildTools.exe"

SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]

ENV CONAN_HOME="C:\\conan" \
	CLICOLOR_FORCE=1 \
    GTEST_COLOR=1

RUN $ProgressPreference = 'SilentlyContinue' ; Invoke-WebRequest -Uri ${env:VS_BUILD_TOOLS} -OutFile vs_BuildTools.exe; \
    .\vs_BuildTools.exe --quiet --wait --norestart --nocache --downloadThenInstall \
    --installPath "${env:BUILD_TOOLS}" \
    --add Microsoft.VisualStudio.Workload.VCTools \
    --add Microsoft.VisualStudio.Component.VC.CoreBuildTools \
    --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
    --add Microsoft.VisualStudio.Component.Windows10SDK \
    --add Microsoft.VisualStudio.Component.Windows11SDK.22621 | Out-Null; \
    rm .\vs_BuildTools.exe

COPY --from=pip-requirements "${VIRTUAL_ENV}" "${VIRTUAL_ENV}"

COPY --from=git "${GIT}" "${GIT}"

RUN "[System.Environment]::SetEnvironmentVariable('Path', \
    $env:VIRTUAL_ENV + '\Scripts;' \
    + $env:GIT + '\bin;' \
    + [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine), [EnvironmentVariableTarget]::Machine)"

WORKDIR "/workspace"

ENTRYPOINT ["C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=amd64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

The requirements.txt is the following:

conan~=2.10
cmake~=3.31
ninja~=1.11
numpy~=2 # Python 3.9 doesn't have acess to numpy >=2.1

And the conanfile.txt:

[requires]
boost/1.85.0

[options]
boost*:bzip2=False
boost*:shared=True
boost*:zlib=False
boost*:without_atomic=False
boost*:without_charconv=True
boost*:without_chrono=False
boost*:without_cobalt=True
boost*:without_container=False
boost*:without_context=True
boost*:without_contract=True
boost*:without_coroutine=True
boost*:without_date_time=False
boost*:without_exception=False
boost*:without_fiber=True
boost*:without_filesystem=False
boost*:without_graph=True
boost*:without_graph_parallel=True
boost*:without_iostreams=False
boost*:without_json=True
boost*:without_locale=False
boost*:without_log=False
boost*:without_math=True
boost*:without_mpi=True
boost*:without_nowide=True
boost*:without_program_options=False
boost*:without_python=False
boost*:without_random=False
boost*:without_regex=False
boost*:without_serialization=True
boost*:without_stacktrace=True
boost*:without_system=False
boost*:without_test=True
boost*:without_thread=False
boost*:without_timer=True
boost*:without_type_erasure=True
boost*:without_url=True
boost*:without_wave=True

Package and Environment Details

  • Package Name/Version: boost/1.85.0
  • Operating System+version: Windows Server LTSC 2022
  • Compiler+version: msvc 17.11.5
  • Docker image: Dockerfile prodived
  • Conan version: conan 2.10.2
  • Python version: Python 3.9.13

Conan profile

[settings]
arch={{detect_api.detect_arch()}}
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.version=194
os=Windows

[conf]
{% if detect_api.detect_os() == "Windows" %}
	tools.env.virtualenv:powershell=True
	tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
{% endif %}
tools.cmake.cmake_layout:build_folder_vars = ["settings.os", "settings.compiler", "settings.compiler.version", "settings.arch"]

Steps to reproduce

  • First, build the image using the provided Dockerfile, placing the requirements.txt alongside:
    docker build -t msvc17-windowsservercore-ltsc2022 .
  • On the host, install the profile in the conan cache to allow container to access it:
    cat profile.txt > $env:MySharedDrive\conan\profiles\msvc (create the necessary locations)
  • Also on the host, add the conanfile.txt to the shared workspace: cat conanfile.txt > $env:MySharedDrive\conanfile.txt
  • Run the container: docker run -it --rm -v $env:MySharedDrive\:C:\workspace -v $env:MySharedDrive\conan:C:\conan msvc17-windowsservercore-ltsc2022
  • Inside the container run the install command: conan install -pr:a msvc conanfile.txt -r conancenter --build=missing

Logs

Click to expand log
-------- Installing package boost/1.85.0 (2 of 2) --------
boost/1.85.0: Building from source
boost/1.85.0: Package boost/1.85.0:30d4c6379266b1c341c3cd6a3344c5a261665bd1
boost/1.85.0: Building your package in C:\conan\p\b\boost979c71eb92da0\b
boost/1.85.0: Calling generate()
boost/1.85.0: Generators folder: C:\conan\p\b\boost979c71eb92da0\b\build-release\conan
boost/1.85.0: Generating aggregated env files
boost/1.85.0: Generated aggregated env files: ['conanbuild.bat', 'conanbuild.ps1', 'conanrun.ps1']
boost/1.85.0: Calling build()
boost/1.85.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in 'C:\conan\p\boost06c6495d1787e\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in 'C:\conan\p\boost06c6495d1787e\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in 'C:\conan\p\boost06c6495d1787e\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in 'C:\conan\p\boost06c6495d1787e\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.85.0: WARN: Patching user-config.jam
boost/1.85.0: running "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
  File "<string>", line 1
    from __future__ import print_function; import sys; print(
                                                             ^
SyntaxError: unexpected EOF while parsing

boost/1.85.0: (failed)
boost/1.85.0: running "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sysconfig; print(sysconfig.get_path('include'))"
boost/1.85.0: RUN: "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sysconfig; print(sysconfig.get_path('include'))"
  File "<string>", line 1
    from __future__ import print_function; import sysconfig; print(sysconfig.get_path(
                                                                                      ^
SyntaxError: unexpected EOF while parsing

boost/1.85.0: (failed)
boost/1.85.0: running "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sysconfig; print(sysconfig.get_path('platinclude'))"
boost/1.85.0: RUN: "C:/venv/Scripts/python.exe" -c "from __future__ import print_function; import sysconfig; print(sysconfig.get_path('platinclude'))"
  File "<string>", line 1
    from __future__ import print_function; import sysconfig; print(sysconfig.get_path(
                                                                                      ^
SyntaxError: unexpected EOF while parsing

boost/1.85.0: (failed)
boost/1.85.0: ERROR:
Package '30d4c6379266b1c341c3cd6a3344c5a261665bd1' build failed
boost/1.85.0: WARN: Build folder C:\conan\p\b\boost979c71eb92da0\b\build-release
ERROR: boost/1.85.0: Error in build() method, line 1152
        self._create_user_config_jam(self._boost_build_dir)
while calling '_create_user_config_jam', line 1549
        contents += f'\nusing python : {self._python_version} : "{self._python_executable}" : "{self._python_includes}" : "{self._python_library_dir}" ;'
while calling '_python_includes', line 974
        include_py = self._get_python_var("INCLUDEPY")
while calling '_get_python_var', line 923
        python_major = int(python_version_parts[0])
        ValueError: invalid literal for int() with base 10: 'None'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant