Add MSVC compatibility adjustments - #379
Conversation
Add compatibility fixes for MSVC in magick-baseconfig.h
|
@conda-forge-admin, please rerender |
|
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( I do have some suggestions for making it better though... For recipe/meta.yaml:
This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/27912962337. Examine the logs at this URL for more detail. |
|
Hi! This is the friendly automated conda-forge-webservice. I tried to rerender for you, but it looks like there was nothing to do. This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/27592838163. Examine the logs at this URL for more detail. |
| # semantics of ssize_t; using 'int' (32-bit) would risk overflow for | ||
| # images larger than 2GB. | ||
| sed -i 's|/\* #undef ssize_t \*/|#define ssize_t ptrdiff_t|' "${BASECONFIG}" | ||
|
|
There was a problem hiding this comment.
Instead of this, can you add a test in tests that does a compilation with msvc?
There was a problem hiding this comment.
As a result of the verification, the these inline patches were necessary.
I added a compilation test and confirmed that it passes in the CI checks.
Refactor build script to handle Windows parallel installation and check.
This file tests compatibility of MagickCore headers with MSVC, checking for issues like ssize_t declaration and restrict qualifier usage.
Modify header files to change warning directives to pragma messages.
Removed obsolete compatibility warning block related to MAGICKCORE_QUANTUM_DEPTH.
|
Hi! This is the friendly automated conda-forge-linting service. I was trying to look for recipes to lint for you, but it appears we have a merge conflict. Please try to merge or rebase with the base branch to resolve this conflict. Please ping the 'conda-forge/core' team (using the |
|
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( I do have some suggestions for making it better though... For recipe/meta.yaml:
This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/29386457465. Examine the logs at this URL for more detail. |
Removed definition of ssize_t as ptrdiff_t in CPPFLAGS.
Add ssize_t typedef handling for Windows builds in build.sh
Updated ssize_t handling in magick-baseconfig.h for Windows builds to ensure proper typedef and compatibility.
Modify magick-baseconfig.h handling for MSVC compatibility by adjusting attribute definitions and ensuring ssize_t typedef exists.
Add grep command to check for ssize_t in magick-baseconfig.h
|
@conda-forge-admin, please rerender |
|
Hi! This is the friendly automated conda-forge-webservice. I tried to rerender for you, but it looks like there was nothing to do. This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/28072350977. Examine the logs at this URL for more detail. |
Remove grep command that checks for ssize_t in magick-baseconfig.h during installation.
| # | ||
| # Also, clang on Windows provides ssize_t via sys/types.h, so AC_TYPE_SSIZE_T | ||
| # finds it and emits no typedef in magick-baseconfig.h. MSVC's SDK does not | ||
| # provide ssize_t, so we inject a typedef ptrdiff_t ssize_t guarded by _MSC_VER. |
There was a problem hiding this comment.
This comment seems wrong. _MSC_VER is also set with clang on Windows right?
There was a problem hiding this comment.
_MSC_VER seems defined not only by cl.exe and clang-cl, but also by clang when targeting the MSVC ABI. Since the conda-forge Windows build targets the MSVC ABI, _MSC_VER seems defined during the build with clang/autotools as well.
The #ifdef _MSC_VER guard in the injected header is therefore intentional — it is meant to cover all compilers targeting the MSVC ABI (cl.exe, clang-cl, and clang with MSVC target), all of which lack ssize_t in their SDK.
The comment was misleading by implying only cl.exe. I have updated it:
https://github.com/eunos-1128/imagemagick-feedstock/blob/main/recipe/build.sh#L128-L141
Reference: https://clang.llvm.org/docs/CommandGuide/clang.html (-fmsc-version= option: "When on Windows, this defaults to either the same value as the currently installed version of cl.exe, or 1933.")
There was a problem hiding this comment.
How about this...?
Updated comments to clarify the role of expat and freetype in the build process.
This pull request addresses compatibility issues for downstream MSVC (cl.exe) consumers when building the ImageMagick package on Windows. The main focus is to ensure that the generated
magick-baseconfig.hheader uses MSVC-compatible definitions for therestrictkeyword andssize_ttype, preventing common build errors in dependent projects. Additionally, the build number is incremented.Windows MSVC compatibility improvements:
ac_cv_c_restrictandac_cv_type_ssize_t) before configuration to ensuremagick-baseconfig.hdefines_magickcore_restrictas__restrict(MSVC-compatible) and provides a typedef forssize_t, avoiding build errors in downstream MSVC projects.sedcommands after build to patchmagick-baseconfig.hif the autoconf cache overrides did not take effect: replace__restrict__with__restrictand definessize_tasptrdiff_tif it remains undefined.Checklist
0(if the version changed)conda-smithy(Use the phrase@conda-forge-admin, please rerenderin a comment in this PR for automated rerendering)