View topic - Yafaray: Step by Step guide for compilation and installation

Yafaray: Step by Step guide for compilation and installation

Users-contributed CVS development builds. Post here your questions about compiling the source code.

Yafaray: Step by Step guide for compilation and installation

Post Tue Nov 06, 2007 8:19 pm

As a lot of people are requesting Package files for Yafaray, but no one here seems to be capable/willing to do that,
I decided to give a step by step instruction on how to compile Blender and Yaf(a)ray yourself.
That does also have the advantage of allowing optimized builds so might end up with a better build than the Package maintainers,
because you can optimize it for your own computer. It does also hold the potential risk of ending up with garbage if do it wrong,
though.



Foreword and Notes:
    Whenever I write "username" or "x.xx" in a foldername, you have to replace that with the proper name of course.
    If my username is "eddy" for example, and I use Blender 2.45, you have to replace
    '/home/username/blender-x.xx/' with '/home/eddy/blender-2.45/'

    If you get an error while doing something in the console, check if you replaced all placeholders first..
    You will have to replace at least one placeholder in nearly every line of "code" I delivered here.

    If there is something that has to be done in another way depending on the Linux Distribution you are on, it is announced
    with a Distribution.
    Steps that should count for every Distro are marked with General

    Also note that this doesn't deliver a working guarantee, especially as I only know Ubuntu and Gentoo myself.

    Also important:
    This guide is far from being finished, but will be extended with time.
    Below is a list with steps that I have on my list right now to add, and a kind of "Version log":
    It might give you some information if something goes wrong

Priority list and Version log:
05.11.07
What's in:
-Second Version
-guide for Gentoo Linux
-geeting Scons and subversion (gentoo)
-getting the sourcecode (general)
-organising the sourcecode (general)
-configuring the build
-building (general)
-installing (gentoo, general if you know how to get root access on your os)

Priority List of what to do:
-installing the dependencies (Gentoo) NOTE:The most probable reason if you get compiler errors right now
-"Translation" to Ubuntu/Debian
-optimization Flags
-"Translation" to Suse


If you can deliver help for any other distro, it would be great if you could post it/pm me.
I will integrate it into the guide then, and it is mostly just some few lines of code.

1. getting Scons and subversion
Gentoo:
    open up a console and get root acces with su:
    Code: Select all
    su

    make sure to have your portage tree updated and emerge Scons and subversion:
    Code: Select all
    emerge --sync
    emerge scons
    emerge subversion


2. getting the sourcecode
General:
    use a web browser of your choice to download the Blender source code:
    Go to http://www.blender.org/download/source-code/ and download the file listed.
    assuming that you saved the file to '/home/username/'
    either go there and unpack it with a programme of your choice or
    alternatively open up a console and type:
    Code: Select all
    tar xfv blender-x.xx.tar.gz
    (where x.xx stands for the Version number, eg. 2.45)
    The code will then be extracted to the folder '/home/username/blender-x.xx'

    open up a console and use subversion to get the Yaf(a)ray code:
    Code: Select all
    svn co https://ssl.little-isp.de/svn/lynx/yafaray/mainline/ yafaray

    this will download the code to the directory '/home/username/yafaray'
    You might get a certificate validation message and the option to either reject,
    temporarily accept or permanently accept the certificate.
    To get the code, press either p (permanently) or t (temporarily)
    If you don't know what to do, press "t" to be on the save side

    now get the Blender export code:
    Code: Select all
    svn co https://ssl.little-isp.de/svn/lynx/yafaray/blender/

    this saves the export code to '/home/username/blender'

3. organising the sourcecode
Now you need to copy some files from the subversion libraries to the Blender
Folder you just unpacked to add Yaf(a)ray compatibility and break Yafray compatibility:

