Jump to content


P4API Import Error - Undefined Symbol

p4api

  • Please log in to reply
8 replies to this topic

#1 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 18 October 2013 - 05:03 PM

I've installed P4Python on RHEL5 and there didn't seem to be any problems with the install.  However, when I launch Python2.7 and attempt to import either P4 or P4API, I receive the following error:

    ImportError: /usr/lib64/python2.7/site-packages/P4API.so: undefined symbol: _ZNSo9_M_insertI1EERSoT_

I've tried running python with LD_DEBUG=libs and it seems to find all of the libraries it's looking for.  It's not clear to me what library might be missing.

(I installed P4Python via "easy_install P4PythonInstaller").

Any ideas what it might be missing or how to fix this issue?  Thanks in advance!

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 18 October 2013 - 05:56 PM

I suspect easy_install has an old version with an incompatible libc. I generally build P4Python from source to make sure it will behave properly. I'd be happy to help you with that process.

#3 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 18 October 2013 - 06:49 PM

If you wouldn't mind a quick walk-through of the process I'd appreciate it!  I don't have a ton of experience with Linux let alone building modules from source.  I imagine I'll need P4Python and P4API source to start, but where do I go for those and which version(s) should I get?

Thanks!

#4 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 19 October 2013 - 06:21 PM

Trying to figure this out on my own, I found and followed the P4Python release notes.  Since I couldn't find P4API source for RHEL5, I downloaded the bin.linux26x86_64 version.  I built and installed P4Python using the following set of commands:

cd ~
wget http://filehost.perf...ls/p4python.tgz
wget ftp://ftp.perforce.com/perforce/r12.1/bin.linux26x86_64/p4api.tgz
tar zxvf p4python.tgz   # unpacks into p4python-2012.1.511074
tar zxvf p4api.tgz   # unpacks into p4api-2012.1.442152
cd p4python-2012.1.511074
python2.7 setup.py build --apidir /home/user/p4api-2012.1.442152
sudo python2.7 setup.py install --apidir /home/user/p4api-2012.1.442152

This built the source without errors and installed to:

/usr/lib64/python2.7/site-packages/p4python-2012.1.511074-py2.7.egg-info

However, when I launch python2.7 and attempt to import P4API, I still get the following result:

ImportError: /usr/lib64/python2.7/site-packages/P4API.so: undefined symbol: _ZNSo9_M_insertI1EERSoT_

I verified that the P4API.so has the correct timestamp, so it was the one built in the above steps.

Any thoughts as to what might be going wrong, or what I might be missing?  Thanks!

#5 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 21 October 2013 - 05:15 AM

A little bit more information, in case it helps.  When I run ldd P4API.so, this is the result:

librt.so.1 => /lib64/librt.so.1 (0x00002b09f166a000)
libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00002b09f1873000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b09f1c36000)
libm.so.6 => /lib64/libm.so.6 (0x00002b09f1f37000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b09f21ba000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b09f23c8000)
libc.so.6 => /lib64/libc.so.6 (0x00002b09f25e5000)
/lib64/ld-linux-x86-64.so.2 (0x00002b09f10c0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b09f293d000)
libutil.so.1 => /lib64/libutil.so.1 (0x00002b09f2b41000)

#6 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 22 October 2013 - 05:47 AM

Sorry for vanishing there. That all seems very reasonable. What exact version is your RHEL 5 box? I probably need to spin up my own to poke through the problem.

#7 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 22 October 2013 - 02:40 PM

It's release 5.3 (Tikanga).  Hopefully you'll be able to repro the problem.

I'm curious what library "insert" is supposed to be in.  Since it's only that one symbol, it doesn't seem like it would be a compiler version problem (though it seems to be using gcc44 if that's any help).  I'm curious what library the symbol should be found in, but I haven't been able to track that information down yet.

Thanks again for any help!

#8 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 22 October 2013 - 02:57 PM

Also not sure if it will help, but the output I get from building P4Python is as follows:

API Release 2012.1
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying P4.py -> build/lib.linux-x86_64-2.7
running build_ext
building 'P4API' extension
creating build/temp.linux-x86_64-2.7
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c P4API.cpp -o build/temp.linux-x86_64-2.7/P4API.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonClientAPI.cpp -o build/temp.linux-x86_64-2.7/PythonClientAPI.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonClientUser.cpp -o build/temp.linux-x86_64-2.7/PythonClientUser.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c SpecMgr.cpp -o build/temp.linux-x86_64-2.7/SpecMgr.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c P4Result.cpp -o build/temp.linux-x86_64-2.7/P4Result.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonMergeData.cpp -o build/temp.linux-x86_64-2.7/PythonMergeData.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c P4MapMaker.cpp -o build/temp.linux-x86_64-2.7/P4MapMaker.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonSpecData.cpp -o build/temp.linux-x86_64-2.7/PythonSpecData.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonMessage.cpp -o build/temp.linux-x86_64-2.7/PythonMessage.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
gcc44 -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -I/usr/include/expat2 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DID_OS="LINUX26X86_64" -DID_REL="2012.1" -DID_PATCH="511074" -DID_API="2012.1/442152" -DID_Y="2012" -DID_M="08" -DID_D="15" -I/home/bbbrooks/p4python_test/p4api-2012.1.442152 -I/home/bbbrooks/p4python_test/p4api-2012.1.442152/include/p4 -I/usr/include/python2.7 -c PythonActionMergeData.cpp -o build/temp.linux-x86_64-2.7/PythonActionMergeData.o -DOS_LINUX -DOS_LINUX26 -DOS_LINUXX86_64 -DOS_LINUX26X86_64
c++ -pthread -shared -L/usr/kerberos/lib64 -L/usr/lib64/expat2 build/temp.linux-x86_64-2.7/P4API.o build/temp.linux-x86_64-2.7/PythonClientAPI.o build/temp.linux-x86_64-2.7/PythonClientUser.o build/temp.linux-x86_64-2.7/SpecMgr.o build/temp.linux-x86_64-2.7/P4Result.o build/temp.linux-x86_64-2.7/PythonMergeData.o build/temp.linux-x86_64-2.7/P4MapMaker.o build/temp.linux-x86_64-2.7/PythonSpecData.o build/temp.linux-x86_64-2.7/PythonMessage.o build/temp.linux-x86_64-2.7/PythonActionMergeData.o -L/home/bbbrooks/p4python_test/p4api-2012.1.442152 -L/home/bbbrooks/p4python_test/p4api-2012.1.442152/lib -L/usr/lib64 -lclient -lrpc -lsupp -lp4sslstub -lrt -lpython2.7 -o build/lib.linux-x86_64-2.7/P4API.so


#9 wdbdesign

wdbdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 04 November 2013 - 06:24 PM

A quick update for anyone who runs into this problem in the future...

I was never able to solve the problem itself, but I was able to narrow it down to the python27-devel package.  I installed python26 and python26-devel, and was able to successfully build and use P4Python using Python 2.6.





Also tagged with one or more of these keywords: p4api

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users