Skip to content

Pixi migration: Migrate CI dependencies to pixi/conda-forge - #8823

Closed
Ayushj0704 wants to merge 43 commits into
OpenMS:developfrom
Ayushj0704:pixi-migration
Closed

Ayushj0704 wants to merge 43 commits into
OpenMS:developfrom
Ayushj0704:pixi-migration

Conversation

@Ayushj0704

Copy link
Copy Markdown

Description

migrating the OpenMS dependencies to pixi/conda-forge for cross platform builds, currently setup relies on different package managers (choco, brew,vcpkg,conda) depending on type of OS , which make it complex in setting up the codespace and to overcome the same ,platform specific need into a single pixi.toml that works consistently across linux-64,linux-aarch64,osx-arm64 and win-64.
posting a draft to get early feedback.

Current Progress

-passing on Ubuntu gcc13.
-passing on Ubuntu clang 17.
-passing on Ubuntu arm64.
-In Windows : facing LAPACK/BLAS linking (path issue) errors.
-In macOS : facing cmake configure fix in macOS.

Key Findings

-cmake 4.x segfaults on osx-arm64 ci runners , pinned to <4.0.
-FindCOIN.cmake uses find_package(BLAS) which needs explicit lib path on windows since conda-forge ships BLAS as blis.lib.

@jpfeuffer

Copy link
Copy Markdown
Contributor

@Ayushj0704

Copy link
Copy Markdown
Author

Thanks , makes sense. I'll replace the find_package(BLAS)/find_package(LAPACK) calls in FindCOIN.cmake with direct find_library() lookups for cblas and lapacke, and drop the BLAS_LIBRARIES/LAPACK_LIBRARIES workflow workaround once that's working. Using the feedstock issue as reference.

@Ayushj0704

Copy link
Copy Markdown
Author

@jpfeuffer I've reverted FindCOIN.cmake to the baseline you asked for. While testing pixi builds I hit a real blocker in the original logic:
What I'm seeing

On Windows + pixi, linking against CoinOR fails with unresolved BLAS symbols (DGETRF/DGETRS from CoinUtils).
Root cause: the BLAS/LAPACK hookup is guarded by if(VCPKG_TOOLCHAIN) in FindCOIN.cmake:135. With pixi we never set VCPKG_TOOLCHAIN, so find_package(BLAS)/find_package(LAPACK) are never called and CoinOR::CoinOR ends up without any BLAS linked.
We do set BLA_VENDOR=FLAME in the workflow, and the pixi env ships BLIS/FLAME, but that has no effect if FindCOIN doesn't call find_package(BLAS) at all.

Minimal fix I'm proposing
Instead of vcpkg-only:

if (VCPKG_TOOLCHAIN)
  find_package(BLAS)
  find_package(LAPACK)
  target_link_libraries(CoinOR::CoinOR INTERFACE BLAS::BLAS LAPACK::LAPACK)
endif()

change it to:

if(VCPKG_TOOLCHAIN OR WIN32)
  find_package(BLAS)
  find_package(LAPACK)
  if(BLAS_FOUND AND LAPACK_FOUND)
    target_link_libraries(CoinOR::CoinOR INTERFACE BLAS::BLAS LAPACK::LAPACK)
  endif()
endif()

This keeps existing vcpkg behavior and additionally covers the pixi/Windows case where BLAS is present via BLIS/FLAME but VCPKG_TOOLCHAIN is not set.
The if(BLAS_FOUND AND LAPACK_FOUND) guard avoids breaking setups where BLAS isn't available.

Are you OK with this minimal extension (VCPKG_TOOLCHAIN OR WIN32), or would you prefer a different way to hook pixi/Windows into the BLAS/LAPACK detection?

@jpfeuffer

Copy link
Copy Markdown
Contributor

If you cannot find a way to detect if it is a coinor library from Conda or a static library in general, then you must add a configuration option to cmake. But you can't just try to find blas everytime you are on Windows. This would obviously break or needlessly complicate other workflows where blas is correctly linked.

# Currently coin-or from vcpkg requires BLAS and LAPACK. For conda-forge/
# pixi builds, BLAS/LAPACK are also needed but VCPKG_TOOLCHAIN is not set,
# so this option allows explicitly opting in from the build configuration.
# TODO: Find a better way to do this. Ideal would be if Coin exports a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding TODO: I definitely agree but COIN does not use CMake yet so they won't be able to easily export a CMake config.
One could add this on top like VCPKG or others, but ideally this should be solved by COIN.
The problem is that they are working on a CMake build system since 5 years or so and they have only very few maintainers.

