Jump to content
Eternal Lands Official Forums

Compiling the Mac client!

Recommended Posts

So, it has been long overdue, but I finally got around to including an XCode project in the CVS repository. I have done my best to be thorough, but I may have left some stuff out. Some programming knowledge is useful.



This is an XCode 2.4+ project file, so you will need OS 10.4 or greater to use it. You will need to install the Developer Tools, which should have come on a CD/DVD with your computer.


You will also need my compiled client in order to get the proper framework files and data files for EL.


You also need to get an updated glext.h. Modify the new glext.h around line 3369 to read as follows:

#ifndef GL_VERSION_1_5
/* GL types for handling large vertex buffer objects */
/* following commented out by 0ctane since OS X's gl.h has its own definition */
//typedef ptrdiff_t GLintptr;
//typedef ptrdiff_t GLsizeiptr;

This modification is required to prevent a redefinition problem,which is likely due to Apple's gl.h being so old compared to the new glext.h. You will have to replace your computer's glext.h with this one. Look in /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Headers


Getting necessary frameworks and data directory

Download my 1.5.x client from here.

Open the disk image, and right click on the game. Select "Show Package Contents" to see the game's internal directory structure. Go to Contents/Frameworks. Copy ALL the frameworks to YOUR ~/Library/Frameworks directory (you might need to create the Frameworks directory). Next, navigate to Contents/Resources. Copy the "data" directory to somewhere on your computer.


Setting up Xcode preferences

Open up the Preferences dialog (under the Xcode menu). Select the "Source Trees" icon in the dialog. Add the following entry:


Display Name = EL Frameworks

Path = $(HOME)/Library/Frameworks

If you placed your frameworks somewhere else, then alter the Path accordingly.



First, read this thead.

In XCode 3 (maybe 2.4, but I am not sure) you can use the SCM system to obtain the CVS source. Under the SCM menu, choose Repositories. Then click on the Configure icon. The XCode Preferences dialog should appear. Click the little "+" to add a new repository. Call the Repository EternalLands, and select CVS as the SCM System.


Your CVS settings should be setup as follows:



(the rest should automatically fill in, but if not)




Port: (leave blank)

(or your user name if you have an account)

Password: (leave blank unless you have an account)

Click on Apply and OK.


Now, back in the Repositories dialog, you should have a EternalLands CVS repository listed. Click on it, and XCode will start retrieving the repository (structure, not the actual files yet). Once the repository has been downloaded, select the "elc" folder on the right side. Then, click on the Checkout icon at the top of the dialog. You will be prompted to save the "elc" directory somewhere on your hard drive.


Setting up your local project

In the Finder, go to the elc directory that you "checked out" onto your hard drive. Then, go into the "macosx" directory. In there, you will find a EternalLands.xcodeproj file. Double-click on it. The XCode project should open. Now, go back up to the SCM menu, and select "Configure SCM for this project...". In the General Tab of the resulting Project Info dialog, you should see a SCM Repository: pulldown list. From that list, select your EternalLands repository.


Building EternalLands

Back in XCode, click on the Build icon. Simple, right? Note, Build and Go will not work since you need to add in the data files.


Finalizing the build

The Build process copies all the frameworks from ~/Library/Frameworks (see above) into the game. You just need to copy that "data" directory into the game. But, where is the game? elc/macosx/build/Release. I suggest you first copy your EternalLands game to a new location (such as the Desktop). Then, right-click on it, and "Show Package Contents". Navigate to Contents/Resources. Now, copy your saved "data" directory to here. Close the Contents window. Double-click on EternalLands to run!


Updating to latest CVS code

Open up your XCode project again. On the left side of the project window you have Groups & Files. Select the very top EternalLands item. Now, look at the right side. If you right-click on one of the column headers (File Name for example) you will get a pulldown list. Select SCM so that there is a little checkbox next to it. The column headers should expand by one to include a SCM flag (looks like a disk or birthday cake).


Periodically, XCode will then check the repository to see if any code has changed, and this column will then have a "U" which means you need to update. (A "M" means that you modified something.) Clicking on the SCM column header will allow you to sort by modification. Select all the files that need to be updated. Now, in the main menu, select the SCM menu -> Update To -> Latest. CVS will then pull down all the new files, and you are all set with the latest code. Or, you can update the entire project.


[edit]Thanks to rmiles for testing this out and catching a glext.h problem.[/edit]

[edit]More changes. Need to setup Source Trees as listed above.[/edit]

Edited by 0ctane

Share this post

Link to post
Share on other sites

Customizing the build

If you do not have it open, open the EternalLands XCode project.


Under the Files & Groups listing, double-click on the EternalLands top item (or single click and then Apple+i). This brings up the Project Info dialog. Click on the Build tab to access all of the build options.


