Skip to content

Add conda based non-static bdw-gc support during compiler initialization - #695

Open
kc611 wants to merge 1 commit into
spylang:mainfrom
kc611:kc/conda_support
Open

kc611 wants to merge 1 commit into
spylang:mainfrom
kc611:kc/conda_support

Conversation

@kc611

@kc611 kc611 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

When trying to install spy using conda on macOS. I ran into problems with bwd-gc because the path for bwd-gc lives in the conda environment so cc couldn't find gc.h (nor -lgc at link time).

Steps I followed (in spy root directory):

conda create env -n spylang
conda activate spylang
pip install -e .
make -C spy/libspy

Hence I had to use the following fix so that bwd-gc could be detected. If it seems useful please do consider adding this fix to spy.

@antocuni antocuni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank your for investigating this.

So, from what I understand the problem is that libraries installed in a conda env are not automatically visible to the compiler, so we need to pass the right flags to locate it.

That's fine but it seems a more general fix for all conda-managed libraries, so probably we need to do it unconditionally, not only for gc.h.

But now my question is different: why does it work at all in linux then?
It's totally possible that it works by chance on my machine, and it picks up the system-installed libgc.

@paugier

paugier commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Did you try with Pixi (also conda based), which should officially be supported?

Note that we have in pyproject.toml

[tool.pixi.activation.env]
# to be able to link libgc (bdw-gc)
C_INCLUDE_PATH = "$PIXI_PROJECT_ROOT/.pixi/envs/default/include:$C_INCLUDE_PATH"
LIBRARY_PATH = "$PIXI_PROJECT_ROOT/.pixi/envs/default/lib:$LIBRARY_PATH"
# only useful for macOS
DYLD_LIBRARY_PATH = "$PIXI_PROJECT_ROOT/.pixi/envs/default/lib:$DYLD_LIBRARY_PATH"

@antocuni

Copy link
Copy Markdown
Member

(for reference, Kaustubh is an Anaconda colleague and we hit this problem when I was trying to onboard him).

Did you try with Pixi (also conda based), which should officially be supported?

@paugier that was also my first reaction: we test pixi, why it doesn't work?
It turns out that at least on mac, this doesn't seem to work; this happens on both my Mac and @kc611 Mac (using pixi):

❯ spy build -x examples/hello.spy
[debug] examples/build/hello
dyld[77840]: Library not loaded: @rpath/libgc.1.dylib
  Referenced from: <0BAAF8DB-04AA-3A4B-BB13-997425F753F5> /Users/antocuni/anaconda/spy/examples/build/hello
  Reason: no LC_RPATH's found

What I haven't understood is whether this is a mac-specific problem, or it's also a linux problem which for some reason it's not triggered.
Do we test build -x in pixi tests?

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.

3 participants