Menu

Building and linking unix python

Help
Jeff Ward
2015-04-25
2015-04-26
  • Jeff Ward

    Jeff Ward - 2015-04-25

    I have a problem linking to python. My Raspberry Pi came loaded with python 3.2.3. PythonQt requires python 3.3 or higher. I downloaded and built python 3.4.3. After building, I'm not sure if I installed properly. Upon linking to python when building PythonQt, GCC reported "cannot find -lpython3.4m". The python include files are in /usr/python3.4.3/include/python3.4m.
    I tweaked python.prf but it had no effect:

    unix:QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes) /usr/python3.4.3/include/python3.4m
    

    I probably should have used a different syntax or set a variable somewhere. What is the proper way to include file?

     
  • Florian Link

    Florian Link - 2015-04-25

    I think you have to make sure that the path to python3.4m.so is in the LD_LIBRARY_PATH, so that the Gcc can find it.

    The python3.4m-config script seems to work, otherwise the Gcc would not complain about not finding python3.4m.

    Alternatively, you could specify the paths directly in python.prf using:

    INCLUDEPATH += yourpythonpath
    LIBS += -lpathtopythonlib

     
  • Jeff Ward

    Jeff Ward - 2015-04-26

    Thank you. As it turns out, I didn't need to tweak python.prf and used the original path settings as-is. Your tip prompted me to look for python3.4m.so which I discovered did not exist. I added the --enable-shared option to python configure and recompiled.
    (See https://github.com/docker-library/python/issues/21)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.