It is often convenient while testing to only build for your specific architecture. I have XCode build the universal binary. To change this, click once on the architecture list (i386 ppc), wait a second, then click on it again. Now you can delete (or add) specific architectures to the build. Each architecture will increase the resulting executable size (and could take a while depending on your system).



If you keep your frameworks somewhere other than ~/Library/Frameworks, you will have to change some settings. Look for the "Framework Search Paths" and "Header Search Paths" items in the build list. Modify the paths for these items to find wherever you put the Frameworks.


-D flags

These are the flags found in #ifdef declarations throughout the code. In the Build settings, look for "Preprocessor Macros". Here is the list of defines that are currently used to build EL. You can add/delete features to your heart's content. The make.defaults file (should) have all currently available defines.

That's about it for now. PM me if you are interested in other features. Please don't spam this thread with, "I cannot get it to work" message. Do some googling first and read Apple's Developer lists. Bugs in the game should be posted over in the bugs thread appropriate for the current EL version.

Edited by 0ctane

Share this post

Link to post
Share on other sites

For Snow Leopard users who want to build a client that is still compatible with OS X 10.4, you need to change your compiler to GCC 4.0. Otherwise, you might get a build error : GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file SDLmain.m)


A full 64-bit compile is not yet possible due to some library dependencies not being 64-bit/universal.


Placeholder for more info.

Edited by 0ctane

Share this post

Link to post
Share on other sites

Hi all


my two cents about compiling with Xcode (please feel free to remove the post if inapproriate or if/when inaccurate).

Apologies for posting to the wrong thread before.


With respect to the existing Xcode project, and _in addition_ to the instructions given above by 0ctane, I found that


  1. you need to call perl to generate teh elglext.h file by hand, calling in the elc directory
    /usr/bin/perl glext.pl > elglext.h

  2. you need to move a line in load_gl_extensions.h, raising up the #include "platform.h"
    #include "platform.h"
    #include <SDL_types.h>
    #ifdef OSX
    #include "elglext.h"

  3. some c and C++ files are missing in the Xcode project; you need to add them (context menu on the elc directory, add existing files)
  4. Fedora pointed out that many more source files were missing in the initial .xcodeproject, and he was right; however, xcode seemed to be happy to go without them, and compiled a client which was missing many features...
    I found an issue with the original Xcode project file, where the #define used to enable/disable several parts of the code were ignored. Xcode supports precompiled headers, and it has actually two separate settings for preprocessor macros: one is used while pre-compiling headers, the other one when compiling the actual code files.
    To make the compilation process respect your #defines, go to the Project->Edit Project Settings->Build tab, and copy all the macros defined in "Preprocessor Macros" to the following setting, "Preprocessor Macros Not Used In Precompiled Headers" (click a second time after a while, see 0ctane's post. to be able to copy all the macros at once).
    Also, if enabling/disabling of client features is needed, remember to have both settings the same.
    After that, and after adding MISSILES, CALCULATOR, NEW_SELECTION, i had to add the following files to the project (add existing files...)
    Besides, do not forget to do SCM ->go Online and update all the files that are have changed in the repository. Remember to save any change you made (see point 2 in this list; I assume you know how a software repository works).
    Build successful. Client seems to work on the standard server, although (1) reflections have to be disabled, they break all the rendering, (2) use_actor_program can't be enabled. The images are quite dark, but colors and shaders are ok; the strange disk noise bug is there, but it is solved by New_selection, now working properly.
    Need time to play and test it, on the main and test servers, but can't do that now.


Please still consider these instructions as a partial contribute.

(also many thanks to Fedora for some suggestions).

All the best and thanks to all for the continued effort in developing and porting EL.

Edited by massimoC

Share this post

Link to post
Share on other sites

I followed all the instructions for building the client from CVS but have two errors I do not know ho to fix:


Line Location Tool:0: "_CHECK_GL_ERRORS", referenced from:

Line Location Tool:0: _enable_reflection_clip_planes in frustum.o

Line Location Tool:0: _disable_reflection_clip_planes in frustum.o

Line Location Tool:0: "ec::StaffEffect::StaffEffect(ec::EyeCandy*, bool*, ec::Vec3*, ec::StaffEffect::StaffType, unsigned short)", referenced from:

Line Location Tool:0: _ec_create_staff_of_protection in eye_candy_wrapper.o

Line Location Tool:0: _ec_create_staff_of_the_mage in eye_candy_wrapper.o

Line Location Tool:0: symbol(s) not found

Line Location Tool:0: collect2: ld returned 1 exit status


Could you give me help in solving these 2 errors?

thanks in advance.

Share this post

Link to post
Share on other sites

For anyone that is attempting to compile the client, be warned that from what I hear the XCode 4 Gold Master IDE no longer includes CVS versioning support. You will need to use the terminal to execute cvs commands or use a different CVS GUI client. EL is hosted on berlios.de and uses CVS.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.