Main index > Usage problems > pystatgrab problem [SOLVED]

By goosie (User), on Sun May 15 17:40:58 2005: pystatgrab problem [SOLVED].

Ok, i got libstatgrab installed... but when i try to run pystatgrab i get errors that wount let it install when i type ./setup.py install... its saying theres problems with _statgrab.c, but ive tried from all the mirrors and it does the same thing... please help...

By syfou (Core Developer & Desklet Author), on Sun May 15 17:47:06 2005.

Could you post the output of ./setup.py install?

By goosie (User), on Mon May 16 16:26:25 2005.

sorry, i ment to do that when i started this thread but i was in a hurry...

Code:


[montez@localhost pystatgrab-0.3]$ ./setup.py install
running install
running build
running build_py
running build_ext
building '_statgrab' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -g -fPIC -I/usr/include/python2.3 -c _statgrab.c -o build/temp.linux-i686-2.3/_statgrab.o
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_set_error':
_statgrab.c:341: error: `sg_error' undeclared (first use in this function)
_statgrab.c:341: error: (Each undeclared identifier is reported only once
_statgrab.c:341: error: for each function it appears in.)
_statgrab.c:341: error: parse error before "__pyx_1"
_statgrab.c:349: error: `__pyx_1' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_set_error_with_errno':
_statgrab.c:370: error: `sg_error' undeclared (first use in this function)
_statgrab.c:370: error: parse error before "__pyx_1"
_statgrab.c:378: error: `__pyx_1' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_error':
_statgrab.c:396: error: `sg_error' undeclared (first use in this function)
_statgrab.c:396: error: parse error before "__pyx_v_s"
_statgrab.c:403: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_error_arg':
_statgrab.c:432: warning: passing arg 1 of `PyString_FromString' makes pointer from integer without a cast
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_str_error':
_statgrab.c:491: error: `sg_error' undeclared (first use in this function)
_statgrab.c:491: error: parse error before "__pyx_1"
_statgrab.c:499: error: `__pyx_1' undeclared (first use in this function)
_statgrab.c:500: warning: passing arg 1 of `PyString_FromString' makes pointer from integer without a cast
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_host_info':
_statgrab.c:532: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_cpu_stats':
_statgrab.c:628: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_cpu_stats_diff':
_statgrab.c:734: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_cpu_percents':
_statgrab.c:839: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_mem_stats':
_statgrab.c:936: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_load_stats':
_statgrab.c:1017: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_user_stats':
_statgrab.c:1092: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_swap_stats':
_statgrab.c:1163: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_fs_stats':
_statgrab.c:1245: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_disk_io_stats':
_statgrab.c:1391: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_disk_io_stats_diff':
_statgrab.c:1512: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_network_io_stats':
_statgrab.c:1638: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_network_io_stats_diff':
_statgrab.c:1789: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_network_iface_stats':
_statgrab.c:1935: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_page_stats':
_statgrab.c:2054: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_page_stats_diff':
_statgrab.c:2124: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_process_stats':
_statgrab.c:2209: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `__pyx_f_9_statgrab_py_sg_get_process_count':
_statgrab.c:2406: error: `__pyx_v_s' undeclared (first use in this function)
_statgrab.c: In function `init_statgrab':
_statgrab.c:2526: error: `SG_ERROR_NONE' undeclared (first use in this function)_statgrab.c:2531: error: `SG_ERROR_ASPRINTF' undeclared (first use in this function)
_statgrab.c:2536: error: `SG_ERROR_DEVSTAT_GETDEVS' undeclared (first use in this function)
_statgrab.c:2541: error: `SG_ERROR_DEVSTAT_SELECTDEVS' undeclared (first use in this function)
_statgrab.c:2546: error: `SG_ERROR_ENOENT' undeclared (first use in this function)
_statgrab.c:2551: error: `SG_ERROR_GETIFADDRS' undeclared (first use in this function)
_statgrab.c:2556: error: `SG_ERROR_GETMNTINFO' undeclared (first use in this function)
_statgrab.c:2561: error: `SG_ERROR_GETPAGESIZE' undeclared (first use in this function)
_statgrab.c:2566: error: `SG_ERROR_KSTAT_DATA_LOOKUP' undeclared (first use in this function)
_statgrab.c:2571: error: `SG_ERROR_KSTAT_LOOKUP' undeclared (first use in this function)
_statgrab.c:2576: error: `SG_ERROR_KSTAT_OPEN' undeclared (first use in this function)
_statgrab.c:2581: error: `SG_ERROR_KSTAT_READ' undeclared (first use in this function)
_statgrab.c:2586: error: `SG_ERROR_KVM_GETSWAPINFO' undeclared (first use in this function)
_statgrab.c:2591: error: `SG_ERROR_KVM_OPENFILES' undeclared (first use in this function)
_statgrab.c:2596: error: `SG_ERROR_MALLOC' undeclared (first use in this function)
_statgrab.c:2601: error: `SG_ERROR_OPEN' undeclared (first use in this function)_statgrab.c:2606: error: `SG_ERROR_OPENDIR' undeclared (first use in this function)
_statgrab.c:2611: error: `SG_ERROR_PARSE' undeclared (first use in this function)
_statgrab.c:2616: error: `SG_ERROR_SETEGID' undeclared (first use in this function)
_statgrab.c:2621: error: `SG_ERROR_SETEUID' undeclared (first use in this function)
_statgrab.c:2626: error: `SG_ERROR_SETMNTENT' undeclared (first use in this function)
_statgrab.c:2631: error: `SG_ERROR_SOCKET' undeclared (first use in this function)
_statgrab.c:2636: error: `SG_ERROR_SWAPCTL' undeclared (first use in this function)
_statgrab.c:2641: error: `SG_ERROR_SYSCONF' undeclared (first use in this function)
_statgrab.c:2646: error: `SG_ERROR_SYSCTL' undeclared (first use in this function)
_statgrab.c:2651: error: `SG_ERROR_SYSCTLBYNAME' undeclared (first use in this function)
_statgrab.c:2656: error: `SG_ERROR_SYSCTLNAMETOMIB' undeclared (first use in this function)
_statgrab.c:2661: error: `SG_ERROR_UNAME' undeclared (first use in this function)
_statgrab.c:2666: error: `SG_ERROR_UNSUPPORTED' undeclared (first use in this function)
_statgrab.c:2671: error: `SG_ERROR_XSW_VER_MISMATCH' undeclared (first use in this function)
_statgrab.c:2676: error: `SG_IFACE_DUPLEX_FULL' undeclared (first use in this function)
_statgrab.c:2681: error: `SG_IFACE_DUPLEX_HALF' undeclared (first use in this function)
_statgrab.c:2686: error: `SG_IFACE_DUPLEX_UNKNOWN' undeclared (first use in this function)
_statgrab.c:2691: error: `SG_PROCESS_STATE_RUNNING' undeclared (first use in this function)
_statgrab.c:2696: error: `SG_PROCESS_STATE_SLEEPING' undeclared (first use in this function)
_statgrab.c:2701: error: `SG_PROCESS_STATE_STOPPED' undeclared (first use in this function)
_statgrab.c:2706: error: `SG_PROCESS_STATE_ZOMBIE' undeclared (first use in this function)
_statgrab.c:2711: error: `SG_PROCESS_STATE_UNKNOWN' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1

By goosie (User), on Mon May 16 16:30:33 2005.

oh yea, it does the exact same thing if i try to do it as root...

By syfou (Core Developer & Desklet Author), on Mon May 16 17:15:19 2005.

For some reasons, your pkg-config libstatgrab detection went wrong. The previous output errors are all related to the compiler not finding the libstatgrab header file statgrab.h. Is this possible your installed libstatgrab improperly for your system-specific needs? For instance, on most linux system, you need to specify the --prefix=/usr flag at configuration time.

By goosie (User), on Mon May 16 17:30:22 2005.

i typed ./configure --prefix=/usr when i was installing it... btw im on Mandrake Linux 10.0 if that helps any

By syfou (Core Developer & Desklet Author), on Mon May 16 18:03:04 2005.

See this?

Code:


_statgrab.c:341: error: `sg_error' undeclared (first use in this function) 