@jpfeuffer

jpfeuffer commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Why are you looking for FLAME by the way? CoinOR only comes with CBLAS and LAPACKE as dependency.
And I think conda-forge by default uses netlib implementation if you do not specify anything

@Ayushj0704

Ayushj0704 commented Mar 2, 2026 •

Copy link
Copy Markdown
Author

Thanks for pointing that out. Forcing BLA_VENDOR=FLAME didn’t really make sense here, so I’ve dropped that override entirely, cmake now just picks up the netlib BLAS/LAPACK that conda-forge ships.
On the Windows pixi build I still see libCoinUtils.lib referencing the raw Fortran symbols (DGETRF/DGETRS), so I added an opt-in fallback in FindCOIN.cmake: when we enable OPENMS_LINK_COIN_BLAS and LAPACK isn’t detected under the vendor hint, we clear the cache and let cmake retry without it. That pulls in the existing lapack.lib without touching other workflows.
If you’d rather I switch to find_package(CBLAS/LAPACKE) or pass the exact lapack path from CI instead, I can do that
just let me know.

@jpfeuffer

jpfeuffer commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Maybe let's take a step back here. First of all, let's get rid of all occurrences of coinmp whichvis a completely different older package. Then check what the conda solver installs. Which packages, which blas implementation, which coinor. Then check how coinor is installed/built. I think on win it's a static .lib while on macOS/lnx it's a dylib/so. If dynamic, check which dependencies it has and if they are also in the conda prefix. Then post what the find_package cmake call say when you try to find thedependencies with OpenMS. Lastly post what the linker says when linking at the end of the cmake build of openms. Installation and rpaths are the very very last problem.

@Ayushj0704

Copy link
Copy Markdown
Author

Thanks for the guidance. Removing coinmp now and will work through the diagnostic sequence solver output, library type check, find_package results, and linker output before making any further changes. Will report back with findings.

@Ayushj0704

Copy link
Copy Markdown
Author

Hi @jpfeuffer,
Here are the diagnostic results:

  1. coinmp fully removed , git grep -n -i coinmp returns nothing.
  2. Solver output (Windows):

coin-or-cbc 2.10.12, coin-or-utils 2.11.12
libblas 3.11.0 build string _blis , solver chose BLIS, not MKL
liblapack 3.11.0 build string _netlib
MKL also present (mkl 2025.2.0, mkl-devel) from explicit pixi.toml dependency

  1. coin-or on Windows is static:

Library/lib/libCbc.lib exists (6.3MB), Library/lib/libCoinUtils.lib exists
No libCbc.dll or libCoinUtils.dll in Library/bin

  1. DGETRF/DGETRS are UNDEF External in libCoinUtils.lib:

0B5 00000000 UNDEF  notype ()    External     | DGETRF
0B6 00000000 UNDEF  notype ()    External     | DGETRS
0F7 00000000 UNDEF  notype ()    External     | DGETRS
056 00000000 UNDEF  notype ()    External     | DGETRS
098 00000000 UNDEF  notype ()    External     | DGETRF

Uppercase, no underscore , MSVC calling convention. Not in libCbc.lib at all.
5. Available BLAS/LAPACK in pixi env Library/bin:

liblapack.dll (12.8MB) , from netlib lapack package
mkl_rt.2.dll (27.9MB) , from mkl package
libblis.4.dll ,from blis package

  1. Available import libs in Library/lib:

lapack.lib (324KB stub)
mkl_rt.lib (11MB)
blis.lib, libblis.lib

