Comment #9 on issue 442 by
Web...@gmail.com: ImportError. undefined symbol:
prlimit
http://code.google.com/p/psutil/issues/detail?id=442
Hello!
First of all, I am sorry "grep -r prlimit /usr/include/" command output:
/usr/include/asm-generic/unistd.h:#define __NR_prlimit64 261
/usr/include/asm-generic/unistd.h:__SYSCALL(__NR_prlimit64, sys_prlimit64)
/usr/include/asm/unistd_x32.h:#define __NR_prlimit64 (__X32_SYSCALL_BIT +
302)
/usr/include/asm/unistd_64.h:#define __NR_prlimit64 302
/usr/include/asm/unistd_32.h:#define __NR_prlimit64 340
I have made a small research.
I type next commands: (tmp - it is an empty folder)
cd /tmp
wget
http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2
tar jxf ./Python-3.3.0.tar.bz2
cd ./Python-3.3.0
./configure --prefix=/tmp/python
make
make install
/tmp/python/bin/python3.3 and enter: import psutil. It is
output: "ImportError: no module named 'psuitl'"
cd /tmp/python/lib/python3.3/site-packages, than I enter "ls" command.
this command say that this directory contains only README file.
Than I type:
cd /tmp
wget
https://pypi.python.org/packages/source/p/psutil/psutil-1.1.2.tar.gz
tar -zxvf psutil-1.1.2.tar.gz
cd psutil-1.1.2
/tmp/python/bin/python3.3 setup.py install
output:
----------------------------
.................
byte-compiling /tmp/python/lib/python3.3/site-packages/psutil/_compat.py to
_com
pat.cpython-33.pyc
byte-compiling /tmp/python/lib/python3.3/site-packages/psutil/_pssunos.py
to _ps
sunos.cpython-33.pyc
byte-compiling /tmp/python/lib/python3.3/site-packages/psutil/_error.py to
_erro
r.cpython-33.pyc
running install_egg_info
Writing /tmp/python/lib/python3.3/site-packages/psutil-1.1.2-py3.3.egg-info
-----------------------------------
/tmp/python/bin/python3.3 and enter: import psutil
output:
------------------------------------
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./psutil/__init__.py", line 89, in <module>
import psutil._pslinux as _psplatform
File "./psutil/_pslinux.py", line 21, in <module>
import _psutil_linux
ImportError:
/tmp/python/lib/python3.3/site-packages/_psutil_linux.cpython-33m.s
o: undefined symbol: prlimit
-----------------------------------
In the file "/tmp/psutil-1.1.2/psutil/_psutil_linux.c" I changed "#define
HAVE_PRLIMIT defined(PSUTIL_KERN_PRLIMIT) && defined(__NR_prlimit64)"
to "#define HAVE_PRLIMIT 0" and after that all work fine.
---
I have moved "#define HAVE_PRLIMIT defined(PSUTIL_KERN_PRLIMIT) &&
defined(__NR_prlimit64)" at the top of the file (_psutil_linux.c) and it is
still equal true. There are not any "#includes" before this line.
After all of this, I have write small C programm:
#define HAVE_PRLIMIT defined(__NR_prlimit64)
int main(int argc, char *argv[]) {
#if HAVE_PRLIMIT
printf ("yes");
#else
printf ("no");
#endif
return 0;
}
after compilation it is print "no", so I can not understand, why when I
compile psuitl "defined(__NR_prlimit64)" is true (and this causes the
error), but when I complie my test program "defined(__NR_prlimit64)" is
false...