That's the first reference to the libstatgrab api in _statgrab.c from pystatgrab, and it fails, meaning it wasn't found. On libstatgrab 0.11.1, this is defined at an enumeration starting at line 36 from statgrab.h.

Code:


$ find /usr -name 'statgrab.h' -exec grep -H -c sg_error \{\} ';'
/usr/include/statgrab.h:5


If you specified /usr as your $prefixdir, you should find the proper declarations under /usr/include/statgrab.h, and gcc should have no problem to pick it up. Since it does have problem, it could mean a few things:

In all cases, try this:

Code:


gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -g -fPIC -I/usr/include/python2.3 -c _statgrab.c -E | tee out


This is the preprocessor output tailored from what you already posted. Just look at it, and you will probably have your answer, searching for statgrab.h. If you cannot do anything with it, just send it to me by email (syfou@users.sourceforge.net). Do not post it here (at least not entierly), as it is fairly long. :-)

By goosie (User), on Mon May 16 18:18:43 2005.

uuhhh... sorry for sounding dumb, but im (really) new to linux... i tried to type in:

Code:


gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -g -fPIC -I/usr/include/python2.3 -c _statgrab.c -E | tee out 



and it said:

Code:


[root@localhost include]# gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -g -fPIC -I/usr/include/python2.3 -c _statgrab.c -E | tee out
gcc: _statgrab.c: No such file or directory
gcc: no input files
[root@localhost include]#


