Search code examples
linuxdockerperforcep4python

ImportError: /usr/local/lib/python3.7/site-packages/P4API.cpython-37m-x86_64-linux-gnu.so: undefined symbol: SSL_library_init


**

*File "/usr/local/lib/python3.7/site-packages/P4.py", line 410, in <module>
    import P4API   
ImportError: /usr/local/lib/python3.7/site-packages/P4API.cpython-37m-x86_64-linux-gnu.so: undefined symbol: SSL_library_init*

**

I'm getting the above error while running the docker container and installing p4python for connecting Perforce server. The installation of p4python was failing on Debian images. So i tried CentOS now. In the log says that the package is installed. I've had this problem for a while but i solved it on Windows by finding the correct version of P4API.cpp online and placing it manually.

The log while installing p4python during the docker build says:

*Building wheels for collected packages: p4python, SQLAlchemy, pycparser
  Building wheel for p4python (setup.py): started
  Building wheel for p4python (setup.py): finished with status 'done'*

The perforce forums had a question regarding this recently but no solution. https://forums.perforce.com/index.php?/topic/5933-p4python-undefined-symbol-ssl-library-init/

any suggestions on how to get over this problem?


Solution

  • I download the p4python and extracted with "tar xzf p4python.tgz".

    I think the package wasn't finding the the correct location of the ssl library files i guess. So, included this is in the Dockerfile.

    RUN ln -nfs /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2 /usr/lib/x86_64-linux-gnu/libssl.so
    

    The error got solved. On a related note, what's the easiest way to install p4 client in the docker container while building the image. Thanks in advance.