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

add Windows #92

Merged
merged 19 commits into from
May 10, 2024
Merged

add Windows #92

merged 19 commits into from
May 10, 2024

Conversation

minrk
Copy link
Member

@minrk minrk commented May 9, 2024

Windows builds haven't been updated since #65

here's hoping it's gotten easier since then

closes #51

@conda-forge-webservices
Copy link
Contributor

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 (recipe) and found it was in an excellent condition.

@Tobias-Fischer
Copy link

Thanks for giving this a go @minrk!

/cc @traversaro you might be interested

@minrk
Copy link
Member Author

minrk commented May 10, 2024

Currently stuck on CHOLMOD not finding LAPACK symbols:

[285/885] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def.objs && cd %SRC_DIR%\build" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CHOLMOD\CMakeFiles\CHOLMOD.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\CHOLMOD.rsp  /out:CHOLMOD\cholmod.dll /implib:CHOLMOD\cholmod.lib /pdb:CHOLMOD\cholmod.pdb /dll /version:5.2 /machine:x64 /INCREMENTAL:NO  /DEF:CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def && cd ."
FAILED: CHOLMOD/cholmod.dll CHOLMOD/cholmod.lib 
C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def.objs && cd %SRC_DIR%\build" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CHOLMOD\CMakeFiles\CHOLMOD.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\CHOLMOD.rsp  /out:CHOLMOD\cholmod.dll /implib:CHOLMOD\cholmod.lib /pdb:CHOLMOD\cholmod.pdb /dll /version:5.2 /machine:x64 /INCREMENTAL:NO  /DEF:CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def && cd ."
LINK: command "C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\CHOLMOD.rsp /out:CHOLMOD\cholmod.dll /implib:CHOLMOD\cholmod.lib /pdb:CHOLMOD\cholmod.pdb /dll /version:5.2 /machine:x64 /INCREMENTAL:NO /DEF:CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
   Creating library CHOLMOD\cholmod.lib and object CHOLMOD\cholmod.exp
cholmod_l_super_numeric.c.obj : error LNK2019: unresolved external symbol dtrsm referenced in function rd_cholmod_super_numeric_worker
cholmod_l_super_solve.c.obj : error LNK2001: unresolved external symbol dtrsm

(and so on for all used lapack symbols, I think)

I'm currently looking at the suitesparse-for-windows project we used for 5.4 for inspiration, but what i've tried so far doesn't seem to be working. If anyone has more Windows linking experience than me, feel free to contribute.

I've tried with both netlib and openblas (used in our previous windows build), producing the same result. I suspect this chunk of suitesparse-for-windows is relevant, but don't quite understand it. lapack is linked here.

I also had to exclude SPEX which requires GMP 6.1.2, which appears to be unavailable on Windows. It finds 6.0.0 (I think through MPIR?), but rejects that as too old.

@minrk
Copy link
Member Author

minrk commented May 10, 2024

FWIW, the CHOLMOD link line:

[289/885] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def.objs && cd %SRC_DIR%\build" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CHOLMOD\CMakeFiles\CHOLMOD.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\CHOLMOD.rsp  /out:CHOLMOD\cholmod.dll /implib:CHOLMOD\cholmod.lib /pdb:CHOLMOD\cholmod.pdb /dll /version:5.2 /machine:x64 /INCREMENTAL:NO  /DEF:CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def && cd ."

lacks any .lib dependencies, while COLAMD succeeds and has several:

[65/885] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\build\CCOLAMD\CMakeFiles\CCOLAMD.dir\.\exports.def %SRC_DIR%\build\CCOLAMD\CMakeFiles\CCOLAMD.dir\.\exports.def.objs && cd %SRC_DIR%\build" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CCOLAMD\CMakeFiles\CCOLAMD.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo CCOLAMD\CMakeFiles\CCOLAMD.dir\Source\ccolamd.c.obj CCOLAMD\CMakeFiles\CCOLAMD.dir\Source\ccolamd_l.c.obj CCOLAMD\CMakeFiles\CCOLAMD.dir\Source\ccolamd_version.c.obj  /out:CCOLAMD\ccolamd.dll /implib:CCOLAMD\ccolamd.lib /pdb:CCOLAMD\ccolamd.pdb /dll /version:3.3 /machine:x64 /INCREMENTAL:NO  /DEF:CCOLAMD\CMakeFiles\CCOLAMD.dir\.\exports.def  SuiteSparse_config\suitesparseconfig.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

which I suspect is the issue. I don't really understand what's causing the CHOLMOD to not link its explicitly stated dependencies with target_link_libraries.

@traversaro
Copy link
Contributor

I suspect this chunk of suitesparse-for-windows is relevant, but don't quite understand it.