is there a certain directory i should type it in? im so confused... lol... ill send you my statgrab.h file... i really want adesklets, but this file is driving me up the wall!

By syfou (Core Developer & Desklet Author), on Mon May 16 18:27:17 2005.

The line I gave you is only a partial recompilation of your pystatgrab installment, so it need to be performed from the base directory of pystatgrab. _statgrab.c is part of it. :-)

And I was a bit unclear, sorry: I can do nothing with statgrab.h. I need the out file you will generate.

By goosie (User), on Mon May 16 18:40:35 2005.

ok, i typed it in the pystatgrab-0.3 directory and a TON of stuff came up and its all stuff that i dont understand... im sending you the statgrab.h file (if my e-mail thing ever hurries up and sends it) but it wouldnt let me attach the file so i just put it in the text... whose idea was it to make MY computer the one that has the unexplainable problems?! lol... at least if i ever get it solved, ill hopefully know what is happening. then i can use this whole thing as a learning experience! :D and i'll know how to fix it if it ever happens again...

By goosie (User), on Mon May 16 18:49:56 2005.

ok... my e-mail is being gay and not wanting to send anything so i'm trying to send it to you by clicking the e-mail button under your posts... and of corse, its not working for me... give me this:

Code:


Couldn't get mail server response codes

DEBUG MODE

Line : 200
File : smtp.php



