I'm trying to debug a Python extension that I wrote. In order to enable some memory debugging features I downloaded and built a Python version, which worked just fine. Now I'm trying to build my own package using that environment, but it fails due to the linker not finding the libpython.x.x.a static library.
building 'clusterline.cwsf.parser' extension
gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -DPy_DEBUG -fPIC -I/usr/local/src/python/Python-3.6.8/Include -I/usr/local/src/python/Python-3.6.8 -c clusterline/cwsf/parser.c -o build/temp.linux-x86_64-3.6-pydebug/clusterline/cwsf/parser.o
gcc -pthread -shared build/temp.linux-x86_64-3.6-pydebug/clusterline/cwsf/parser.o -L. -lpython3.6d -o build/lib.linux-x86_64-3.6-pydebug/clusterline/cwsf/parser.cpython-36d-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lpython3.6d
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Note that the library is present. What's missing is a "-L/usr/local/src/python/Python-3.6.8" linker flag. Why isn't it there, and how to get it there?
$ ls /usr/local/src/python/Python-3.6.8/*.a
Maybe I'm just spoilt by Python -- normally everything falls into place when calling /path/to/venv/bin/python, why doesn't that work in this case? I must be missing something essential.
Thou shalt not use ./configure --enable-shared and --with-pydebug at the same time.