Difference between revisions of "Compiling the viewer (Mac OS X)"

From Second Life Wiki
Jump to navigation Jump to search
(→‎Getting Development Tools: "work" = build succeeded and can launch the viewer ...)
Line 6: Line 6:


* '''Xcode 3''': Most Lindens use Xcode 3.2 on Snow Leopard (OS X 10.6) for building on Macintosh computers. For simplicity, we suggest installing everything from the mpkg.  Note that later versions of Xcode have build options to be backwards compatible to 3.1.  (See [[Talk:Compiling_the_viewer_(Mac_OS_X)#Trying_newer_versions_of_tools]].  Later versions of Xcode (3.2.4) work fine.)
* '''Xcode 3''': Most Lindens use Xcode 3.2 on Snow Leopard (OS X 10.6) for building on Macintosh computers. For simplicity, we suggest installing everything from the mpkg.  Note that later versions of Xcode have build options to be backwards compatible to 3.1.  (See [[Talk:Compiling_the_viewer_(Mac_OS_X)#Trying_newer_versions_of_tools]].  Later versions of Xcode (3.2.4) work fine.)
* '''Xcode 4''':  As of July 15 2012, XCode 4 is not yet officially supported. Still, [https://lists.secondlife.com/pipermail/opensource-dev/2011-November/008354.html experimental support] are offered for 4.2 on Lion. Some users find the experimental patch work even in Xcode 4.3.2.  
* '''Xcode 4''':  As of July 15 2012, XCode 4 is not yet officially supported. Still, [https://lists.secondlife.com/pipermail/opensource-dev/2011-November/008354.html experimental support] is offered for 4.2 on Lion. Some users find the patch there work even in 4.3.3.  
* '''CMake''': Install CMake from [http://www.cmake.org cmake.org], or using [http://macports.org/ MacPorts] with 'port install cmake'. You will need at least CMake 2.6; CMake 2.8 may be required in the future.
* '''CMake''': Install CMake from [http://www.cmake.org cmake.org], or using [http://macports.org/ MacPorts] with 'port install cmake'. You will need at least CMake 2.6; CMake 2.8 may be required in the future.
*'''Command line Makefiles''':  These are included in Apple's Xcode product.  Download and install Xcode from Apple.
*'''Command line Makefiles''':  These are included in Apple's Xcode product.  Download and install Xcode from Apple.


= Downloading Source Code =
= Downloading Source Code =
Line 17: Line 18:




== Installing Proprietary Libraries ==
= Installing Proprietary Libraries =


Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the proprietary libraries).  Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages.  (This is due to licensing restrictions.  Don't ask, Lindens already did, and can't get permission.  So you do have to get them yourself.)
Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the proprietary libraries).  Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages.  (This is due to licensing restrictions.  Don't ask, Lindens already did, and can't get permission.  So you do have to get them yourself.)


=== Fmod ===
== Fmod ==


==== Fmod method 1 (using autobuild) ====
=== Fmod method 1 (using autobuild) ===


CD to where you want to install the 3p-fmod repository and do:
CD to where you want to install the 3p-fmod repository and do:
Line 45: Line 46:
</pre>
</pre>


==== Fmod method 2 (others) ====
=== Fmod method 2 (using system module) ===
 
(to be written)
 


(see {{jira|STORM-406}} and {{jira|OPEN-6}})
= Applying Patch (only for Xcode 4.2 and above, experimental) =
 
If you use Xcode 4.2 and above, you need to do these additional steps to succeed in building:
# Visit to https://codereview.secondlife.com/r/502/
# Login with your Review Board account. If you don't have it, click "Create one now" link and create one with your Second Life name.
# Right-click on '''Download Diff''' link on the right side and download the .diff file.
# Run:
<pre>
$ hg import --no-commit xcode-4.2-diff
</pre>
 
 
= Configuration and Building =
 
== With Autobuild ==


== Build the viewer with autobuild ==
Configuring and building with autobuild works the same on all platforms.  Full instructions may be found at [[Build_Viewer_With_Autobuild]].
Configuring and building with autobuild works the same on all platforms.  Full instructions may be found at [[Build_Viewer_With_Autobuild]].


== Xcode ==
Example:
<pre>
autobuild configure -c RelWithDebInfoOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE
autobuild build -c RelWithDebInfoOS --no-configure
</pre>
 
== On Xcode ==


If you  have followed the configure instructions from [[Build_Viewer_With_Autobuild]], the directory ''build-darwin-i386'' will have been created in the root of your source distribution.  Inside that directory you will find the ''SecondLife.xcodeproj'' project file which can be used with Xcode.  When opened it should be configured correctly to build, so just '''Build and Run'''.
If you  have followed the configure instructions from [[Build_Viewer_With_Autobuild]], the directory ''build-darwin-i386'' will have been created in the root of your source distribution.  Inside that directory you will find the ''SecondLife.xcodeproj'' project file which can be used with Xcode.  When opened it should be configured correctly to build, so just '''Build and Run'''.


== Where's the built viewer? ==


Assuming you build the RelWithDebug build configuration (the default), the viewer build will be in  <code>build-darwin-i386/newview/RelWithDebInfo/Second Life.app</code> .
= Running your newly built viewer =
{{KBnote|If you change the build configuration you use, the intermediate directory will also change accordingly, e.g. from <code>RelWithDebInfo</code> to <code>Release</code>. The files for the two configurations will not interfere with one another.}}
 
== On Console ==
 
In your source tree root directory, run:
<pre>
$build-darwin-i386/newview/[CONFIGURATION]/Second\ Life.app/Contents/MacOS/Second\ Life
</pre>
where [CONFIGURATION] depends on your built configuration ("Debug", "Release" or "RelWithDebInfo").
 
== On Xcode ==


One way to launch your newly compiled viewer is to  use the Finder to navigate  to that folder and double click the application.  Another way is to create an alias for it.  Then you can put the alias wherever you find convenient.
"secondlife-bin" scheme is what you look for.


= Building the Unit Tests =
== Using Finder ==
From Xcode, open the project 'linden/indra/test/MacTester.xcodeproj', set 'MacTester' as the active target, and build.


= What to do if it doesn't work for you =
# Navigate to ''build-darwin-i386/newview/[CONFIGURATION]''.
# Double click the application.
:You can create and put the alias wherever you find convenient.
 
 
= Running the Unit Tests =
 
From Xcode, open the project ''build-darwin-i386/test/test.xcodeproj'' and select "test" for scheme and run. ''SecondLife.xcodeproj'' project also has "test" scheme.
 
 
= Handling Problems =
 
== Seeking Solution ==
If you encounter errors or run into problems following the instructions above, please first check whether someone else already had the same issue. A solution might be known already.
 
You may find the solution in any of these resources:
* [[{{TALKPAGENAME}}|This talk page]] (Report useful experiences there)
* [[#Common_Issues.2FBugs.2FGlitches_And_Solutions|Issue list below]] (If new issues, please add it to talk page above instead of there)
* [[Talk:Microsoft_Windows_Builds|Old talk page]]
* [[Common compilation problems]] (Rather old)
* [[Issue tracker]]


* Ask for help on [[IRC]] (irc.freenode.net #opensl)
* Ask for help on the [[SLDev|Opensource-dev mailing list]]
* Fix it: [[Modifying CMake Files‎]] and please, submit a patch!
* Fix it: [[Modifying CMake Files‎]] and please, submit a patch!


= Submitting Patches =
== Getting Help ==
Even when no description of your problem has been written down yet, someone might know about it, so get in touch with the community to get help.
 
* Subscribe to [[OpenSource-Dev|OpenSource-Dev Mailing List]] ([https://lists.secondlife.com/cgi-bin/mailman/listinfo/opensource-dev subscribe]) and post your question there.
* For faster response, join the general open source viewer discussion and development [[IRC]] channel [irc://irc.freenode.org/opensl #opensl on freenode].  Hopefully a helpful person is online when you ask your question.
 
== Submitting Patches ==
This is probably far down the road, but if you make changes to the source and want to submit them, see the page about [[Submitting patches|submitting patches]].
This is probably far down the road, but if you make changes to the source and want to submit them, see the page about [[Submitting patches|submitting patches]].


[[Category:Compiling viewer]]
[[Category:Compiling viewer]]

Revision as of 07:02, 16 June 2012

For recent information check the Project Snowstorm page.

Getting Development Tools

  • Xcode 3: Most Lindens use Xcode 3.2 on Snow Leopard (OS X 10.6) for building on Macintosh computers. For simplicity, we suggest installing everything from the mpkg. Note that later versions of Xcode have build options to be backwards compatible to 3.1. (See Talk:Compiling_the_viewer_(Mac_OS_X)#Trying_newer_versions_of_tools. Later versions of Xcode (3.2.4) work fine.)
  • Xcode 4: As of July 15 2012, XCode 4 is not yet officially supported. Still, experimental support is offered for 4.2 on Lion. Some users find the patch there work even in 4.3.3.
  • CMake: Install CMake from cmake.org, or using MacPorts with 'port install cmake'. You will need at least CMake 2.6; CMake 2.8 may be required in the future.
  • Command line Makefiles: These are included in Apple's Xcode product. Download and install Xcode from Apple.


Downloading Source Code

Linden Lab Project Snowstorm uses Mercurial and Bit Bucket for the version control repository. The repository is here. Look vor viewer-development, viewer-beta, viewer-release, and others, as your needs dictate. If you're just starting out, it's probably best to get viewer-release or viewer-beta , because viewer-developer gets updated several times per week. But if you would rather work with the latest code, look for the latest builds on Project Snowstorm and viewer-developer on bitbucket.


Installing Proprietary Libraries

Some builds of the the Viewer depends on proprietary libraries (alternative open source libraries are also provided for developers who prefer or are not licensed to use the proprietary libraries). Lindens do not distribute these libraries, so you will need to fetch and install these even if you download the libraries packages. (This is due to licensing restrictions. Don't ask, Lindens already did, and can't get permission. So you do have to get them yourself.)

Fmod

Fmod method 1 (using autobuild)

CD to where you want to install the 3p-fmod repository and do:

$ hg clone https://bitbucket.org/lindenlab/3p-fmod
$ cd 3p-fmod
$ autobuild build --all
$ autobuild package

You will see the result looks like:

packing fmod
wrote  /3p-fmod/fmod-3.75-darwin-20120614.tar.bz2
md5    527422281dbe49abac29380996d41230

CD to your repository root and update autobuild configulation file with the filename and hash just displayed. For the example above, run:

 
$ autobuild installables edit fmod platform=darwin hash=527422281dbe49abac29380996d41230 url=file:///3p-fmod/fmod-3.75-darwin-20120614.tar.bz2

Fmod method 2 (using system module)

(to be written)


Applying Patch (only for Xcode 4.2 and above, experimental)

If you use Xcode 4.2 and above, you need to do these additional steps to succeed in building:

  1. Visit to https://codereview.secondlife.com/r/502/
  2. Login with your Review Board account. If you don't have it, click "Create one now" link and create one with your Second Life name.
  3. Right-click on Download Diff link on the right side and download the .diff file.
  4. Run:
$ hg import --no-commit xcode-4.2-diff 


Configuration and Building

With Autobuild

Configuring and building with autobuild works the same on all platforms. Full instructions may be found at Build_Viewer_With_Autobuild.

Example:

autobuild configure -c RelWithDebInfoOS -- -DLL_TESTS:BOOL=FALSE -DPACKAGE:BOOL=FALSE -DFMOD:BOOL=TRUE
autobuild build -c RelWithDebInfoOS --no-configure

On Xcode

If you have followed the configure instructions from Build_Viewer_With_Autobuild, the directory build-darwin-i386 will have been created in the root of your source distribution. Inside that directory you will find the SecondLife.xcodeproj project file which can be used with Xcode. When opened it should be configured correctly to build, so just Build and Run.


Running your newly built viewer

On Console

In your source tree root directory, run:

$build-darwin-i386/newview/[CONFIGURATION]/Second\ Life.app/Contents/MacOS/Second\ Life

where [CONFIGURATION] depends on your built configuration ("Debug", "Release" or "RelWithDebInfo").

On Xcode

"secondlife-bin" scheme is what you look for.

Using Finder

  1. Navigate to build-darwin-i386/newview/[CONFIGURATION].
  2. Double click the application.
You can create and put the alias wherever you find convenient.


Running the Unit Tests

From Xcode, open the project build-darwin-i386/test/test.xcodeproj and select "test" for scheme and run. SecondLife.xcodeproj project also has "test" scheme.


Handling Problems

Seeking Solution

If you encounter errors or run into problems following the instructions above, please first check whether someone else already had the same issue. A solution might be known already.

You may find the solution in any of these resources:

Getting Help

Even when no description of your problem has been written down yet, someone might know about it, so get in touch with the community to get help.

Submitting Patches

This is probably far down the road, but if you make changes to the source and want to submit them, see the page about submitting patches.