Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

Support::Linux Servers Support forum for Linux EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2013, 09:42 PM
prickle
Hill Giant
 
Join Date: Sep 2009
Posts: 147
Default Building with CMake

Since the tutorials haven't been updated yet. The follow are some pointers on compiling EQEmu with CMake. This assumes you already have an environment that could build EQEmu before the CMake change over. So, this information is to help people change over to the CMake system from the old way of doing it.

In addition to installing the other packages that tutorials tell you to, you'll need to install cmake. Ubuntu/Debian users will run:

Code:
sudo apt-get install cmake
after checking out the source from SVN, i like to copy the source to a build directory and in there I run:
Code:
cmake -i
cmake -i is to allow you to alter any build flags and enable/disable other EQEmu features (e.g. bots).

If you're on an AMD64 system you'll want to say "yes" to the advanced options. This is to allow you to disable the -O2 and -O3 optimizations that mess up the stringstream stuff that plague us. For example:
Code:
$ cmake -i
Would you like to see advanced options? [No]:yes
Please wait while cmake processes CMakeLists.txt files....

...bunch of stuff that doesn't need to change...

...then...

Variable Name: CMAKE_CXX_FLAGS_RELEASE
Description: Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).
Current Value: -O3 -DNDEBUG
New Value (Enter to keep current value):
On this one I change it to "-march=native -DNDEBUG". This sets the GCC CPU optimizations without the -O2/-O3 optimization enhancements, if you will.

Then:
Code:
Variable Name: CMAKE_CXX_FLAGS_RELWITHDEBINFO
Description: Flags used by the compiler during Release with Debug Info builds.
Current Value: -O2 -g
New Value (Enter to keep current value):
I change this one to just "-g".

Again later:
Code:
Variable Name: CMAKE_C_FLAGS_RELEASE
Description: Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).
Current Value: -O3 -DNDEBUG
New Value (Enter to keep current value):
Same as CMAKE_CXX_FLAGS_RELEASE, I set this to "-march=native -DNDEBUG".

Last -O2 entry:
Code:
Variable Name: CMAKE_C_FLAGS_RELWITHDEBINFO
Description: Flags used by the compiler during Release with Debug Info builds.
Current Value: -O2 -g
New Value (Enter to keep current value):
Like CMAKE_CXX_FLAGS_RELWITHDEBINFO, I set this to just "-g".

Finally, if you want "Bots":
Code:
Variable Name: EQEMU_ENABLE_BOTS
Description: Enable Bots
Current Value: OFF
New Value (Enter to keep current value):
Change that to "ON" and continue to the end.

After "cmake -i" finishes, to compile the build:
Code:
make clean && make
All of the built binaries will be in the Bin/ directory. At this point, I usually shut the server down, create a back up of my existing server directory, and then run:
Code:
cp Bin/* <server directory>
This will copy everything in Bin/ to the server's directory. It will have libCommon.a in there. This file can be removed as it's only needed during compile, as was explained to me not too long ago.

Finally, if you're on a multi-core system you can use "make -jx" (instead of just "make") where x is the number of CPU cores you want to use during compile. This greatly speeds up the compile. For example, on my quad-core system I use "make -j3" to use 3 cores, because my one of my cores is usually really busy with MySQL queries.
Reply With Quote
  #2  
Old 01-21-2013, 05:24 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

RelWithDebInfo without -O2 is just Debug, no need to do that just change the build type from RelWithDebInfo to Debug. That said if linux is crashing with -O2 that's a problem.
Reply With Quote
  #3  
Old 01-21-2013, 06:29 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

Quote:
Originally Posted by KLS View Post
That said if linux is crashing with -O2 that's a problem.
Apparently there's an issue with stringstream in SerializeItem in the SoF+ patches on 64-bit with optimization. Turning the optimization off fixes it. Not sure if it is limited to a particular distribution or gcc version.

Always seemed like an odd use of stingstream to me, but I didn't see anything obviously wrong with it that would cause the crash.
Reply With Quote
  #4  
Old 01-21-2013, 09:47 PM
prickle
Hill Giant
 
Join Date: Sep 2009
Posts: 147
Default

This issue has been around for a while. It affects SoF+ clients (as mentioned), and as far as I can tell, it maybe limited to AMD64 platforms. Then again, I don't know which CPU architecture the other people that have this issue are using. So, I could be completely wrong about it. I've been having this particular issue since 2009:

http://www.eqemulator.org/forums/sho...d.php?p=181174

Back then I use using a single core Athlon64 w/ Ubuntu 8.04 (I only use the LTS versions). Now I'm on an Athlon II x4 w/ Ubuntu 12.04, and I still have the same problem.

I don't have any Core2 (or newer) Intel systems laying around to test with so I have no clue if the issue affects them or not.
Reply With Quote
  #5  
Old 01-22-2013, 12:05 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Yeah I remember it now, we're going to make it a priority to fix next if possible. I don't remember seeing anything wrong with the string stream code either when I looked at it. If it comes down to it I'll rewrite the code without stringstreams.
Reply With Quote
  #6  
Old 01-22-2013, 02:08 AM
prickle
Hill Giant
 
Join Date: Sep 2009
Posts: 147
Default

That sounds awesome. I'm looking forward to it!
Reply With Quote
  #7  
Old 01-22-2013, 06:07 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

For now, since it's a lot of work and the idea of people building without -O2 in release mode for a week will kill me inside we're going to set those particular patch files to -O0 on Unix64 for now. We're still gonna fix the bug too though.
Reply With Quote
  #8  
Old 01-22-2013, 11:12 PM
prickle
Hill Giant
 
Join Date: Sep 2009
Posts: 147
Default

nice. I just snagged Rev 2443 and built it. I didn't change any of the "advanced" cmake -i settings and only enabled bots. I'm able to log into game without changing the optimization settings.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3