General
    Open up your file Browser and go to the blender export code directory you downloaded via subversion
    You will find a folde called 'yafray' that you must copy over the equally called folder in
    'blender-x.xx/source/blender/'

    You can also do this in a console window, simply type:
    Code: Select all
    cp -R '/home/username/blender/yafray' '/home/username/blender-x.xx/source/blender/'


    Do also copy the exporter script to the Blender scripts directory (can be done afterwards, but why not do it directly?)
    You will find it in '/home/username/blender/' and it is called yafaray-ui.py.
    It needs to be copied to '/home/thomas/blender-x.xx/release/scripts'.

    for command line:
    Code: Select all
    cp '/home/username/blender/yafaray_ui.py' '/home/username/blender-x.xx/release/scripts/'


    now we need to make a correction in the SConscript file for the export code:
    use an text editor of your choice to correct one lines in the file
    '/home/username/blender-x.xx/source/blender/yafray/SConscript'
    the line
    incs += ' /home/lynx/coding/yafaray/include /home/lynx/coding/yafaray'

    needs to be changed to
    incs += ' /home/username/yafaray/include /home/username/yafaray'


4. settings (optional but recommended)
4.1: Adjusting settings for Blender using the user-config.py
General
    The 'user-config.py' is a file that controls the build settings for Scons to use during compilation.
    It is far more important for Blender than for Yaf(a)ray, as a wrong setup can lead to build errors that tend to be very annoying.
    The file is not existant by default, but must be created by yourself.
    As it is not auto-generated, you will have to make sure that you don't make any typos, otherwise the setting you just set might be ignored.
    So let's start:
    Open a Text editor of your choice and add the following lines:
    Code: Select all
    WITH_BF_OPENAL = 'false'
    WITH_BF_GAMEENGINE='false'
    WITH_BF_BULLET = 'false'
    WITH_BF_INTERNATIONAL = 'false'
    WITH_BF_ODE = 'false'
    WITH_BF_OPENEXR = 'false'
    WITH_BF_FTGL = 'false'
    WITH_BF_FMOD = 'false'
    WITH_BF_SDL = 'true'
    WITH_BF_FFMPEG = 'false'
    WITH_BF_QUICKTIME = 'false'
    BF_PYTHON_VERSION = '2.5'


    This will create a very cut-down Version of Blender that you should now configure to your preferences.
    leaving these settings is NOT recommended
    Generally: Setting things to 'false' disables them, setting them to 'true' enables them!
    The more settings are disabled, the less dependencies you'll have to satisfy
    Here are the options explained:
    Code: Select all
    WITH_BF_OPENAL = ''

    Enables the use of OpenAl if you want to use sound (As far as I know only used in games)
    From my experience OpenAl support is the biggest source of compiling errors, and if you don't make games you won't need it,
    so I recommend to disable it.

    Code: Select all
    WITH_BF_GAMEENGINE=''

    Enables the Blender Gameengine. Remember that you'll have to use the Game Engine if you do physics calculations (animations).
    The GE doesn't require any dependencies as far as I know

    Code: Select all
    WITH_BF_BULLET = ''

    Enables the bullet Physics engine for the Game Engine. If you compiled with Game Engine enabled, this should be set to 'true' as well,
    if not, it is pretty much senseless to activate

    Code: Select all
    WITH_BF_INTERNATIONAL = ''

    Set to true if you want to use different languages than english
    As far as I know blender translation is still kind of unfinished, and tutorials with other languages are rare, so I mainly recommend
    to disable it, but if you like to choose a different language, enable it.

    Code: Select all
    WITH_BF_ODE = ''

    ODE is a Rigid body library and should be enabled if you use the GameEngine. I don't know what happens if it is disabled, honestly.

    Code: Select all
    WITH_BF_OPENEXR = ''

    OpenEXR is a High dynamic Range file format and is very useful when lighting your scene. enabling it is recommended, but probably not
    necessary to make OpenEXR work with Yaf(a)ray

    Code: Select all
    WITH_BF_FTGL = ''

    Has something to do with the Font display. Disabling it will spare you some dependencies, but I don't know if it has any negative effect.
    As far as I know it is required for the "International" setting.

    Code: Select all
    WITH_BF_FMOD = ''

    FMOD is a music and effects library and can be disabled if you don't use sound in Blender (same as with OpenAL I think, but if enabled much
    less problematic)

    Code: Select all
    WITH_BF_SDL = ''

    SDL is an API for multimedia, and as such should be important. I don't know what it's effects are and have not yet tried to disable it.

    Code: Select all
    WITH_BF_FFMPEG = ''

    FFMPEG is a collection of multimedia codecs and recommended if you want to work with animations.

    Code: Select all
    WITH_BF_QUICKTIME = ''

    Quicktime is the multimedia codec used on MacOS and can be useful, but is no necessity.

    Code: Select all
    BF_PYTHON_VERSION = 'X.X'

    Defines the Python Version to be used by the compiled program.
    If you delete this line it will use it's default (and recommended) version.
    using anything else than the default can lead to problems and is NOT recommended!
    Use this only if you can't get the required Python version for your system.
    Recommended is to delete this line!!!

