PDA

View Full Version : Compiling 64-bit?


movieman
01-03-2009, 12:30 AM
Not sure which is the correct forum for this, since it's really a development issue but that says it's not a support forum:

Should I expect the SVN code to build on 64-bit Linux?

I just got everything out of SVN and tried to compile it, but various makefiles have '-march=i686' on the command line, and TCPConnection.cpp doesn't compile because it uses size_t rather than socklen_t for the size of the socket address around line 148; oddly, it uses socklen_t for BSD, but size_t for Linux. In the latter case I suspect it builds on 32-bit Linux but not 64-bit, as size_t and socklen_t appear to be typedef-ed to the same type on 32-bit but different types on 64-bit (size_t is 64-bit, socklen_t is 32-bit).

I'm not sure why gcc barfs on compiling for a 32-bit architecture on this 64-bit system as I've done it often at work, but I get 'error: CPU you selected does not support x86-64 instruction set'.

I noticed that 'world' has an AMD64-specific makefile, but the others don't seem to have. Is there a good reason to force a particular CPU build rather than use the default for the system you're compiling on? I presume I can just remove the -march options from all the makefiles and it will build, but having them there by default if there's not a good reason for it seems odd.

Since pretty much every new CPU can run 64-bit (even $80 Atoms), being able to run on a 64-bit server would be nice.

Yeormom
01-03-2009, 12:40 AM
This doesn't answer your question but is worth taking note...

Unless you have more than 4GB of memory, running the 64 bit operating system actually increases your overhead (reducing performance) and adds much drama to your compatibility issues as it is presently. The only true 64 bit processor that runs such code natively is the Itanium processor. Others still use extensions so you are not gaining anything right now unfournately.

movieman
01-03-2009, 12:54 AM
Actually, there are pluses and minuses: there are more registers in 64-bit mode but there are less optimisations inside the CPU unless you're running a Nehalem chip so it can't run 64-bit instructions quite as fast. However, this system has 4GB of RAM and >4GB will be the norm pretty soon for new PCs; 32-bit OSes don't have long to live.

movieman
01-03-2009, 01:18 AM
So anyway, to make it compile 64-bit, here's what you need:

1. Fix TCPConnection.cpp to use socklen_t as BSD does, rather than size_t.
2. Fix the makefiles to not force -march=i686
3. Fix the makefiles which have hard-coded MYSQL_FLAGS and MYSQL_LIB to instead use mysql_config as the chatserver makefile does.

I'm not sure when I'll be able to try running it to see whether it actually works, but I checked the 'uint32'-type definitions and they look correct for 64-bit code; as far as I'm aware int is 32-bit, long is 64-bit and long long is 64-bit on AMD64 Linux.

roostermhm
01-08-2009, 11:00 PM
Uhmmm gee, ok. that's the error I get compiling and that sounds like great advise. So how does someone as Linux ignorant as I am do it? I use Ubuntu because I'm new to Linux and apparently not smart enough to handle most non point n click stuff..

I have an ASUS A8V Deluxe motherboard with 2 gigs ram and a AMD Athlon64 3000+. I am also using an ATI Radeon 9250 (the box says sapphire but the entire card sux, that's why I put it in the Linux (toy)Box. I have Ubuntu Intrepid Ibex 8.1. I did the regular dvd install, and updated it to current.

I am attempting to follow the wiki at http://www.eqemulator.net/wiki/wikka.php?wakka=DebianLinuxServer , but am also referring to the wiki at http://www.eqemulator.net/wiki/wikka.php?wakka=LinuxServerGuide as a reference.

I installed Ubuntu, installed mysql from the synaptic package manager. I then downloaded the latest peq db and quests, and the source tarball at the top of the download page from this website (EQEmu-0.7.0-1129).

Before I did the make, I also did the 2 sudo's in the wiki, :
apt-get install libmysqlclient15-dev
apt-get install gcc g++ make libio-stringy-perl libperl-dev unzip

And then I modified the source makefile as follows
all:
# $(MAKE) -C eqemucollector
# $(MAKE) -C eqextractor

clean:
# $(MAKE) -C eqemucollector clean
# $(MAKE) -C eqextractor clean
and took the g out of gmake in the other two makefiles as directed.
I did not to the other recommended mods below that.
Then I did the make and got a whole bunch of lines of

cc1plus: error: CPU you selected does not support x86-64 instruction set

I hope I have provided enough information, what have I done wrong or what can I do to fix it
(in “for dummies” speak please)

thank you in advance.

Andrew80k
01-09-2009, 12:19 PM
Edit the source and make files. By the way where did you get your source? Some of the stuff you are fixing has been corrected in the current source for a while now. You should get the lastest from the google svn (apt-get install svn, first). Then edit the pieces that movieman suggested. Do you know how to navigate in linux? Edit files?

The error your getting is fixed by taking out the -march=1686 above but you'll still need to do the rest.

movieman
01-14-2009, 12:33 AM
Still haven't had a chance to test it to see if the compiled 64-bit binaries actually work; both my Windows PCs have live Everquest installed and installing Titanium would be a pain, but maybe I can install it under Wine on one of the Linux boxes.

gaeorn
04-30-2009, 09:12 AM
I know this is an old thread but I just thought I'd report that I have had a server stable for several weeks under Fedora 8 x86_64. I had figured out the same things that movieman noted needed changing before I came across this thread. But under Fedora 8 and the libraries installed, I also had to make changes to some locations where va_list was being used as vsprintf and vfprintf were not preserving the values of the va_list. This caused crashes where the va_list was used again later in the code.