Server Help

ASSS Questions - Loading pymod

Anonymous - Fri Jan 02, 2009 3:42 pm
Post subject: Loading pymod
I downloaded the precompiled ASSS for Linux and it runs just fine in Ubuntu. However, I am unable to load pymod in order to use modules like fg_wz. When I try to load in pymod when I start ASSS, I get this message:

Code: Show/Hide
I <cmod> loading C module 'pymod' from 'pymod'
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
ImportError: No module named cPickle
D <net> listening on 0.0.0.0:5000 (0)
E <pymod> can't import cPickle


What's going wrong here? Do I need to give ASSS a different directory for my Python installation?
Anonymous - Fri Jan 02, 2009 4:01 pm
Post subject:
I just now installed python2.4 and pymod loads in. However, I can't get fg_wz to load:

Code: Show/Hide
ImportError: /usr/lib/python2.4/lib-dynload/cPickle.so: wrong ELF class: ELFCLASS64
I <pymod> loading python module 'fg_wz'
E <pymod> error loading python module 'fg_wz'
Traceback (most recent call last):
  File "/home/levi/Downloads/asss-1.4.4/bin/fg_wz.py", line 4, in ?
    import math
ImportError: /usr/lib/python2.4/lib-dynload/math.so: wrong ELF class: ELFCLASS64
Unrecoverable error (5): Error in loading module '<py> fg_wz'


Is anyone familiar with this error? Does this mean that there is a conflict between the 32-bit ASSS binary and my 64-bit Ubuntu/Python installation?
Bak - Fri Jan 02, 2009 6:24 pm
Post subject:
sounds like it. can you get a 32-bit python installation?
Dr Brain - Fri Jan 02, 2009 9:55 pm
Post subject:
Yeah, I'd say try and get a 32-bit python. Compiling asss to 64-bit would be the other option.
Anonymous - Fri Jan 02, 2009 11:31 pm
Post subject:
I've done what I can to get 32-bit Python 2.4, but I'm not sure if I'm doing it right. What I've done is installed the 32-bit packages python2.4-minimal and python2.4 with dpkg --force-all and then used getlibs (as described here), but my error has only changed to:

Code: Show/Hide
E <pymod> error loading python module 'fg_wz'
Traceback (most recent call last):
  File "/home/levi/Downloads/asss-1.4.4/bin/fg_wz.py", line 4, in ?
    import math
ImportError: /usr/lib/python2.4/lib-dynload/math.so: undefined symbol: PyFPE_jbuf
Unrecoverable error (5): Error in loading module '<py> fg_wz'


It looks like an improvement on the old error message, but it obviously isn't working properly. Is someone more familiar with installing 32-bit packages on 64-bit Ubuntu?
Anonymous - Sun Jan 04, 2009 3:26 pm
Post subject:
I also tried to compile a 64-bit ASSS, and I've had some success, but I'm getting stuck on the lack of a 64-bit security.so. Does anyone know where I can find one?
Bak - Sun Jan 04, 2009 4:25 pm
Post subject:
send an e-mail to grelminar. he's more accessible than you'd think

for testing just comment out enc_cont in modules.conf and replace it with enc_null to disable encryption
Dr Brain - Sun Jan 04, 2009 8:19 pm
Post subject:
I just started working on converting asss to 64-bit. There are some issues with type sizes. A lot of modules use "unsigned long" for no apparent reason. Maybe grel was worried about systems where an int is 2 bytes?
Dr Brain - Sun Jan 04, 2009 10:08 pm
Post subject:
I've got things compiling, but there are some issues with stack corruption that I'm still investigating.
Dr Brain - Mon Jan 05, 2009 10:34 pm
Post subject:
The 64-bit problems run deep. I've made it a personal project to port asss to amd64, but you're better off looking into the 32-bit python stuff for now.
Dr Brain - Tue Jan 06, 2009 5:15 pm
Post subject:
I'm including the my preliminary changes to make asss run and log players in. I haven't exhaustively tested the system. I'd wager there are a few more bugs lurking around, and would appreciate any feedback. I've also attached a 64-bit security.so.