5. building and installing
General
    open up a console and go to the Yafaray sourcecode folder:
    Code: Select all
    cd '/home/username/yafaray'

    Build the programme with Scons:
    Code: Select all
    scons

    this might take a few minutes.
    After it is done Get root access...
    Gentoo:
    Code: Select all
    su


    General:
    and just install it using Scons:
    Code: Select all
    scons install

    NOTE: If you change any settings between building and installing, Scons will have to rebuild the programme!

    Now let's do the same for Blender:
    open up a console and head to '/home/username/blender-x.xx/':
    Code: Select all
    cd '/home/username/blender-x.xx/'

    Same thing as with yafaray, just use Scons to build it:
    Code: Select all
    scons

    and wait for the build to finish (can take very long with Blender, expect up to an hour on older computers)

    After it is done Get root access...
    Gentoo:
    Code: Select all
    su


    General:
    and just install it using Scons:
    Code: Select all
    scons install

    NOTE: If you change any settings between building and installing, Scons will have to rebuild the programme!

    Unlike Yafaray, Blender will not install itself in the '/usr/bin' directory automatically, but rather give you a directory output with an executable binary, located in '/home/username/

Last edited by Rinne on Tue Nov 06, 2007 10:01 pm, edited 2 times in total.
Rinne
 
Posts: 113
Joined: Fri Feb 18, 2005 9:41 pm
Location: Germany

Post Tue Nov 06, 2007 9:32 pm

I don't know when you last updated your sources, but 'linux-settings.py' is definitely history...i'd suggest having a look at the 'INSTALL' file.

There also should be several guides for building blender, like here
Lynx
 
Posts: 750
Joined: Wed Jan 12, 2005 5:07 am
Location: Germany

Post Tue Nov 06, 2007 9:42 pm

Lynx wrote:I don't know when you last updated your sources, but 'linux-settings.py' is definitely history...i'd suggest having a look at the 'INSTALL' file.

There also should be several guides for building blender, like here


Yeah, that was just a wrong memory in my mind, I fixed that with user-config.py while you answered

I was just in the mood to write this because more and more people were asking, and the information from compiling in general to enabling Yafaray support is very scattered.

Wanted to have it all in one article..
Rinne
 
Posts: 113
Joined: Fri Feb 18, 2005 9:41 pm
Location: Germany

Post Wed Nov 07, 2007 1:00 pm

It's a great startup guide Rinne. Thanks for your time and efforts! ;)
User avatar
afecelis
 
Posts: 384
Joined: Fri Aug 19, 2005 1:17 am
Location: Colombia

Mac

Post Thu Nov 08, 2007 10:16 pm

Any possibility to get some help in a sticky article (this one) for Mac compiling? I did trry at some point and failed to get it compiled.

or has this ever been tried?
"May The Force Be With You."

-Jedi Master Hoshi
MasterHoshi
 
Posts: 46
Joined: Sun Aug 28, 2005 5:09 pm

Post Fri Jan 25, 2008 3:29 pm

Thanks for this guide. :D