when i try to send you an e-mail... so i guess sending you that file out since no e-mail wants to cooperate with me... :( computers must not like me...

By goosie (User), on Mon May 16 18:54:33 2005.

im doing a make uninstall and ./configure --prefix=/usr (just to make 100% sure i did it) and going to re-install it to make sure that i did it right... hoping this fixes my problem

EDIT:
which it doesnt... :(

By syfou (Core Developer & Desklet Author), on Mon May 16 19:01:18 2005.

As I said, I need the out file, resulting from the command I gave you. I can get no pertinent information from statgrab.h alone.

By goosie (User), on Mon May 16 19:06:54 2005.

oooohhhhh... the out file... i didnt even reolize it made another file... :/ sorry... ill try to e-mail it to you again, maybe my e-mail will stop being gay, or ill just make a new one

EDIT:
Ok, i sent the out file... and got your e-mail... but that is 11:30 in my time zone (unless i messed up in my counting of hours...) and i already know i will probly forget by then (im normally 1/2 way sleep and watching TV by then) but i will try to get on anyways... just letting you know, so if im not on by then, i probly forgot...

By goosie (User), on Tue May 17 18:16:19 2005.

ok, after figuring out you ment the out file, i searched through it for statgrab.h and found it in the document 3 times:

# 1 "/usr/local/include/statgrab.h" 1 3
# 29 "/usr/local/include/statgrab.h" 3
# 76 "/usr/local/include/statgrab.h" 3

sorry, i tried to get on when you said you would be there... but i had went out with some friends and didnt get back until like 4:30 EST this morning...

EDIT:
and the /usr/local/include/statgrab.h file does exist... im looking through the error messages to try and find out what is going on (part of learning linux, i guess)...

By goosie (User), on Tue May 17 18:34:09 2005.

oookkk... i reolized that:
build/temp.linux-i686-2.3/_statgrab.o

didnt exist in the pystatgrab directory, so i copied it from the libstatgrab directory into that... after that, it didnt give errors while installing...

Code:


[montez@localhost pystatgrab-0.3]$ ./setup.py install
running install
running build
running build_py
running build_ext
running install_lib
[montez@localhost pystatgrab-0.3]$



but when trying to run a desklet i get this:

Code:


[montez@localhost torsmotoy-0.0.2]$ ./torsmotoy.py &
[1] 11336
[montez@localhost torsmotoy-0.0.2]$ Traceback (most recent call last):
  File "./torsmotoy.py", line 16, in ?
    import statgrab
  File "/usr/lib/python2.3/site-packages/statgrab.py", line 23, in ?
    import _statgrab
ImportError: dynamic module does not define init function (init_statgrab)
 
[1]+  Exit 1                  ./torsmotoy.py
[montez@localhost torsmotoy-0.0.2]$



which seems to still be a problem with pystatgrab... seems like i fixed 1 problem (i hope i didnt break anything more...) and ended up with a new one...

By syfou (Core Developer & Desklet Author), on Tue May 17 18:40:00 2005, last edited on Tue May 17 23:42:43 2005.

You will notice that the content of your /usr/local/include/statgrab.h (content is happended in the outfile just after the first occurence of the preprocessor inclusion comment you just highlighted) is very different than what it should be. Just try comparing the two. In bash:

Code:


diff -u /usr/{,local}/include/statgrab.h 


[EDIT]
The file you injected has nothing to do with pystatgrab: name match is purely coincidential, due to coding styles, not to content. You could have as well done "touch _statgrab.o", with the same result. What you did is make your setup.py script believe the compilation of _statgrab.c was successfully performed, which it not the case: the _statgrab.o file results from compiling _statgrab.c, and it is perfectly normal it doesn't appear until you successfully compile it.

By goosie (User), on Tue May 17 18:59:05 2005.

ok, after typing that in, i get a lot of code, but this has sg_error in it:

Code:

-#ifndef STATGRAB_H
-#define STATGRAB_H
-
 #include <sys/types.h>
+#ifdef NETBSD
+#include <limits.h>
+#endif
+#ifdef CYGWIN
+#include <sys/unistd.h>
+#endif
  
-/* FIXME typedefs for 32/64-bit types */
-/* FIXME maybe tidy up field names? */
-/* FIXME comments for less obvious fields */
-
-int sg_init(void);
-int sg_drop_privileges(void);
-
-typedef enum {
-       SG_ERROR_NONE = 0,
-       SG_ERROR_ASPRINTF,
-       SG_ERROR_DEVSTAT_GETDEVS,
-       SG_ERROR_DEVSTAT_SELECTDEVS,
-       SG_ERROR_ENOENT,
-       SG_ERROR_GETIFADDRS,
-       SG_ERROR_GETMNTINFO,
-       SG_ERROR_GETPAGESIZE,
-       SG_ERROR_KSTAT_DATA_LOOKUP,
-       SG_ERROR_KSTAT_LOOKUP,
-       SG_ERROR_KSTAT_OPEN,
-       SG_ERROR_KSTAT_READ,
-       SG_ERROR_KVM_GETSWAPINFO,
-       SG_ERROR_KVM_OPENFILES,
-       SG_ERROR_MALLOC,
-       SG_ERROR_OPEN,
-       SG_ERROR_OPENDIR,
-       SG_ERROR_PARSE,
-       SG_ERROR_SETEGID,
-       SG_ERROR_SETEUID,
-       SG_ERROR_SETMNTENT,
-       SG_ERROR_SOCKET,
-       SG_ERROR_SWAPCTL,
-       SG_ERROR_SYSCONF,
-       SG_ERROR_SYSCTL,
-       SG_ERROR_SYSCTLBYNAME,
-       SG_ERROR_SYSCTLNAMETOMIB,
-       SG_ERROR_UNAME,
-       SG_ERROR_UNSUPPORTED,
-       SG_ERROR_XSW_VER_MISMATCH,
-       SG_ERROR_PSTAT
-} sg_error;
-


so i tried to change the file you said but havent the slightest of an idea how to change to use the new one... it said version 0.8 under version so i did have another version installed... so i guess i was retarded in trying to copy the files too, +1 for the books of things not to do... is there a way to just uninstall both libstatgrab and pystatgrab and start over with the right versions? im guessing that will fix the problem and that having version 0.8 installed is what caused it in the first place... and it it doesnt, id be back to were i am now...

EDIT:
Ok, a make uninstall in the libstatgrab directory uninstalls it (as it appears...) so im downloading version 0.8 as well so that i can do a make uninstall and get that uninstalled too... but i still uninstallaion of pystatgrab

By goosie (User), on Tue May 17 19:20:50 2005.

YAY!!!

Code:


[root@localhost pystatgrab-0.3]# ./setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.3
copying statgrab.py -> build/lib.linux-i686-2.3
running build_ext
building '_statgrab' extension
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -g -fPIC -I/usr/include/python2.3 -c _statgrab.c -o build/temp.linux-i686-2.3/_statgrab.o
gcc -pthread -shared build/temp.linux-i686-2.3/_statgrab.o -o build/lib.linux-i686-2.3/_statgrab.so -lstatgrab
running install_lib
copying build/lib.linux-i686-2.3/_statgrab.so -> /usr/lib/python2.3/site-packages
[root@localhost pystatgrab-0.3]#



im taking the no errors as a good thing... i uninstalled both libstatgrab that were installed, and then removed the entire pystatgrab file and re-un-tar-ed it (dunno what its called) and then ran ./setup.py install and that happened... now im happing problems with torsmotoy tho, but i guess thats not for this thread so ill go there and see if anyone else has this problem and if anyone posted a fix! Thanks a ton and a half + 3/4 for the help! lol


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.