The cmake_minimum_required version of suitesparse 7 is 3.22 https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v7.7.0/CMakeLists.txt#L22, so the CMP0022 and CMP0023 should be set to NEW by that.

@traversaro
Copy link
Contributor

For reference, I checked what vcpkg is doing and apparently they are using directly the CMake from suitesparse-for-windows (see https://github.com/microsoft/vcpkg/blob/cbf4a6641528cee6f172328984576f51698de726/ports/suitesparse/portfile.cmake#L3).

@traversaro
Copy link
Contributor

Ok, I was able to build locally without any need to hardcore openblas or similar. I will comment inline with the required modifications.

recipe/meta.yaml Outdated Show resolved Hide resolved
recipe/bld.bat Outdated Show resolved Hide resolved
recipe/bld.bat Outdated Show resolved Hide resolved
@traversaro
Copy link
Contributor

Ok, I was able to build locally without any need to hardcore openblas or similar. I will comment inline with the required modifications.

Comments added, with these modifications at least the build should end successfully (I did not checked the tests).

Co-authored-by: Silvio Traversaro <[email protected]>
@minrk
Copy link
Member Author

minrk commented May 10, 2024

Thank you!

@traversaro
Copy link
Contributor

@conda-forge-admin please rerender

@traversaro
Copy link
Contributor

@traversaro
Copy link
Contributor

@traversaro
Copy link
Contributor

Ok, with the latest suggest modifications everything works with mkl, but still fails with netlib due to the linking error.

@traversaro
Copy link
Contributor

[289/885] C:\Windows\system32\cmd.exe /C "C:\Windows\system32\cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def %SRC_DIR%\build\CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def.objs && cd %SRC_DIR%\build" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CHOLMOD\CMakeFiles\CHOLMOD.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\CHOLMOD.rsp /out:CHOLMOD\cholmod.dll /implib:CHOLMOD\cholmod.lib /pdb:CHOLMOD\cholmod.pdb /dll /version:5.2 /machine:x64 /INCREMENTAL:NO /DEF:CHOLMOD\CMakeFiles\CHOLMOD.dir\.\exports.def && cd ."

I checked this. The difference here is that the blas.lib and lapack.lib are specified by Ninja in the @CMakeFiles\CHOLMOD.rsp , but anyhow apparently they are correctly linked.

@traversaro
Copy link
Contributor

The problem is that CHOLMOD is looking for dtrsm, while netlib/openblas library have the dtrsm_ (note the underscore).

@traversaro
Copy link
Contributor

traversaro commented May 10, 2024

The problem is that CHOLMOD is looking for dtrsm, while netlib/openblas library have the dtrsm_ (note the underscore).

This seems related: https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/31bdd56256b3d2a7dffaade1fbd074d48489865c/SuiteSparse_config/SuiteSparse_config.h#L538 and DrTimothyAldenDavis/SuiteSparse#722 (comment) .

Co-authored-by: Silvio Traversaro <[email protected]>
@traversaro
Copy link
Contributor

The problem is that CHOLMOD is looking for dtrsm, while netlib/openblas library have the dtrsm_ (note the underscore).

This seems related: https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/31bdd56256b3d2a7dffaade1fbd074d48489865c/SuiteSparse_config/SuiteSparse_config.h#L538 and DrTimothyAldenDavis/SuiteSparse#722 (comment) .

Ok, I think I found the problem. The CMake logic for checking if fortran is available (in https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/31bdd56256b3d2a7dffaade1fbd074d48489865c/LAGraph/cmake_modules/SuiteSparsePolicy.cmake#L280) somehow is not detecting flang, so the logic for handling correctly the fortran mangling in https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/31bdd56256b3d2a7dffaade1fbd074d48489865c/SuiteSparse_config/CMakeLists.txt#L48 is not being used. Forcing CMake to use flang.exe seems to work fine: https://github.com/conda-forge/suitesparse-feedstock/pull/92/files#r1596642507 .

Co-authored-by: Silvio Traversaro <[email protected]>
recipe/bld.bat Outdated Show resolved Hide resolved
Co-authored-by: Silvio Traversaro <[email protected]>
@Tobias-Fischer
Copy link

LGTM, thanks @minrk @traversaro!

@minrk
Copy link
Member Author

minrk commented May 10, 2024

Wonderful, thank you @traversaro!

@minrk minrk merged commit 35dbb3f into conda-forge:main May 10, 2024
8 checks passed
@minrk minrk deleted the restore-windows branch May 10, 2024 15:12
@traversaro
Copy link
Contributor

Thanks for opening the PR @minrk !

@h-vetinari
Copy link
Member

Awesome work! :)

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

Successfully merging this pull request may close these issues.

windows build ?
4 participants