Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22162

A "how is it finding libpython?!" puzzle

$
0
0

I'm trying to get a semi-abandoned python scientific computing package written for python 2 to compile against python 3. My problem has to do with the linker not being able to find libpython. It's obvious why it can't find libpython from the g++ command line; what I don't get is why it works in the python 2.7 case and not in the python 3.6 case.

This works:

g++ -pthread -shared -fopenmp src/matrix/Matrix.o src/matrix/Statistics.o -L/usr/lib/python2.7/dist-packages -lpython2.7 -o condensedMatrix.so

This doesn't work:

g++ -pthread -shared -fopenmp src/matrix/Matrix.o src/matrix/Statistics.o -L/usr/lib/python3/dist-packages -lpython3.6 -o condensedMatrix.so/usr/bin/x86_64-linux-gnu-ld: cannot find -lpython3.6

Neither should work because the respective paths to libpython:

-L/usr/lib/python2.7/dist-packages-L/usr/lib/python3/dist-packages

are both incorrect: This is an Ubuntu 18.04 system, so the libraries in question can be found here:

/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so

In the python 2.7 case, which compiles, I don't have an LD_LIBRARY_PATH set; however setting LD_LIBRARY_PATH to point to the correct location for libpython3.6.so doesn't help.

The build system used here is build.py. I'm trying to figure out where it's getting the -L/usr/lib/python*/dist-packages directive in the g++ compile line, but meanwhile the real mystery is why the python 2.7 case compiles.

Anyone know what's going on here?


Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>