Skip to content

Compiling python dependencies with rosetta is really hard #1603

Open
@dwt

Description

Describe the bug
Compiling python dependencies with rosetta is really hard

It requires:

  • Defining rosetta-pkgs to use all over the devenv.nix
  • Add rosetta versions of dependencies to packages
  • changing the stdenv to the rosetta version to get working compilers
  • Defining an environment variable export DYLD_FALLBACK_LIBRARY_PATH="${rosettaPkgs.lib.makeLibraryPath [ rosettaPkgs.gcc14.cc] }:$DYLD_FALLBACK_LIBRARY_PATH" to resolve symbols like __ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm

This is surprisingly non simple and not very well documented.

I am toying with the idea that documentation not too dissimilar to this might have helped me:

https://gist.github.com/dwt/997fe87c453f9a23fa3368c7d974ce7b

But I also don't quite like the example, because this should be simpler? So probably I am missing something major?

To reproduce
https://gist.github.com/dwt/f8e1de5e9be77ce2d7f3219741beaf43

Detailed logs
❯ devenv shell
• Building shell ...
• Using Cachix: devenv
building '/nix/store/n8vv6vjc5pam6i228xxsdlsgka6n5x7p-devenv-shell-env.drv'
✔ Building shell in 16.7s.
• Entering shell
Running tasks     devenv:enterShell
Succeeded         devenv:python:virtualenv 377ms
Succeeded         devenv:enterShell        167ms
2 Succeeded                                546.06ms

Collecting ibm_db_sa (from -r requirements.txt (line 1))
  Using cached ibm_db_sa-0.4.1-py3-none-any.whl.metadata (5.3 kB)
Collecting pymssql (from -r requirements.txt (line 2))
  Using cached pymssql-2.3.2-cp312-cp312-macosx_13_0_universal2.whl.metadata (4.7 kB)
Collecting sqlalchemy>=0.7.3 (from ibm_db_sa->-r requirements.txt (line 1))
  Using cached SQLAlchemy-2.0.36-cp312-cp312-macosx_10_13_x86_64.whl.metadata (9.7 kB)
Collecting ibm-db>=2.0.0 (from ibm_db_sa->-r requirements.txt (line 1))
  Using cached ibm_db-3.2.3-cp312-cp312-macosx_10_15_x86_64.whl.metadata (1.4 kB)
Collecting typing-extensions>=4.6.0 (from sqlalchemy>=0.7.3->ibm_db_sa->-r requirements.txt (line 1))
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting greenlet!=0.4.17 (from sqlalchemy>=0.7.3->ibm_db_sa->-r requirements.txt (line 1))
  Using cached greenlet-3.1.1-cp312-cp312-macosx_11_0_universal2.whl.metadata (3.8 kB)
Using cached ibm_db_sa-0.4.1-py3-none-any.whl (31 kB)
Using cached pymssql-2.3.2-cp312-cp312-macosx_13_0_universal2.whl (3.0 MB)
Using cached ibm_db-3.2.3-cp312-cp312-macosx_10_15_x86_64.whl (24.0 MB)
Using cached SQLAlchemy-2.0.36-cp312-cp312-macosx_10_13_x86_64.whl (2.1 MB)
Using cached greenlet-3.1.1-cp312-cp312-macosx_11_0_universal2.whl (274 kB)
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Installing collected packages: pymssql, ibm-db, typing-extensions, greenlet, sqlalchemy, ibm_db_sa
Successfully installed greenlet-3.1.1 ibm-db-3.2.3 ibm_db_sa-0.4.1 pymssql-2.3.2 sqlalchemy-2.0.36 typing-extensions-4.12.2

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
++ type python
python is /Users/dwt/Code/Projekte/nix/devenv-reproduction/venv/bin/python
++ python --version
Python 3.12.7
++ python -c 'import ibm_db'
++ python -c 'import pymssql'
testing x86 compile
Obtaining file:///Users/dwt/Code/Projekte/nix/devenv-reproduction/pymssql
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: pymssql
  Building editable for pymssql (pyproject.toml) ... done
  Created wheel for pymssql: filename=pymssql-2.3.2.dev3-0.editable-cp312-cp312-macosx_10_12_x86_64.whl size=13615 sha256=fcf1ab43ca4f2d91b052d9b63130f6c396e455675e60a7b158c32457ca4e0c67
  Stored in directory: /private/tmp/nix-shell.vL2dIB/pip-ephem-wheel-cache-ek_8hy_d/wheels/ce/19/95/edf0e96a03cc462dfa4aa4e342bccdb376ea4ad475a25073c2
Successfully built pymssql
Installing collected packages: pymssql
  Attempting uninstall: pymssql
    Found existing installation: pymssql 2.3.2
    Uninstalling pymssql-2.3.2:
      Successfully uninstalled pymssql-2.3.2
Successfully installed pymssql-2.3.2.dev3

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
++ type python
python is /Users/dwt/Code/Projekte/nix/devenv-reproduction/venv/bin/python
++ python --version
Python 3.12.7
++ python -c 'import ibm_db'
++ python -c 'import pymssql'

Version

❯ devenv version
devenv 1.3.1 (aarch64-darwin)

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions