Difference between revisions of "Building the Viewer with Autobuild"

From Second Life Wiki
Jump to navigation Jump to search
(Remove redundant 64-bit info.)
 
(9 intermediate revisions by 4 users not shown)
Line 10: Line 10:
You can use the argument:
You can use the argument:
   -A {32,64}, --address-size {32,64}
   -A {32,64}, --address-size {32,64}
or you can set the environment variable AUTOBUILD_ADDRSIZE to either 32 or 64
or you can set the environment variable <code>AUTOBUILD_ADDRSIZE</code> to either <code>32</code> or <code>64</code>
  export AUTOBUILD_ADDRSIZE={32,64}
 
'''Note:  OSX only supports 64 bit.'''


===Select Build Variables===
===Select Build Variables===


In order to make it easier to build collections of related packages (such as the viewer and all the library packages that it imports) with the same compilation options, the autobuild source_environment command expects a file of variable definitions. This can be set using the environmenat variable AUTOBUILD_VARIABLES_FILE
The <code>AUTOBUILD_VARIABLES_FILE</code> environment variable is used by <code>autobuild</code> to allow collections of related packages (such as the viewer and all the library packages that it imports) to be built with matching compilation options.  This config file lives in a separate repository from the <b><tt>viewer</tt></b> itself.  Clone it next to your <b><tt>viewer</tt></b> repository and checkout the branch called <b><tt>viewer</tt></b>:
git clone https://github.com/secondlife/build-variables
cd build_variables
git checkout viewer
 
If you examine the contents of the <b><tt>build-variables/variables</tt></b> file you'll see the details of what configuration values are being set.  These variables are used by the CMake configuration step which is invoked by <b><tt>autobuild</tt></b>.
 
From within the <b><tt>viewer</tt></b> repository you can source the <b><tt>variables</tt></b> config file during the <code>source_environment</code> step like so:
autobuild source_environment ../build_variables/variables


Instead of sourcing the <b><tt>variables</tt></b> file explicitly, and easier for long term development, you can create an <b><tt>AUTOBUILD_VARIABLES_FILE</tt></b> environment variable by putting this in your <b><tt>.bashrc</tt></b> file (when using a bash terminal), or more globally by adding it to the Windows environment variables configuration:
  export AUTOBUILD_VARIABLES_FILE=''<path-to-your-variables-file>''
  export AUTOBUILD_VARIABLES_FILE=''<path-to-your-variables-file>''


In the Linden viewer builds, that file is in the repository
With that done you can just:
  https://bitbucket.org/lindenlab/viewer-build-variables
  autobuild source_environment
 
You will need to clone a copy of that repository and set the environment variable to point to the <tt>variables</tt> file in the top level of your working copy.; modify it with caution or you may need to recompile all the packages...


