Mac SVN/Compile instructions

Questions or HOWTOs about the above? Post 'em here...
User avatar
Cobra_Fast
Dev Monkey
Dev Monkey
Posts: 321
Joined: Sat Oct 07, 2006 11:51 am
Location: Germany
Contact:

Re: Mac SVN/Compile instructions

Post by Cobra_Fast » Wed Nov 24, 2010 3:10 pm

Looks like the SDL dev libraries are missing.

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Wed Nov 24, 2010 3:41 pm

Any suggestions on how to properly install SDL on my machine?
I followed the install instructions in the readme and it appeared to install successfully. As usual, I used the normal commands to compile and install SDL.

Code: Select all

./configure
make
sudo make install

User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Re: Mac SVN/Compile instructions

Post by joevano » Wed Nov 24, 2010 6:14 pm

You need the developer libraries installed as well. Those would be at the bottom of this page... http://www.libsdl.org/download-1.2.php
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln

User avatar
optic delusion
Special Forces
Special Forces
Posts: 962
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Mac SVN/Compile instructions

Post by optic delusion » Wed Nov 24, 2010 6:49 pm

I dont know about needing the SDL dev libraries, I'm compiling without them.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.

User avatar
blast
General
General
Posts: 4647
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Mac SVN/Compile instructions

Post by blast » Thu Nov 25, 2010 3:01 am

The main problem looks like your SDL is not 64-bit.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Thu Nov 25, 2010 8:28 am

Ok, will try to compile SDL in 64-bit.
Do I need to compile the SDL.framework in 64-bit as well? Can I build the framework?

The dev libraries for Mac OS X appear to be documentation and XCode templates.
However, there are also some files in a 'SDL-devel-extras/SDLMain/' folder , which looks promising. I will try to install those.

User avatar
macsforme
General
General
Posts: 1983
Joined: Wed Mar 01, 2006 5:43 am

Re: Mac SVN/Compile instructions

Post by macsforme » Thu Nov 25, 2010 11:39 am

IIRC the precompiled SDL framework builds from the libsdl site are three-way unibins... 32-bit PPC, 32-bit x86, 64-bit x86. Unless you really want to try to replicate that with your own build, or you have local modifications to your SDL, or want to use a development SDL version, I see no reason for you to build your own SDL. Note that these development frameworks are deceptively labelled as "runtime libraries" on the SDL site.

Compiling without SDL on mac is not recommended... the non-SDL mac platform files have not really been maintained over the last several years and may generate problems for you.

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Thu Nov 25, 2010 1:00 pm