I'm a total newbie having only been using Ubuntu since November.

Following the guide, and a couple of Google links, I was able to build the 2.45 source optimised for my athlon t-bird with game engine ebnabled on Ubuntu 7.10.

The process worked flawlessly once I finally installed all the dependencies and libs.

Thanks for the guide and giving me the confidence to do this :-)
chrisr
 
Posts: 2
Joined: Fri Jan 25, 2008 3:04 pm

Post Fri Feb 01, 2008 12:21 pm

I have followed the guide and have run the blender I compiled in /home/james/build/linux2/bin/.

But when I select to render with Yafray I get "Error loading Yafray plugin:"

How can I resolve this?

Thanks
Jimmey
 
Posts: 26
Joined: Fri Oct 07, 2005 9:11 am
Location: Manchester, England

Post Sat Feb 02, 2008 3:57 pm

Jimmey wrote:I have followed the guide and have run the blender I compiled in /home/james/build/linux2/bin/.

But when I select to render with Yafray I get "Error loading Yafray plugin:"

How can I resolve this?

Thanks


Im pretty sure this is something about you forgetting to copy the yafaray blender-code into the blender-dir when you compiled it.
Claws
 
Posts: 156
Joined: Sun Apr 23, 2006 10:05 pm

Re: Yafaray: Step by Step guide for compilation and installa

Post Sun Sep 28, 2008 1:42 am

Thanks for the wonderful tutorial. I am having some issues however. You use terms like open up a console and use subversion. I am unclear as to what those specifically are referencing. I am using Windows Vista 32bit. I am very interested in compiling this properly and figured you would be the best source.

Installing yafray would be very nice. the exe for the newest build is giving me problems so i figured this would be the best way to ensure it is optimal.

My biggest issue is I have no idea what to do with SCONS as stated on the yafray home page about saving the plugins and using scons.

" 1. After compiling Yafaray with scons, create the Python bindings with "scons swig". This requires SWIG to be installed. Copy the resulting yafrayinterface.py and _yafrayinterface.so (or .pyd on Windows) from the bindings directory to your blender scripts directory.
2. Get the Python export code from SVN: svn co https://ssl.little-isp.de/svn/lynx/yafa ... der/python Copy the scripts in your blender scripts directory "

any help is greatly appreciated. I apologize if i sound like a total noob. :oops:
MachJock
 
Posts: 2
Joined: Sun Sep 28, 2008 1:11 am

Post Sun Sep 28, 2008 4:33 am

First, this is guide for Linux.
Second, building blender is not required anymore, we dropped C++ code for blender in favour to Python, which does not have to be compiled.
Third, if you don't know is meant with "Terminal", "Console Window" or "Command-Line", you better stop right there and get some basic knowledge first...i don't think it's appropriate to start every guide with the genesis of the earth...

If you still want to try, I just updated the instruction in the wiki a bit:
http://wiki.yafray.org/bin/view.pl/User ... y#Building
Lynx
 
Posts: 750
Joined: Wed Jan 12, 2005 5:07 am
Location: Germany

Post Sun Sep 28, 2008 4:35 am

Thats why it did not make any sense. I am familiar with those terms but not in the context they were being applied. THANKS!
MachJock
 
Posts: 2
Joined: Sun Sep 28, 2008 1:11 am

THIS THREAD IS WAAY OUTDATED

Post Wed Oct 15, 2008 12:47 pm

THIS THREAD IS WAAY OUTDATED

For installing Yaf(a)Ray from source, please see this page: http://wiki.yafray.org/bin/view.pl/UserDoc/YafaRay
cellstorm
 
Posts: 8
Joined: Mon Sep 01, 2008 12:07 pm

Post Sat Nov 15, 2008 12:29 pm

Thanks Cellstorm, just what I needed. :)
User avatar
afecelis
 
Posts: 384
Joined: Fri Aug 19, 2005 1:17 am
Location: Colombia


Return to Testing Builds



Who is online

Users browsing this forum: No registered users and 1 guest