=== Build a desired configuration ===
=== Build a desired configuration ===
With a properly configured developer machine (see [[Get_source_and_compile#Compiling| compiling]]), building the viewer with ''autobuild'' is as simple as invoking
With a properly configured developer machine (see [[Get_source_and_compile#Compiling| compiling]]), building the viewer with <code>autobuild</code> is as simple as invoking
   autobuild build -c [CONFIGURATION]
   autobuild build -c [CONFIGURATION]
where '''CONFIGURATION''' stands for the build configuration you would like to build.  The build configurations defined in the viewer's ''autobuild.xml'' file follow some simple conventions which we describe below.  As a developer you should choose the appropriate build configuration for your needs.  After a build has completed, the resulting product will be found in the build directory named ''build-*'' where the ''*'' is wildcard representing the platform dependent part of the name.
where <b><tt>CONFIGURATION</tt></b> stands for the build configuration you would like to build.  The build configurations defined in the viewer's <b><tt>autobuild.xml</tt></b> file follow some simple conventions which we describe below.  As a developer you should choose the appropriate build configuration for your needs.  After a build has completed, the resulting product will be found in the build directory named <b><tt>build-*</tt></b> where the <b><tt>*</tt></b> is wildcard representing the platform dependent part of the name.


Developers who wish to build a viewer with an IDE don't have to do a full command line build.  Using
Developers who wish to build a viewer with an IDE don't have to do a full command line build.  Using
   autobuild configure -c [CONFIGURATION]
   autobuild configure -c [CONFIGURATION]
Will install any dependencies (if the build configuration uses them) and construct an appropriate project or solution file (''.xcodeproj'' for mac and ''.sln'' for windows) inside the build directory.
Will install any dependencies (if the build configuration uses them) and construct an appropriate project or solution file (<b><tt>.xcodeproj</tt></b> for mac and <b><tt>.sln</tt></b> for windows) inside the build directory.
   
   
==== Linden build configurations ====
==== Linden build configurations ====
Line 36: Line 46:
* '''RelWithDebInfo''' &mdash; optimized but with debugging information.
* '''RelWithDebInfo''' &mdash; optimized but with debugging information.
* '''Release''' &mdash; optimized with no debug information.
* '''Release''' &mdash; optimized with no debug information.
'''RelWithDebInfo''' is usually easy to debug, but code optimizations may occasionally make tracking program flow in a debugger challenging.  '''Release''' is used for building a shipping version of the viewer; it may be hard to debug because it does not preserve all debugging information.
'''RelWithDebInfo''' is usually easy to debug, but code optimizations may occasionally make tracking program flow in a debugger challenging.  <code>Release</code> is used for building a shipping version of the viewer; it may be hard to debug because it does not preserve all debugging information.


==== Installables ====
==== Installables ====
Line 44: Line 54:


The unmodified build configurations defined in the previous section are configured for use by Linden developers and may require access to installables which are not publicly available.  For open source developers a variation is provided to support development by third parties using special configuration names that end in '''OS'''.  For example, to build a viewer with release optimization including debug information run
The unmodified build configurations defined in the previous section are configured for use by Linden developers and may require access to installables which are not publicly available.  For open source developers a variation is provided to support development by third parties using special configuration names that end in '''OS'''.  For example, to build a viewer with release optimization including debug information run
autobuild build -c RelWithDebInfoOS


Note that there might still be issues with FMOD in the *OS buildsOne possible fix is to explicitly disable the improper download of FMOD using
  autobuild build -c RelWithDebInfoOS
autobuild build -c ReleaseOS -- -DFMOD:BOOL=FALSE
 
The Fmod audio component is not publicly available as an autobuild package. To build without Fmod, use:
   
  autobuild build -c ReleaseOS -- -DFMOD:BOOL=FALSE
 
To build with Fmod, you will need to build your own.
 
You will need to create an account with https://www.fmod.com/ & email them to get access to the older fmodex source.
It's free for indie developers - https://www.fmod.com/licensing
 
autobuild build --all
autobuild package
 
When you have an autobuild package, you must modify the viewer build to use the one you built:
 
autobuild installables edit 'fmodex' url='file:/<path-to-your-package>'


==== Use no installables ====
==== Use no installables ====
{{KBwarning|Building with system libraries rather than autobuild installables is '''not officially supported'''. Thus, it is '''not tested''' routinely and might be broken any time.}}
{{KBwarning|Building with system libraries rather than autobuild installables is '''not officially supported'''. Thus, it is '''not tested''' routinely and might be broken any time.}}
It is theoretically possible to build the viewer only using libraries installed to your system, rather than installing Linden Lab-supplied installables into the source tree checkout. The cmake variable that controls this is USE_SYSTEMLIBS.
It is theoretically possible to build the viewer only using libraries installed to your system, rather than installing Linden Lab-supplied installables into the source tree checkout. The cmake variable that controls this is USESYSTEMLIBS.
{{KBcaution|To build with "USE_SYSTEMLIBS" on, you have to install any 3<sup>rd</sup> party dependencies manually.}}
{{KBcaution|To build with "USESYSTEMLIBS" on, you have to install any 3<sup>rd</sup> party dependencies manually.}}
Use the <code>*OS</code> configurations and manually switch the <code>USE_SYSTEMLIBS</code> CMake variable to <code>ON</code>. For example, to build a viewer with release optimization including debug information run  
Use the <code>*OS</code> configurations and manually switch the <code>USESYSTEMLIBS</code> CMake variable to <code>ON</code>. For example, to build a viewer with release optimization including debug information run  
  autobuild configure -c RelWithDebInfoOS -- -DUSE_SYSTEMLIBS=ON
  autobuild configure -c RelWithDebInfoOS -- -DUSESYSTEMLIBS=ON
  autobuild build -c RelWithDebInfoOS --no-configure
  autobuild build -c RelWithDebInfoOS --no-configure


==== Custom builds ====
==== Custom builds ====
If none of the predefined build configurations matches your needs, you have two options for building with exactly the options you need.  If you just need to pass an extra configuration option, you should first run the ''configure'' command with the following syntax
If none of the predefined build configurations matches your needs, you have two options for building with exactly the options you need.  If you just need to pass an extra configuration option, you should first run the <b><tt>configure</tt></b> command with the following syntax
   autobuild configure -c [build configuration] -- [Option, [Option...]]
   autobuild configure -c [build configuration] -- [Option, [Option...]]
Options which appear after the '''--''' are passed through to the configuration command.  Now you may build using
Options which appear after the '''--''' are passed through to the configuration command.  Now you may build using
   autobuild build -c [build configuration] --no-configure -- [Option, [Option]]
   autobuild build -c [build configuration] -A 64 --no-configure -- [Option, [Option]]
passing any options that should be forwarded to the build command after the '''--'''.  Using the ''--no-configure'' option prevents the configure step from being run again (potentially reverting any option you passed) during the build step.
passing any options that should be forwarded to the build command after the '''--'''.  Using the ''--no-configure'' option prevents the configure step from being run again (potentially reverting any option you passed) during the build step.


Alternatively you may add a new configuration to the ''autobuild.xml'' configuration file using
Alternatively you may add a new configuration to the <b><tt>autobuild.xml</tt></b> configuration file using
   autobuild edit configure
   autobuild edit configure
and
and
   autobuild edit build
   autobuild edit build
to interactively create new configure and build configurations.  More information on creating these configurations may be found in the [[Autobuild_How_To]] page.
to interactively create new configure and build configurations.  More information on creating these configurations may be found in the [[Autobuild_How_To]] page.


=== OSX 10.14 build issues ===
'''Build aborts due to 10.13sdks not found'''
* Verify that build-variables is up to date and LL_BUILD_DARWIN_BASE_SWITCHES points to a valid SDK.
* source variables and rerun config and build.
* If the above does not work
** In XCode Project Navigator, select SecondLife
** Under BuildSettings, change Base SDK to MacOS
'''In XCode, build aborts with libtool: can’t open file: HAVOK_DEBUG_LIB_hkBase-NOTFOUND'''
* Under Product|Scheme select Edit Scheme
* In the Info pane, change the Build Configuration to Release
[[Category:Autobuild]]
[[Category:Autobuild]]

Latest revision as of 11:14, 6 April 2023


Install autobuild

KBwarning.png Warning: If you are building for Windows go here Viewer_2_Microsoft_Windows_Builds and do not follow these instructions.

If you haven't done so already, install autobuild. Full documentation can be found on the Autobuild page.

Set desired address size

As of autobuild 1.1, you must specify the desired pointer size for your builds.

You can use the argument:

 -A {32,64}, --address-size {32,64}

or you can set the environment variable AUTOBUILD_ADDRSIZE to either 32 or 64

 export AUTOBUILD_ADDRSIZE={32,64}

Note: OSX only supports 64 bit.

Select Build Variables

The AUTOBUILD_VARIABLES_FILE environment variable is used by autobuild to allow collections of related packages (such as the viewer and all the library packages that it imports) to be built with matching compilation options. This config file lives in a separate repository from the viewer itself. Clone it next to your viewer repository and checkout the branch called viewer:

git clone https://github.com/secondlife/build-variables
cd build_variables
git checkout viewer

If you examine the contents of the build-variables/variables file you'll see the details of what configuration values are being set. These variables are used by the CMake configuration step which is invoked by autobuild.

From within the viewer repository you can source the variables config file during the source_environment step like so:

autobuild source_environment ../build_variables/variables

Instead of sourcing the variables file explicitly, and easier for long term development, you can create an AUTOBUILD_VARIABLES_FILE environment variable by putting this in your .bashrc file (when using a bash terminal), or more globally by adding it to the Windows environment variables configuration:

export AUTOBUILD_VARIABLES_FILE=<path-to-your-variables-file>

With that done you can just:

autobuild source_environment

Build a desired configuration

With a properly configured developer machine (see compiling), building the viewer with autobuild is as simple as invoking

 autobuild build -c [CONFIGURATION]

where CONFIGURATION stands for the build configuration you would like to build. The build configurations defined in the viewer's autobuild.xml file follow some simple conventions which we describe below. As a developer you should choose the appropriate build configuration for your needs. After a build has completed, the resulting product will be found in the build directory named build-* where the * is wildcard representing the platform dependent part of the name.

Developers who wish to build a viewer with an IDE don't have to do a full command line build. Using

 autobuild configure -c [CONFIGURATION]

Will install any dependencies (if the build configuration uses them) and construct an appropriate project or solution file (.xcodeproj for mac and .sln for windows) inside the build directory.

Linden build configurations

There are two basic types of build configurations which are used to vary the debuggability of the resulting build versus optimization. These configurations are:

  • RelWithDebInfo — optimized but with debugging information.
  • Release — optimized with no debug information.

RelWithDebInfo is usually easy to debug, but code optimizations may occasionally make tracking program flow in a debugger challenging. Release is used for building a shipping version of the viewer; it may be hard to debug because it does not preserve all debugging information.

Installables

Lindens please see also https://wiki.lindenlab.com/wiki/Autobuild/Installables .

Configurations for non-Linden developers

The unmodified build configurations defined in the previous section are configured for use by Linden developers and may require access to installables which are not publicly available. For open source developers a variation is provided to support development by third parties using special configuration names that end in OS. For example, to build a viewer with release optimization including debug information run

 autobuild build -c RelWithDebInfoOS

The Fmod audio component is not publicly available as an autobuild package. To build without Fmod, use:

 autobuild build -c ReleaseOS -- -DFMOD:BOOL=FALSE

To build with Fmod, you will need to build your own.

You will need to create an account with https://www.fmod.com/ & email them to get access to the older fmodex source. It's free for indie developers - https://www.fmod.com/licensing

autobuild build --all
autobuild package

When you have an autobuild package, you must modify the viewer build to use the one you built:

autobuild installables edit 'fmodex' url='file:/<path-to-your-package>'

Use no installables

KBwarning.png Warning: Building with system libraries rather than autobuild installables is not officially supported. Thus, it is not tested routinely and might be broken any time.

It is theoretically possible to build the viewer only using libraries installed to your system, rather than installing Linden Lab-supplied installables into the source tree checkout. The cmake variable that controls this is USESYSTEMLIBS.

KBcaution.png Important: To build with "USESYSTEMLIBS" on, you have to install any 3rd party dependencies manually.

Use the *OS configurations and manually switch the USESYSTEMLIBS CMake variable to ON. For example, to build a viewer with release optimization including debug information run

autobuild configure -c RelWithDebInfoOS -- -DUSESYSTEMLIBS=ON
autobuild build -c RelWithDebInfoOS --no-configure

Custom builds

If none of the predefined build configurations matches your needs, you have two options for building with exactly the options you need. If you just need to pass an extra configuration option, you should first run the configure command with the following syntax

 autobuild configure -c [build configuration] -- [Option, [Option...]]

Options which appear after the -- are passed through to the configuration command. Now you may build using

 autobuild build -c [build configuration] -A 64 --no-configure -- [Option, [Option]]

passing any options that should be forwarded to the build command after the --. Using the --no-configure option prevents the configure step from being run again (potentially reverting any option you passed) during the build step.

Alternatively you may add a new configuration to the autobuild.xml configuration file using

 autobuild edit configure

and

 autobuild edit build

to interactively create new configure and build configurations. More information on creating these configurations may be found in the Autobuild_How_To page.

OSX 10.14 build issues

Build aborts due to 10.13sdks not found

  • Verify that build-variables is up to date and LL_BUILD_DARWIN_BASE_SWITCHES points to a valid SDK.
  • source variables and rerun config and build.
  • If the above does not work
    • In XCode Project Navigator, select SecondLife
    • Under BuildSettings, change Base SDK to MacOS

In XCode, build aborts with libtool: can’t open file: HAVOK_DEBUG_LIB_hkBase-NOTFOUND

  • Under Product|Scheme select Edit Scheme
  • In the Info pane, change the Build Configuration to Release