Good news- I got it to work by installing everything related to SDL that I could get my hands on.
Bad News- I don't know which of the things I installed enabled me to compile BZFlag successfully. Basically, I did all of these things.
(Please note that some of my actions may seem irrational and unwise, and that is because I figured my situation couldn't get worse.)

Copied SDL.framework to Library/Frameworks/ (into both the root and home folders, just in case)
Installed the XCode Templates that were included in the devel package to Library/Application Support/Developer/Shared/Xcode/Project Templates/Application (into both the root and home folders, just in case)
Installed libsdl with MacPorts
Compiled SDL from source
Installed SDL-devel-1.2.9.pkg

All of that resulted in a functioning bzflag executable. Hope that helps you Crallion (and any others who come across this problem).

tl;dr- SDL.framework is not the only SDL thing that needs to be installed.

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Thu Nov 25, 2010 3:03 pm

One last problem:

Code: Select all

PBXCp build/Default/BZFlag.app/Contents/Frameworks/libcrypto.0.9.7.dylib /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libcrypto.0.9.7.dylib
	PBXCp build/Default/BZFlag.app/Contents/Frameworks/libcurl.3.dylib /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libcurl.3.dylib
I get these errors when I try to build the bzflag executable into and application bundle. From what I can tell, libcurl and libcrypto are being unsuccessfully copied over to the application bundle. When I navigated to /Developer/SDKs, there is no MacOSX10.4u.sdk folder.
There are two folders in /Developer/SDKs: one for the 10.5 SDK, and another for 10.6. But nothing for 10.4. Why is xcode trying to copy a file that doesn't exist and how can I fix it?

User avatar
macsforme
General
General
Posts: 1983
Joined: Wed Mar 01, 2006 5:43 am

Re: Mac SVN/Compile instructions

Post by macsforme » Fri Nov 26, 2010 10:29 am

Rapid Echo wrote:tl;dr- SDL.framework is not the only SDL thing that needs to be installed.
Yes it is the only SDL thing that needs to be installed. The SDL framework includes development headers and dynamic loading libraries, and it is all packaged up and put in the Frameworks directory on the system or inside the application package. If it doesn't work, then there is a problem with the build system not detecting and using it.

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Fri Nov 26, 2010 10:34 am

Constitution wrote:If it doesn't work, then there is a problem with the build system not detecting and using it.
If that is indeed the case, then I guess we can pinpoint what fixed it.
I copied SDL.framework to /Users/connor/Library/Frameworks/ and /Library/Frameworks/
I am thinking that perhaps it needed to be in my home folder.

It could've also been installing libsdl with MacPorts, I suppose.

User avatar
macsforme
General
General
Posts: 1983
Joined: Wed Mar 01, 2006 5:43 am

Re: Mac SVN/Compile instructions

Post by macsforme » Sat Nov 27, 2010 9:38 am

So when it is only in /Library/Frameworks, bzflag doesn't compile?

Rapid Echo
Private First Class
Private First Class
Posts: 16
Joined: Thu Jul 15, 2010 2:15 pm

Re: Mac SVN/Compile instructions

Post by Rapid Echo » Sat Nov 27, 2010 10:33 am

I'm not sure, because I did all of the things above (unwisely) at the same time, so I don't know what fixed it.
All I can tell you is that bzflag was able to compile after I did the above.

If you think that none of the other things would really effect it, then yes, it was probably that SDL.framework had to be in my home folder library (~/Library/Frameworks)

the minne missile
Private First Class
Private First Class
Posts: 19
Joined: Thu Aug 27, 2009 4:38 pm

Re: Mac SVN/Compile instructions

Post by the minne missile » Wed Mar 14, 2012 5:41 pm

Doesn't compile with Max OS X lion...

User avatar
blast
General
General
Posts: 4647
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Mac SVN/Compile instructions

Post by blast » Wed Mar 14, 2012 5:52 pm

It should work fine if your system is set up right. If you can't figure it out, just use our binary package.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

PsYch0
Private First Class
Private First Class
Posts: 37
Joined: Sun Nov 27, 2005 2:23 am
Location: Chicago, IL USA

Re: Mac SVN/Compile instructions

Post by PsYch0 » Sat Nov 17, 2012 5:44 am

I have compiling working on OS X Mountain Lion (10.8 ), but with a bit of messing around. For anyone curious, here are the things I had to do.

ONE: Install SDL into /Library/Frameworks as directed. I tried this numerous other ways for wanting NOT to "officially" install the framework and none worked, so I just put it there for compile time and moved on.

TWO: If you are using the Xcode Project, note that there have been several critical changes in Xcode in the past couple versions. The most notable is the disappearance of /Developer into the bundling of the self-contained "Xcode.app" now in /Applications. In 10.8, you can also no longer easily retrieve the SDKs for anything earlier than 10.6. This is a problem because BZFlag.xcodeproj wants to use libcrypto.0.9.7.dylib and libcurl.3.dylib from the 10.4 SDK. As it turns out, both are intact in the current 10.8 SDK; all you need to do is repoint Xcode to the new files.

HOW TO DO THAT
Before opening Xcode, prepare the finder. Select Xcode.app and choose "Show package contents"; then browse to Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/

You have to do the above step because Xcode does not let you browse .app contents as you will need in the following step.

Get back to Xcode with BZFlag.xcodeproj opened. Make sure you have the left-pane on and are looking at the file browser. Expand/disclose "Frameworks & Libraries" and you should see the missing dylib files highlighted with red text; select one. Now make sure you have the right-pane (Utilities view) enabled. You should see "Location" under the "Identity" area and there should be two icons, a dialog box and an arrow. Click the dialog box and Xcode prompts you to choose a new file. With this dialog open, switch back to Finder where you have the 10.8 SDK open. Drag the "lib" folder from the 10.8 SDK into the Xcode selection dialog box. Now find the correct library (libcrypto.0.9.7.dylib and libcurl.3.dylib)

THREE: Update the deployment target to 10.8. In the left-pane of Xcode, make sure you are in file browser mode and choose the project at the top of the hierarchy. The center pane of Xcode should now have some options at the top, including "Summary". Select "Summary" and you should see "Deployment Target" near the top. It's a drop-down menu and you should probably just choose 10.8, though I did get a successful build in 10.6 and 10.7

FOUR: Using --enable-debug in the configure script causes warnings to be treated as errors. You will get a lot of warnings related to using a C99 hexadecimal floating constant. Select the Project like you did in above, but now choose "Build Phases" to edit the build steps. The second phase is "Run Script" and includes the configure call; remove the --enable-debug option to forget these warnings.

If you want to address the warnings regarding the C99 hexadecimal floating constant, see http://ibot.rikers.org/%23bzflag/20120729.html.gz. You will find notes that you can edit include/common.h and preface the "#ifndef MAXFLOAT" with "#undef MAXFLOAT" -- this worked for me, as well.

FIVE: During a couple of my earlier builds, I found that while configure detected the SDL framework, it was not finding SDL/SDL.h -- odd! At one point, I added the --with-SDL option to configure and voila! that run (and all going forward) then saw SDL/SDL.h. I don't know if this was coincidence or successful troubleshooting, but it's worth noting.

Before SDL/SDL.h was seen, the build would always stop, of course, at the SDL-related code due to tons of undefined procedures and/or objects. I should also mention that when attempting NOT to use SDL, the MacMedia etc files complained of similar errors. In particular, if all else succeeds MacDisplay.cxx fails because it refers to a NewRgn() call that I could not find defined anywhere else in the entire project... admittedly a quick search using only grep.


FINALLY, I should note that in some builds, Xcode complained of invocation errors in the shell scripts, but that the script/shell did not exit with failure status. Whatever caused this did not seem to affect the build results, so I haven't worried about it.

I hope this helps other folks get moving.

User avatar
FiringSquad
Sergeant
Sergeant
Posts: 834
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: Mac SVN/Compile instructions

Post by FiringSquad » Tue Nov 20, 2012 10:53 am

PsYch0 wrote:Before SDL/SDL.h was seen, the build would always stop, of course, at the SDL-related code due to tons of undefined procedures and/or objects. I should also mention that when attempting NOT to use SDL, the MacMedia etc files complained of similar errors. In particular, if all else succeeds MacDisplay.cxx fails because it refers to a NewRgn() call that I could not find defined anywhere else in the entire project... admittedly a quick search using only grep.
NewRgn() is a QuickDraw call deprecated since 10.4, that is no longer supported on 10.8.
I don't have the current sources, but it seems that this call is only used to initialise "MacDisplay::cursor_region" and that this variable is no longer used.
It's probably just a throwback to when a region needed to be passed to event routines so that an event would be generated if the mouse moved outside this region.
Probably OK to remove the variable from the class definition and delete the initialisation line in the constructor.

PsYch0
Private First Class
Private First Class
Posts: 37
Joined: Sun Nov 27, 2005 2:23 am
Location: Chicago, IL USA

Re: Mac SVN/Compile instructions

Post by PsYch0 » Fri Jan 10, 2014 2:30 am

Been a while, and I stumbled here upon my own past post. That was an excellent find; however, it needs some updating. Most of the instructions above (two posts prior to this one) still apply, and the adjustments are as follows:

ONE: I still keep the SDL Framework in /Library/Framewors.

TWO: Now I see that both libcrypto.0.9.7.dylib and libcurl.3.dylib are in /usr/lib. So, proceed as described before in order to point those Xcode resources to a new location; but now, you may use command-shift-g and then specify "/usr/lib" to take the file dialog directly to /usr/lib and select the two files.

THREE: Xcode's views have changed more again. Like before, make sure you have the left pane ("Navigator") visible and select the folder icon for the file browser mode called "Project Navigator." Then choose the project at the very top of the listing. In the main window pane in the center, you should see a list of headings at the top. If you do not see "General" and "Build Phases" then you must: select the project name to the left of the headings, and a list will appear. Then choose the BZFlag item listed under "Targets" -- not "Project".

Now, under "General" change the deployment target to 10.8.

FOUR and FIVE I ignore. I could not get any method to work building the entire project in Xcode. Instead, I do the following on the command-line to compile and link all of the code, and then just use Xcode to wrap it up into the pretty Apple .app package.

Code: Select all

CXXFLAGS='-I /Library/Frameworks/SDL.Framework/Headers' ./configure
make
After doing the above, follow the instructions for FOUR in the previous post, but instead of removing "--enable-debug" from the configure line, just comment it all out (precede each line with a #) or remove the whole thing. This way, the configure and make commands are removed from the Xcode process. I had no luck simply using my above commands in the Xcode shell script phase... not sure why; the environment probably.

I've verified this with 2.4.0, but have not tried 2.4.2 yet.

I hope this helps many who may still have issues.

User avatar
blast
General
General
Posts: 4647
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Mac SVN/Compile instructions

Post by blast » Fri Jan 10, 2014 2:39 am

Constitution created a proper Xcode project after 2.4.2 was released. It would be available in the latest SVN trunk (and in our work-in-progress git repo). This doesn't use any of the autoconf/automake magic, so stuff like ./configure and running 'make' should not be necessary.

See the "Source Distribution" section of the README.MacOSX file.

Of course, you'd have to get the code from SVN/Git to use that method.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests