PDA

View Full Version : Linux compiles of 3.13


Trumpcard
11-21-2002, 04:44 PM
Hmm... Anyone else having link errors with database::LoadDoors() ?

Not having much success getting it to compile. Looks like Quest.h/.cpp was removed with this version, so make sure to take the Quest.o out of the makefile...

I think theres an 'extern "C" ' missing somewhere, but I can't find it..

Zafar
11-21-2002, 05:08 PM
When I was using 3.12 under Linux, all was fine after you had helped with patches. I implemented my own code, and code of you and I believe someone else and had no problem. When I tried Neotokyo's code, it wouldn't compile; broke around spells I believe.

Now with 3.13, I cannot get this to compile at all under Linux. The world server compiles fine, like 3.12 does, and the zone server in 3.13 won't compile, but the 3.12 does (Neotokyo's code isn't implemented in 3.12 to make things clear.) so I don't know what to say, feel, or think about this -- just upset. :(

So basically, for a small rundown:

3.12 - (my own code, Trumpcard, and who did #setmyskills):
- World Server compiles with no troubles, or problems.
- Zone Serer compiles with no troubles, or problems.

3.13 - (no code of my own, all completely default code):
- World Server compiles the same as 3.12 does.
- Zone Server cannot compile because of spells, and maybe some other areas.

Drop me a PM, and maybe we can share resources later on and track down this problem. I'd give you my AIM, but the security is rather tight on that because of issues in real life. Actually, if you have ICQ, you can get me there at: 81997849, catch ya later.


Hmm... Anyone else having link errors with database::LoadDoors() ?

Not having much success getting it to compile. Looks like Quest.h/.cpp was removed with this version, so make sure to take the Quest.o out of the makefile...

tamarae
11-21-2002, 07:48 PM
For the compile of 3.13 zone-

Like Trumpcard says, remove Quest.o from the makefile. There's no Quest.cpp and Quest.h in this release.

Line 1672 of spells.cpp needs to be changed from strnicmp to strncmp

As for the error with the Load_Doors() I've got it too, looking for it now, but its 2am and I'm likely not to find it till much much later. Going to bed. :)

Trumpcard
11-21-2002, 11:45 PM
The strnicmp problem was something Neo and I changed in the 1st wave of patch changes, Image probably just grabbed a version of the source file before we dropped the i.

Edit: Ok, I see why they're being missed in linking , those functions are all wrapped in a #ifdef SHAREMEM which isnt defined or available for linux, so they're not being compiled into the object in the first place.

This is images new way of loading doors into shared memory, I think the problem will need to be in addressed in net.cpp and client_process.cpp. well need to make a couple of changes to ensure that the Linux version uses the old way of loading doors, or we fix sharemem for linux. (Thats a harder one, but it would be really cool, it would signifanctly decrease memory usage).

Comment out the database::LoadDoor call in net.cpp, and GetDoors call and if statement right behind it in client_process.cpp .

It does work, I compiled everything, started the servers up, and zoned in and doors are still working.

Heres my changed files for linux

http://denial.dyndns.org/eqemu/3.13

Unless we get shared mem working, we'll need them to wrap those too sections in #ifdef 's so it will work the same for windows/linux.


If you look in the directories I posted, I made alot of minor changes in the world source and a couple in common. These are to fix alot of warnings in gcc, and start working on bringing the code up to the new C++ standards.

The new standards ask you to drop the .h off of standard c++ includes, and drop the .h and add a c in front of standard c libraries.

for instance,
#include <stdio.h>
becomes
#include <cstdio>

also, some functions need to be called differently, things like hex and dec need to be called with std::hex and std::dec to specify them as being in the Standard Template Library. cout's should be changed to std::cout also, this is considered the good form so you can override them easily, if you want the standard ones, you'd just call them with the direct reference to std::


The good thing here is with these changes, world will compile out of the box with gcc3.2 . I'll be working on getting the zone code compiling with it also. Right now, Im running a 3.2 build world server with a 2.95 built zone server. Make sure if you use 3.2, you modify your makefile to take advantage of the new cpu specific optimizations. I use -march=athlon-xp , the binary wont be compatible on any other processer, but it's optimized with athlon specific instructions so it will execute faster.

Make sure if you do it this way though to do a 'make clean' in between building zone and world. The .o files in common aren't compatible between the 2.

kathgar
11-22-2002, 04:51 AM
We aren't going ANSI compliant.. we tried it before but people have...problems with it..

Trumpcard
11-22-2002, 05:11 AM
Thats going to be a big problem going forward, all the compilers are going to full tightfisted compliance in the future, gcc was just one of the 1st to jump on board. MS will probably be slow on forcing the standards, but it's going to happen.

How about this, let me make the changes to get as much as I can compiling out of the box for gcc3.2, all my code will be tested out and compiled against both windows and gcc to ensure cross comptability, but I wont push any changes related to the deprecated headers.

For gcc to work outta the box right now for world just requires a few additional includes (stdarg.h needs to be put in a few places), and either a using namespace std; in the cpp files, or a reference to std:: for hex and dec. Very limited changes.

kathgar
11-22-2002, 05:50 AM
The problem is things like the login code and packetcollector.. and some of the devs not know the ansi shit

Trumpcard
11-22-2002, 08:12 PM
Well, zone compiled alot easier than I thought.. ios::nocreate was removed , so I removed the #ifdef win32 switch and used the windows version of the call, and it seems to be working great.. Not sure why windows used a different function for it, so this might not be the best idea until i can figure out why, but if you'd like to test it on gcc3.2, heres what i did..


In net.cpp

//#ifdef WIN32
ifstream in;in.open(SPELLS_FILE);
//#else
// ifstream in;in.open
//(SPELLS_FILE,ios::nocreate,filebuf::openprot);
//#endif
if(!in.is_open()){
cout << SPELLS_FILE << " not found, spells NOT loaded.";
return;}

I put the changed cpp file at

http://denial.dyndns.org/eqemu/3.13


My server is compiled fine now with gcc3.2. even though there are a ton of warnings (I fixed a bunch in the .cpp files), and i definitely notice a difference with the new compiler optimizations...

curtdept
11-25-2002, 12:27 PM
I tried moving to a more ANSI compliant structure before but it was met with some opposition (ie having to migrate Linux up is somewhat ackward). I had broken and fixed packetcollector but the cryptographic source was never at my disposal to upgrade and so we ran into problems of ambiguity. With the recent compiler changes in both GCC and the .NET initiatives, coding for linux isnt all that for off Windows code anymore, its actually quite impressive. As a small info tidbit, the .NET compilers now make bytecode just as Java did and I wouldnt be surprised if we started seeing cross platform interpreters popping up. Well, I am almost settled in now and look forward to coming back and helping out again when my class schedule will permit.

Lates,
Helios