I am trying to create a conda package that includes c code that have to compile with -lz. However, when the package is building, ld cannot find zlib even though I provide it with any paths possible.
As I understand, conda creates almost empty environment, and then fills it with necessary libraries and tools. It also installs zlib, so that there is zlib.h in $BUILD_PREFIX/include/ and libz.so, libz.a in $BUILD_PREFIX/lib.
Compilation itself looks like
$BUILD_PREFIX/bin/x86_64-conda_cos6-linux-gnu-cc -fPIC -g -Wall -O2 -Wc++-compat main.o -o <name> -L. -l<name> -lm -lz -lpthread
x86_64-conda_cos6-linux-gnu-cc is gcc version 7.3.0, and it calls ld defined here as $BUILD_PREFIX/bin/x86_64-conda_cos6-linux-gnu-ld. Then ld falls with an error cannot find -lz.
I tried using
export C_INCLUDE_PATH="$BUILD_PREFIX/include"
export LIBRARY_PATH="$BUILD_PREFIX/lib"
export LD_LIBRARY_PATH="$BUILD_PREFIX/lib"
export LD_PRELOAD="$BUILD_PREFIX/lib/libz.so"
in any combinations, but that did not work.
Are there any other ways to show ld path to the library?