Closed mattchan-tencent closed 2 years ago
Do you have a recipe in particular here? Clearly we don't want to avoid dead stripping in general, so I'd like to know why it goes wrong.
Can you also possibly test with conda-forge's macOS compilers too?
Thanks for your help!
Yes, here's the recipe in question. If you uncomment the LDFLAGS export in build.sh then it should work again. (Also, I've short-circuited the build before the install phase to test the binary quicker.)
Same problem, it is fully due to the initialization of anaconda.
@mingwandroid also, sorry it took awhile, but this problem doesn't happen with conda-forge. Their LDFLAGS don't include -dead-strip-dylibs.
I've run across similar behavior with executables using libpython through other libraries here: conda-forge/paraview-feedstock#107. I imagine that something similar is happening here: MKL APIs are being used from a library that does not link to MKL (for whatever reason), then the executable needs to link to it to anchor the MKL APIs somewhere. The linker then notices "no direct MKL usage" and this flag then "helpfully" strips those libraries.
In general, projects are not ready for -dead_strip_dylibs
and without a -no_dead_strip_dylibs
flag, are basically helpless in the face of it (feel free to yell into the void and hope Apple hears you). There should be an easy way to tell Anaconda "this project can't work with it, remove the flag".
Closing due to age.
Has it actually been addressed? I suspect it is still a thing.
TL;DR: Builds on MacOS using mkl fail because the
-dead_strip_dylibs
flag is set by default in LDFLAGS and that causeslibmkl_sequential
,libmkl_core
, etc to get optimized out in the final binary.The following link command:
generates this incorrect DYLIB debug (missing mkl_sequential, mkl_core):
When you remove the
dead_strip_dylibs
you get the correct DYLIB debug:I don't know what the correct long term solution is. Removing that line will eventually run into the MacOS symbol limit.
Additional debug info:
Conda meta.yaml requirements section: