Difference between revisions of "Build the Viewer on macOS"

From Second Life Wiki
Jump to navigation Jump to search
m (Remove dead IRC channel information)
 
(15 intermediate revisions by 7 users not shown)
Line 2: Line 2:
{{CompileNav}}
{{CompileNav}}
{{TOC}}
{{TOC}}
{{KBcaution|custom=Attend Carefully|
The package versions and bit-widths listed below have been carefully selected and tested. If you decide to install a different version of a given package (even a minor update), you are on your own (but feel free to share your results.}}


==Getting Development Tools==
==Step 1. Install Requirements==


;Xcode 7
* [https://apps.apple.com/us/app/xcode/id497799835?mt=12 Xcode]
:Download Xcode 7 from Apple, and install the developer command line tools
* Python 3.7+
;CMake
* [https://git-scm.com/downloads Git]
:Install CMake (at least version 3.1) from [http://www.cmake.org cmake.org]
* [https://cmake.org/download/ CMake]
:You will need to arrange for the cmake executable to be in your PATH.
* [[Autobuild]]
:The executable is '<tt>/Applications/CMake.app/Contents/bin/cmake</tt>'; you can either add that directory to your path, or create a link to the executable in some directory already in your PATH.
;Mercurial
:Install the current Mercurial from [http://mercurial.selenic.com/downloads Selenic]
::If you may be contributing code back to the viewer, install the [[Mercurial_Tools#Coding_Policy|Mercurial Coding Policy hooks]]
;Autobuild 1.0
:Install the new version of autobuild as described on [[Autobuild]]


==Downloading Source Code==
You can install git and CMake using [https://brew.sh/ Homebrew] or their official installers.


The canonical repository is https://bitbucket.org/lindenlab/viewer-release
===Intermediate Check===


==Installing Proprietary Libraries==
Confirm things are installed properly so far by typing the following in a terminal:
cmake --version
python3 --version
git --version
autobuild --version


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.)
If everything reported sensible values and not "Command not found" errors, then you are in good shape!
 
===FMOD Ex===
 
PIck somewhere to build your fmodex package:


hg clone <nowiki>https://bitbucket.org/lindenlab/3p-fmodex</nowiki>
==Step 2. Checkout Code==
cd 3p-fmodex
autobuild build
autobuild package
 
If it works, it will produce a package archive file with a name like <tt>fmodex-4.44.31.201503051234-darwin-201503051234.tar.bz2</tt>
 
CD to your viewer repository root; you can either just override the configured archive with a --local install:


autobuild install --local ''path-to-your-fmodex-archive''
===Viewer===


That will cause autobuild to ignore the configured value and use your local package archive; if you delete your build directory, you'll need to repeat the override command.
Open a terminal and checkout the viewer source code:
git clone https://github.com/secondlife/viewer.git


To reconfigure your autobuild configuration file to use that archive:
===Build Variables===


autobuild installables edit fmodex url=file:///''path-to-your-fmodex-archive''
See [[Building the Viewer with Autobuild#Select Build Variables]]


but be careful not to commit that change, since it will be useless to anyone who can't access the path you configured.
==Step 3. Configure==


==Configuring==
Be sure you have the following environment variables set before continuing:


===Configuring your build with Autobuild===
AUTOBUILD_ADDRSIZE=64
AUTOBUILD_VARIABLES_FILE=<path to autobuild viewer variables>


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]].
Example:


  autobuild configure -c RelWithDebInfoOS  
  autobuild configure -c RelWithDebInfoOS  


if you built your own fmodex as above, add <tt>-- -DFMODEX:BOOL=TRUE</tt>
==Step 4. Build==


==Building==
===Option 1: Command Line Build===
 
===Command Line Build===


  autobuild build --no-configure
  autobuild build --no-configure
Line 70: Line 53:
you can omit the --no-configure option: if you do, autobuild will implicitly run the configuration step before building. That's harmless, it just takes some extra time, but be sure to include any configuration options such as that for fmodex above.
you can omit the --no-configure option: if you do, autobuild will implicitly run the configuration step before building. That's harmless, it just takes some extra time, but be sure to include any configuration options such as that for fmodex above.


===Building within Xcode===
===Option 2: Build in Xcode===


Once you have run the <tt>autobuild configure</tt> step, 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'''.
Once you have run the <tt>autobuild configure</tt> step, the directory ''build-darwin-x86_64'' 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 it prompts you to automatically create schemes, let it do so.


==Running your newly built viewer==
===Running your newly built viewer===


===Command Line===
====Option 1: Command Line====


In your source tree root directory, run:
To launch the viewer you build, from your source tree root directory, run:


build-darwin-i386/newview/''configuration-type''/Second\ Life.app/Contents/MacOS/Second\ Life
  open build-darwin-x86_64/newview/''configuration-type''/Second\ Life.app


where ''configuration-type'' depends on your built configuration ("DebugOS", "ReleaseOS" or "RelWithDebInfoOS").
where ''configuration-type'' depends on your built configuration ("DebugOS", "ReleaseOS" or "RelWithDebInfoOS").


===Running within Xcode===
====Option 2: Running Within Xcode====


"secondlife-bin" scheme is what you look for.
"secondlife-bin" scheme is what you look for.
Line 90: Line 73:
When running from the XCode IDE be sure to go to '''Product''' &rarr; '''Scheme''' &rarr; '''Edit Scheme''' menu. Select the '''Run''' section and uncheck the box labeled "Allow debugging when using document Versions Browser" on the '''Options''' tab. ([https://lists.secondlife.com/pipermail/opensource-dev/2014-February/009784.html See this thread.])
When running from the XCode IDE be sure to go to '''Product''' &rarr; '''Scheme''' &rarr; '''Edit Scheme''' menu. Select the '''Run''' section and uncheck the box labeled "Allow debugging when using document Versions Browser" on the '''Options''' tab. ([https://lists.secondlife.com/pipermail/opensource-dev/2014-February/009784.html See this thread.])


===Using Finder===
====Option 3: Using Finder====


# Navigate to <tt>build-darwin-i386/newview/''configuration-type''</tt>.
# Navigate to <tt>build-darwin-x86_64/newview/''configuration-type''</tt>.
# Double click the application.
# Double click the application.
:You can create and put the alias wherever you find convenient.
:You can create and put the alias wherever you find convenient.


==Running the Unit Tests==
===Running Unit Tests===
 
From Xcode, open the project ''build-darwin-x86_64/test/test.xcodeproj'' and select "test" for scheme and run. ''SecondLife.xcodeproj'' project also has "test" scheme.
 
===Optional: 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.)
 
====Optional: FMOD Ex====
 
Pick somewhere to build your fmodex package:
 
hg clone <nowiki>https://bitbucket.org/lindenlab/3p-fmodex</nowiki>
cd 3p-fmodex
autobuild build
autobuild package
 
If it works, it will produce a package archive file with a name like <tt>fmodex-4.44.31.201503051234-darwin-201503051234.tar.bz2</tt>
 
CD to your viewer repository root; you can either just override the configured archive with a --local install:
 
autobuild install --local ''path-to-your-fmodex-archive''
 
That will cause autobuild to ignore the configured value and use your local package archive; if you delete your build directory, you'll need to repeat the override command.
 
To reconfigure your autobuild configuration file to use that archive:
 
autobuild installables edit fmodex url=file:///''path-to-your-fmodex-archive''
 
but be careful not to commit that change, since it will be useless to anyone who can't access the path you configured.
 
Now, reconfigure your viewer build to use FMod instead of the open source OpenAL library:


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.
cd viewer # Go back to viewer checkout directory
autobuild configure -c RelWithDebInfoOS -- -DFMODEX:BOOL=TRUE


==Handling Problems==
==Handling Problems==
Line 118: Line 133:


* Subscribe to [[OpenSource-Dev|OpenSource-Dev Mailing List]] ([https://lists.secondlife.com/cgi-bin/mailman/listinfo/opensource-dev subscribe]) and post your question there.
* 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.


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

Latest revision as of 13:41, 17 November 2022

Step 1. Install Requirements

You can install git and CMake using Homebrew or their official installers.

Intermediate Check

Confirm things are installed properly so far by typing the following in a terminal:

cmake --version
python3 --version
git --version
autobuild --version

If everything reported sensible values and not "Command not found" errors, then you are in good shape!

Step 2. Checkout Code

Viewer

Open a terminal and checkout the viewer source code:

git clone https://github.com/secondlife/viewer.git

Build Variables

See Building the Viewer with Autobuild#Select Build Variables

Step 3. Configure

Be sure you have the following environment variables set before continuing:

AUTOBUILD_ADDRSIZE=64
AUTOBUILD_VARIABLES_FILE=<path to autobuild viewer variables>

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

autobuild configure -c RelWithDebInfoOS 

Step 4. Build

Option 1: Command Line Build

autobuild build --no-configure

you can omit the --no-configure option: if you do, autobuild will implicitly run the configuration step before building. That's harmless, it just takes some extra time, but be sure to include any configuration options such as that for fmodex above.

Option 2: Build in Xcode

Once you have run the autobuild configure step, the directory build-darwin-x86_64 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 it prompts you to automatically create schemes, let it do so.

Running your newly built viewer

Option 1: Command Line

To launch the viewer you build, from your source tree root directory, run:

 open build-darwin-x86_64/newview/configuration-type/Second\ Life.app

where configuration-type depends on your built configuration ("DebugOS", "ReleaseOS" or "RelWithDebInfoOS").

Option 2: Running Within Xcode

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

When running from the XCode IDE be sure to go to ProductSchemeEdit Scheme menu. Select the Run section and uncheck the box labeled "Allow debugging when using document Versions Browser" on the Options tab. (See this thread.)

Option 3: Using Finder

  1. Navigate to build-darwin-x86_64/newview/configuration-type.
  2. Double click the application.
You can create and put the alias wherever you find convenient.

Running Unit Tests

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

Optional: 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.)

Optional: FMOD Ex

Pick somewhere to build your fmodex package:

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

If it works, it will produce a package archive file with a name like fmodex-4.44.31.201503051234-darwin-201503051234.tar.bz2

CD to your viewer repository root; you can either just override the configured archive with a --local install:

autobuild install --local path-to-your-fmodex-archive

That will cause autobuild to ignore the configured value and use your local package archive; if you delete your build directory, you'll need to repeat the override command.

To reconfigure your autobuild configuration file to use that archive:

autobuild installables edit fmodex url=file:///path-to-your-fmodex-archive

but be careful not to commit that change, since it will be useless to anyone who can't access the path you configured.

Now, reconfigure your viewer build to use FMod instead of the open source OpenAL library:

cd viewer # Go back to viewer checkout directory
autobuild configure -c RelWithDebInfoOS -- -DFMODEX:BOOL=TRUE

Handling Problems

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.