Clientset has some code that needs updating:

Code: Show/Hide

--- src/core/clientset.c   2ad6f3ce5cb2ba50fd737032e5ae23d1684a804c
+++ src/core/clientset.c   9a5e4bd79825c76d979f5131cbeea90fdf53be0d
@@ -389,22 +389,22 @@ local void do_mask(
      overridedata *od2)
{
   int i;
-   unsigned long *s = (unsigned long*)src;
-   unsigned long *d = (unsigned long*)dest;
-   unsigned long *o1 = (unsigned long*)od1->bits;
-   unsigned long *m1 = (unsigned long*)od1->mask;
+   unsigned int *s = (unsigned int*)src;
+   unsigned int *d = (unsigned int*)dest;
+   unsigned int *o1 = (unsigned int*)od1->bits;
+   unsigned int *m1 = (unsigned int*)od1->mask;

   if (od2)
   {
-      unsigned long *o2 = (unsigned long*)od2->bits;
-      unsigned long *m2 = (unsigned long*)od2->mask;
+      unsigned int *o2 = (unsigned int*)od2->bits;
+      unsigned int *m2 = (unsigned int*)od2->mask;

-      for (i = 0; i < sizeof(*dest)/sizeof(unsigned long); i++)
+      for (i = 0; i < sizeof(*dest)/sizeof(unsigned int); i++)
         d[i] = (((s[i] & ~m1[i]) | (o1[i] & m1[i])) & ~m2[i]) | (o2[i] & m2[i]);
   }
   else
   {
-      for (i = 0; i < sizeof(*dest)/sizeof(unsigned long); i++)
+      for (i = 0; i < sizeof(*dest)/sizeof(unsigned int); i++)
         d[i] = (s[i] & ~m1[i]) | (o1[i] & m1[i]);
   }
}
@@ -562,7 +562,7 @@ EXPORT int MM_clientset(int action, Imod
      /* do these at least once */
#define cs (*((struct ClientSettings*)0))
#define ss (*((struct ShipSettings*)0))
-      assert((sizeof(cs) % sizeof(unsigned long)) == 0);
+      assert((sizeof(cs) % sizeof(uint32_t)) == 0);
      assert(COUNT(cs.long_set) == COUNT(long_names));
      assert(COUNT(cs.short_set) == COUNT(short_names));
      assert(COUNT(cs.byte_set) == COUNT(byte_names));


Net has some structs that it checks for size. I'm not sure why, but it's easy to fix:

Code: Show/Hide

--- src/include/net.h   2519ebab5906c86db40186b3053ded968e904ec4
+++ src/include/net.h   40bb87f50a61ba404a94ce879367f00a54334f2e
@@ -55,13 +55,13 @@ struct net_stats

struct net_stats
{
-   unsigned long pcountpings, pktsent, pktrecvd;
-   unsigned long bytesent, byterecvd;
-   unsigned long buffercount, buffersused;
+   unsigned int pcountpings, pktsent, pktrecvd;
+   unsigned int bytesent, byterecvd;
+   unsigned int buffercount, buffersused;
#define NET_GROUPED_STATS_LEN 8
-   unsigned long grouped_stats[NET_GROUPED_STATS_LEN];
+   unsigned int grouped_stats[NET_GROUPED_STATS_LEN];
#define NET_PRI_STATS_LEN 5 /* must match BW_PRIS in bwlimit.h */
-   unsigned long pri_stats[NET_PRI_STATS_LEN];
+   unsigned int pri_stats[NET_PRI_STATS_LEN];
   byte reserved[176];
};

@@ -70,9 +70,9 @@ struct net_client_stats
   /* sequence numbers */
   i32 s2cn, c2sn;
   /* counts of stuff sent and recvd */
-   unsigned long pktsent, pktrecvd, bytesent, byterecvd;
+   unsigned int pktsent, pktrecvd, bytesent, byterecvd;
   /* count of s2c packets dropped */
-   unsigned long pktdropped;
+   unsigned int pktdropped;
   unsigned int unused1;
   /* encryption type */
   const char *encname;


rwlock.c needs to include asss.h for the #pragma pack(1) directive, otherwise some of the structs end up as a different size! This one took me a while to track down...

Code: Show/Hide

--- src/main/rwlock.c   172c3d5dcb2a2be709a77a1d990a044ba18f10b2
+++ src/main/rwlock.c   7199409e35ccd910fad5ac45da1b4c82bbdb82b8
@@ -29,6 +29,8 @@
  * for write access can also lock it for read access any number of
  * times; again it must be unlocked the same number.
  */
+#include "asss.h"
+
#include "pthread.h"
#include "errno.h"

Grelminar - Wed Jan 07, 2009 9:31 am
Post subject:
Be really careful with that pragma pack(1). You should never do that before including system headers, or it could affect the alignment of system structs, which would break a lot of things. All system headers should always come before all asss headers.

pragma pack(1) is evil and I should have never used it. Replacing it with something more sane would be a big effort, though.
Dr Brain - Wed Jan 07, 2009 10:41 am
Post subject:
It's only needed on the packet structs, correct? If so, you could just pragma pack(1) at the top of packets.h, then at the end add a pragma pack(4) or (16), depending on the arch.
Bak - Wed Jan 07, 2009 4:41 pm
Post subject:
you can use pragma pack push and pragma pack pop yeah

http://forums.minegoboom.com/viewtopic.php?t=6508
cmdrpinksock - Wed Jan 07, 2009 8:01 pm
Post subject: Re: Loading pymod
Simulacrum wrote:
I downloaded the precompiled ASSS for Linux and it runs just fine in Ubuntu. However, I am unable to load pymod in order to use modules like fg_wz. When I try to load in pymod when I start ASSS, I get this message:

Code: Show/Hide
I <cmod> loading C module 'pymod' from 'pymod'
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named os
ImportError: No module named cPickle
D <net> listening on 0.0.0.0:5000 (0)
E <pymod> can't import cPickle


What's going wrong here? Do I need to give ASSS a different directory for my Python installation?


Ok, I am having the same problem here and the same original question. The box I have my server running on has 2.5 installed so it does not load. SO, I try to recompile pymod and get: "make: *** No targets. Stop.", when I "make -f pymod.mk"

Do I need to define where python2.5 is in the make file? (/usr/lib/python.mk, or something), and how do i do that? Not understanding why I am getting this error...

I can not do the same thing as Simulacrum and just down grade to 2.4, not my box...

Thanks
Dr Brain - Wed Jan 07, 2009 9:39 pm
Post subject:
That's not the correct command. I think you want "make ../build/pymod.so" instead. Running "make clean" before hand might also be helpful to ensure a complete rebuild, if that's what you're trying to do. The file system.mk has settings for where python is installed.
cmdrpinksock - Wed Jan 07, 2009 9:41 pm
Post subject:
All of this from the /src dir?
cmdrpinksock - Wed Jan 07, 2009 9:43 pm
Post subject: make ../build/pymod.so
Here is the result of that command:


scorch@sylvia:~/asss-1.4.4/src$ make ../build/pymod.so
funky/funk1.mk:171: warning: overriding commands for target `install'
drone/drone.mk:171: warning: ignoring old commands for target `install'
funky/funk1.mk:175: warning: overriding commands for target `clean'
drone/drone.mk:175: warning: ignoring old commands for target `clean'
funky/funky.mk:5: warning: overriding commands for target `../build/funky.so'
funky/funk.mk:5: warning: ignoring old commands for target `../build/funky.so'
funky/funky.mk:9: warning: overriding commands for target `../build/letters.inc'
funky/funk.mk:9: warning: ignoring old commands for target `../build/letters.inc'
kothb/autoturret.mk:171: warning: overriding commands for target `install'
funky/funk1.mk:171: warning: ignoring old commands for target `install'
kothb/autoturret.mk:175: warning: overriding commands for target `clean'
funky/funk1.mk:175: warning: ignoring old commands for target `clean'
kothb/fm_shiplimits.mk:171: warning: overriding commands for target `install'
kothb/autoturret.mk:171: warning: ignoring old commands for target `install'
kothb/fm_shiplimits.mk:175: warning: overriding commands for target `clean'
kothb/autoturret.mk:175: warning: ignoring old commands for target `clean'
kothb/kothb.mk:171: warning: overriding commands for target `install'
kothb/fm_shiplimits.mk:171: warning: ignoring old commands for target `install'
kothb/kothb.mk:175: warning: overriding commands for target `clean'
kothb/fm_shiplimits.mk:175: warning: ignoring old commands for target `clean'
kothb/koth.mk:171: warning: overriding commands for target `install'
kothb/kothb.mk:171: warning: ignoring old commands for target `install'
kothb/koth.mk:175: warning: overriding commands for target `clean'
kothb/kothb.mk:175: warning: ignoring old commands for target `clean'
koth/koth.mk:171: warning: overriding commands for target `install'
kothb/koth.mk:171: warning: ignoring old commands for target `install'
koth/koth.mk:175: warning: overriding commands for target `clean'
kothb/koth.mk:175: warning: ignoring old commands for target `clean'
moveto/moveto.mk:171: warning: overriding commands for target `install'
koth/koth.mk:171: warning: ignoring old commands for target `install'
moveto/moveto.mk:175: warning: overriding commands for target `clean'
koth/koth.mk:175: warning: ignoring old commands for target `clean'
regiont/rt.mk:171: warning: overriding commands for target `install'
moveto/moveto.mk:171: warning: ignoring old commands for target `install'
regiont/rt.mk:175: warning: overriding commands for target `clean'
moveto/moveto.mk:175: warning: ignoring old commands for target `clean'
Makefile:93: warning: overriding commands for target `clean'
regiont/rt.mk:175: warning: ignoring old commands for target `clean'
Makefile:110: ../build/deps.mk: No such file or directory
python ../scripts/makedeps.py -I. -D_REENTRANT -D_GNU_SOURCE -fPIC -I/usr/local/BerkeleyDB.4.2/include -I/usr/local/mysql/include -I/usr/local/include/python2.3 \
*/*.c -P '$(BUILDDIR)/' -o ../build/deps.mk
makedeps: ignoring option: -D_REENTRANT
makedeps: ignoring option: -D_GNU_SOURCE
makedeps: ignoring option: -fPIC
makedeps: ignoring option: -I/usr/local/BerkeleyDB.4.2/include
makedeps: ignoring option: -I/usr/local/mysql/include
makedeps: ignoring option: -I/usr/local/include/python2.3
makedeps: warning: "asss.h" not found
makedeps: warning: "pathutil.h" not found
makedeps: warning: "filetrans.h" not found
makedeps: warning: "log_file.h" not found
makedeps: warning: "rwlock.h" not found
makedeps: warning: "clientset.h" not found
makedeps: warning: "persist.h" not found
makedeps: warning: "redirect.h" not found
makedeps: warning: "md5.h" not found
makedeps: warning: "banners.h" not found
makedeps: warning: "protutil.h" not found
makedeps: warning: "billing.h" not found
makedeps: warning: "net-client.h" not found
makedeps: warning: "pwcache.h" not found
makedeps: warning: "bwlimit.h" not found
makedeps: warning: "db_layout.h" not found
makedeps: warning: "obscene.h" not found
makedeps: warning: "app.h" not found
makedeps: warning: "zlib.h" not found
makedeps: warning: "encrypt.h" not found
makedeps: warning: "fake.h" not found
makedeps: warning: "cfghelp.h" not found
makedeps: warning: "idle.h" not found
makedeps: warning: "koth.h" not found
makedeps: warning: "objects.h" not found
makedeps: warning: "jackpot.h" not found
makedeps: warning: "watchdamage.h" not found
makedeps: warning: "reldb.h" not found
makedeps: warning: "mysql.h" not found
makedeps: warning: "pthread.h" not found
makedeps: warning: "defs.h" not found
makedeps: warning: "util.h" not found
makedeps: warning: "db.h" not found
makedeps: warning: "statcodes.h" not found
makedeps: warning: "cmod.h" not found
makedeps: warning: "errno.h" not found
makedeps: warning: "win32compat.h" not found
makedeps: warning: "Python.h" not found
makedeps: warning: "structmember.h" not found
makedeps: warning: "fg_turf.h" not found
makedeps: warning: "fg_wz.h" not found
funky/funk1.mk:171: warning: overriding commands for target `install'
drone/drone.mk:171: warning: ignoring old commands for target `install'
funky/funk1.mk:175: warning: overriding commands for target `clean'
drone/drone.mk:175: warning: ignoring old commands for target `clean'
funky/funky.mk:5: warning: overriding commands for target `../build/funky.so'
funky/funk.mk:5: warning: ignoring old commands for target `../build/funky.so'
funky/funky.mk:9: warning: overriding commands for target `../build/letters.inc'
funky/funk.mk:9: warning: ignoring old commands for target `../build/letters.inc'
kothb/autoturret.mk:171: warning: overriding commands for target `install'
funky/funk1.mk:171: warning: ignoring old commands for target `install'
kothb/autoturret.mk:175: warning: overriding commands for target `clean'
funky/funk1.mk:175: warning: ignoring old commands for target `clean'
kothb/fm_shiplimits.mk:171: warning: overriding commands for target `install'
kothb/autoturret.mk:171: warning: ignoring old commands for target `install'
kothb/fm_shiplimits.mk:175: warning: overriding commands for target `clean'
kothb/autoturret.mk:175: warning: ignoring old commands for target `clean'
kothb/kothb.mk:171: warning: overriding commands for target `install'
kothb/fm_shiplimits.mk:171: warning: ignoring old commands for target `install'
kothb/kothb.mk:175: warning: overriding commands for target `clean'
kothb/fm_shiplimits.mk:175: warning: ignoring old commands for target `clean'
kothb/koth.mk:171: warning: overriding commands for target `install'
kothb/kothb.mk:171: warning: ignoring old commands for target `install'
kothb/koth.mk:175: warning: overriding commands for target `clean'
kothb/kothb.mk:175: warning: ignoring old commands for target `clean'
koth/koth.mk:171: warning: overriding commands for target `install'
kothb/koth.mk:171: warning: ignoring old commands for target `install'
koth/koth.mk:175: warning: overriding commands for target `clean'
kothb/koth.mk:175: warning: ignoring old commands for target `clean'
moveto/moveto.mk:171: warning: overriding commands for target `install'
koth/koth.mk:171: warning: ignoring old commands for target `install'
moveto/moveto.mk:175: warning: overriding commands for target `clean'
koth/koth.mk:175: warning: ignoring old commands for target `clean'
regiont/rt.mk:171: warning: overriding commands for target `install'
moveto/moveto.mk:171: warning: ignoring old commands for target `install'
regiont/rt.mk:175: warning: overriding commands for target `clean'
moveto/moveto.mk:175: warning: ignoring old commands for target `clean'
Makefile:93: warning: overriding commands for target `clean'
regiont/rt.mk:175: warning: ignoring old commands for target `clean'
gcc -std=gnu99 -pipe -I. -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall -c -o ../build/pymod1.o
gcc: no input files
make: *** [../build/pymod1.o] Error 1
scorch@sylvia:~/asss-1.4.4/src$



I did make clean first, and here is the result:


funky/funk1.mk:171: warning: overriding commands for target `install'
drone/drone.mk:171: warning: ignoring old commands for target `install'
funky/funk1.mk:175: warning: overriding commands for target `clean'
drone/drone.mk:175: warning: ignoring old commands for target `clean'
funky/funky.mk:5: warning: overriding commands for target `../build/funky.so'
funky/funk.mk:5: warning: ignoring old commands for target `../build/funky.so'
funky/funky.mk:9: warning: overriding commands for target `../build/letters.inc'
funky/funk.mk:9: warning: ignoring old commands for target `../build/letters.inc'
kothb/autoturret.mk:171: warning: overriding commands for target `install'
funky/funk1.mk:171: warning: ignoring old commands for target `install'
kothb/autoturret.mk:175: warning: overriding commands for target `clean'
funky/funk1.mk:175: warning: ignoring old commands for target `clean'
kothb/fm_shiplimits.mk:171: warning: overriding commands for target `install'
kothb/autoturret.mk:171: warning: ignoring old commands for target `install'
kothb/fm_shiplimits.mk:175: warning: overriding commands for target `clean'
kothb/autoturret.mk:175: warning: ignoring old commands for target `clean'
kothb/kothb.mk:171: warning: overriding commands for target `install'
kothb/fm_shiplimits.mk:171: warning: ignoring old commands for target `install'
kothb/kothb.mk:175: warning: overriding commands for target `clean'
kothb/fm_shiplimits.mk:175: warning: ignoring old commands for target `clean'
kothb/koth.mk:171: warning: overriding commands for target `install'
kothb/kothb.mk:171: warning: ignoring old commands for target `install'
kothb/koth.mk:175: warning: overriding commands for target `clean'
kothb/kothb.mk:175: warning: ignoring old commands for target `clean'
koth/koth.mk:171: warning: overriding commands for target `install'
kothb/koth.mk:171: warning: ignoring old commands for target `install'
koth/koth.mk:175: warning: overriding commands for target `clean'
kothb/koth.mk:175: warning: ignoring old commands for target `clean'
moveto/moveto.mk:171: warning: overriding commands for target `install'
koth/koth.mk:171: warning: ignoring old commands for target `install'
moveto/moveto.mk:175: warning: overriding commands for target `clean'
koth/koth.mk:175: warning: ignoring old commands for target `clean'
regiont/rt.mk:171: warning: overriding commands for target `install'
moveto/moveto.mk:171: warning: ignoring old commands for target `install'
regiont/rt.mk:175: warning: overriding commands for target `clean'
moveto/moveto.mk:175: warning: ignoring old commands for target `clean'
Makefile:93: warning: overriding commands for target `clean'
regiont/rt.mk:175: warning: ignoring old commands for target `clean'
rm -f ../build/*
scorch@sylvia:~/asss-1.4.4/src$

Grelminar - Thu Jan 08, 2009 4:16 am
Post subject:
Yes, limiting the pragma pack to just packets would be a very good idea. pack() (meaning "default") would be better than pack(4), and push/pop would be better than that.

Best of all would be __attribute__((packed)):
http://sig9.com/articles/gcc-packed-structures
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Type-Attributes.html
but I think that's only supported by GCC. Does anyone use any other compiler? It might be ok to require GCC...
Dr Brain - Thu Jan 08, 2009 6:44 am
Post subject:
I know a lot of Windows people still use msvc++ to compile their code, so we'll have to use the pack push & pop. I'll start making the changes and verify that they work as expected. I'm also going to look at fixing all of the pointer signedness warnings that started popping up a year ago.
Blocks - Wed Jan 14, 2009 2:38 am
Post subject:
I had this same problem. I've since stopped playing around with ASSS and don't have the files around to look into this, but I wrote this down and I remember that it helped me solve the problem.

Quote:
Cerium> system.mk, line 69; system-windeps.mk, line 26; and os.mk line 63

Cheese - Wed Jan 14, 2009 4:18 pm
Post subject:
requiring gcc would cause many developers (including myself) to leave asss entirely
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group