Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbol TLSv1 with python+perforce

I installed the p4 library on my local archlinux machine and everything works smoothly. I was now trying to do the same on a couple of virtual machines (with same OS also 64 bits) but can't get it running...

The installation goes well and doesn't complain, but when I try to import it I get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "P4.py", line 312, in <module>
    import P4API
ImportError: /usr/lib/python2.7/site-packages/P4API.so: undefined symbol: TLSv1_method

If I look in the symbols with nm -A /usr/lib/python2.7/site-packages/P4API.so

I can see that in fact all the SSL-related symbols are undefined (while being defined on the working one), but why on earth? I have openssl installed and Python is installed in exactly the same way, I can't find any other library that should be useful.

Any idea?

EDIT: apparently the only difference is that in the wrong installation of P4 P4API.so is missing librt from the "ldd" output (and librt is actually there). Not sure how it would relate to the TLS problem, and trying to reinstall glibc and then p4python but no luck still..

like image 439
andrea_crotti Avatar asked Jun 23 '26 23:06

andrea_crotti


1 Answers

Rebuilding the P4Python against the "rt" and "ssl" libraries fixes this.

  1. Take the P4 API off the perforce site (e.g. for Linux take this: http://filehost.perforce.com/perforce/r13.2/bin.linux26x86_64/p4api.tgz)
  2. Take the source code of P4Python off http://public.perforce.com/guest/robert_cowham/perforce/API/python/main/p4python.zip
  3. tar xf the P4 API archive
  4. Unzip the p4pthon archive
  5. Edit setup.cfg to point to the P4API directory
  6. Edit setup.py and go to line 120 and add "ssl" and "rt" so it looks like this

    else: # Assume Linux
        libraries = ["client", "rpc", "supp", "ssl", "rt"]    # P4API libs
        extra_compile_args = ["-DOS_LINUX", "-D%s" % p4_api_ver]
    
  7. Do sudo python setup.py install

like image 100
user2586600 Avatar answered Jun 25 '26 11:06

user2586600



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!