The current build system is based on the tool SCons (“Software Constructor”) with some extensions. scons.py
is implemented as a Python script.
You have multiple options for compiling Rosetta 3 with SCons. You can build either only the core libraries or both the libraries and the executables. Rosetta 3 can be compiled in two major modes:
Change directory to main/source
.
Type one of the following commands:
Build all binaries
./scons.py -j<number_of_processors_to_use> bin
./scons.py -j<number_of_processors_to_use> mode=release bin
Build a specific binary
Just passing the name works:
./scons.py -j<num_of_proc> mode=release extras=hdf5 rosetta_scripts
If you specify the path with bin/
you must also pass the correct extension:
./scons.py -j<num_of_proc> bin/rosetta_scripts.linuxgccdebug
./scons.py -j<num_of_proc> mode=release bin/rosetta_scripts.linuxgccrelease
Build libraries only
./scons.py -j<number_of_processors_to_use>
./scons.py -j<number_of_processors_to_use> mode=release
The -j8
flag would mean, “use at most 8 processes for building,” and can be reasonably set as the number of free processors on your machine. Be aware that setting -j
to a very high value will cause the operating system to have difficulty scheduling jobs.
By default scons hashes and processes every file in the tree before performing a build. On a large tree (e.g. rosetta) and filesystem with high io latency (e.g. a NFS or GPFS filesystem) this causes ridiculously slow build times. In order to improve build times disable file hashing and allow caching of build dependency metadata. Add the follow lines to the project’s root SConscript file:
Decider('MD5-timestamp') SetOption('implicit_cache', 1)
These settings are described on the scons gofast page.
By default, scons
uses GCC to compile. To use an alternate compiler, such as CLang, use the cxx
option:
./scons.py -j<number_of_processors_to_use> cxx=clang
To use an alternate version of the compiler, you can use the option cxx_ver option with whatever version you have (here 4.5):
./scons.py -j<number_of_processors_to_use> cxx=clang cxx_ver=4.5
For more build options, such as only compiling only one executable or apbs - Please take a look at the SConstruct File in main/source
If you get an error like /usr/bin/ld: cannot find -lz
, SCons may be looking for 32 bit libraries on a 64 bit machine. Look up how to install the missing dependency; in this case sudo apt-get install lib32z1-dev
installs the required library.