Question: libCoinUtils.lib needs uppercase DGETRF/DGETRS. Which of the three available BLAS/LAPACK libs in the env exports these symbols in the correct convention, and should FindCOIN.cmake explicitly link against it, or should this be handled differently?
I haven't yet run CMake configure to get find_package output , will do that next if helpful, but wanted to share these findings first.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Nice work. Off the top of my head I would say any blas implementation should provide these symbols. You can usually check this with dumpbin (and it's options). If you find that the default (apparently BLIS; I'm surprised) provides them please try to remove all to not have two implementations.
Another way to try if the symbols exist is to just build and link our basic OpenMS library target with CMake.

@Ayushj0704

Copy link
Copy Markdown
Author

as per your suggestions , here is what i have analysed,

  1. Solver output (Windows pixi list):

coin-or-cbc 2.10.12, coin-or-utils 2.11.12
libblas 3.11.0 build string _blis — solver chose BLIS
liblapack 3.11.0 netlib
mkl 2025.2.0, mkl-devel , from explicit pixi.toml dependency

  1. coin-or on Windows is static:
    libCbc.lib and libCoinUtils.lib exist, no DLLs in Library/bin.
  2. find_package(COIN) output from CDash configure log:
    -- Found COIN: D:/a/.../OpenMS/.pixi/envs/default/Library/include
    Only the include directory is reported ,no libraries listed.
  3. dumpbin export check:
libblis.4.dll — no DGETRF/DGETRS exports
liblapack.dll — exports dgetrf_/dgetrs_ only (Fortran underscore convention)
mkl_rt.2.dll — exports uppercase DGETRF and DGETRS (MSVC convention)

libCoinUtils.lib has DGETRF/DGETRS as UNDEF External in uppercase , only MKL matches.
5. Linker error:


libCoinUtils.lib(CoinFactorization4.obj) : error LNK2019: unresolved external symbol DGETRS
libCoinUtils.lib(CoinDenseFactorization.obj) : error LNK2019: unresolved external symbol DGETRF
bin\OpenMS.dll : fatal error LNK1120: 

2 unresolved externals
The root cause is clear: FindCOIN finds headers but does not link any BLAS/LAPACK library, so the linker cannot resolve the MSVC-convention symbols that coin-or-utils needs. Only mkl_rt.lib in the pixi env exports them in the correct convention.
Should FindCOIN.cmake explicitly add mkl_rt.libon Windows, or should this be handled differently?

@jpfeuffer

jpfeuffer commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Yes you obviously need to link to any BLAS implementation. Likely MKL. By the way, I have no idea where BLIS would come from, since for me only MKL shows up as a dependency on windows: https://conda-metadata-app.streamlit.app/?q=conda-forge%2Fwin-64%2Fcoin-or-cbc-2.10.12-h3f959f2_5.conda

I also don't know why you were (or are) trying with different BLAS Vendors, the CMake documentation clearly states that if you do not give a vendor, it will search for ALL vendors: https://cmake.org/cmake/help/latest/module/FindBLAS.html#input-variables

You did not show the output of find_package BLAS. I dont know why you removed the OPENMS_PIXI_BUILD variable that we agreed upon that is important.

@Ayushj0704

Copy link
Copy Markdown
Author

I searched the full git history and the PR thread but cannot find where OPENMS_PIXI_BUILD was introduced or agreed upon ,both git log --grepand git grep return nothing. Could you point me to that discussion so I can restore it correctly? I don't want to guess at the intended behavior and implement it wrong.
On the BLAS vendor question , I'll remove the global blas metapackage from pixi.toml (which is likely why the solver picked BLIS), and restore find_package(BLAS) without any vendor in the OPENMS_LINK_COIN_BLAS guarded block. I'll also add a debug step to capture the full find_package(BLAS) output from CI and share it.

@jpfeuffer

jpfeuffer commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

OPENMS_LINK_COIN_BLAS

Some human cognitive extrapolation would be beneficial.
There is NO OPENMS_LINK_COIN_BLAS guarded block anymore.. you or AI removed it, god knows why.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Please revert the last commit immediately! This is plain wrong! No one said that for other ways of building/installing the all-in-one coinmp package is wrong

@Ayushj0704

Copy link
Copy Markdown
Author

Reverted. Understood , coinmp removal should be scoped only to pixi-related files, not documentation and scripts that cover other build paths. Will reapply only the FindCOIN.cmake and pixi.toml changes without touching coinmp references elsewhere.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Thank you for your efforts but for the sake of reviewers I am closing this until you have a working, non-conflicting solution.
Feel free to reopen when you have something that is 100% working on at least one platform.

@jpfeuffer jpfeuffer closed this Mar 9, 2026
@jpfeuffer

Copy link
Copy Markdown
Contributor

By the way, we already decided that messing with LD_LIBRARY paths will not be tolerated as a solution.

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.

2 participants