Sponsors
After reading some documents and hacking on the scons .py codes. I found an easy way to compile Yafray in AMD64 FC6.
In the file SConstruct, merely edit the following line
common_env=Environment(ENV=os.environ, CXXFLAGS = config.cxxflags);
to
common_env=Environment(ENV=os.environ, CXXFLAGS = config.cxxflags, SHLINK = "g++", LINK = "g++");
The compilation will then use g++ as the linker with shared library.
If the compilation cannot find the 64bit OpenEXR library, edit the line in file linux-settings.py
def get_libpath(args): return [ exr.PATH + "/lib" ]
to
def get_libpath(args): return [ exr.PATH + "/lib64" ]
Then compile as usual: scons -j 2
Obsolete
Given yafray-0.0.9.tgz:
# Install scons as needed by yafray. Yafray no longer uses GNU make. $ yum install scons $ tar zxvf yafray-0.0.9.tgz $ cd yafray # Start compilations $ scons ld -shared -no_archive -o src/yafraycore/libyafraycore.so src/yafraycore/bound.os src/yafraycore/buffer.os src/yafraycore/yafsystem.os src/yafraycore/tools.os src/yafraycore/camera.os src/yafraycore/color.os src/yafraycore/filter.os src/yafraycore/matrix4.os src/yafraycore/object3d.os src/yafraycore/triangletools.os src/yafraycore/mesh.os src/yafraycore/kdtree.os src/yafraycore/triclip.os src/yafraycore/reference.os src/yafraycore/renderblock.os src/yafraycore/scene.os src/yafraycore/forkedscene.os src/yafraycore/threadedscene.os src/yafraycore/ipc.os src/yafraycore/ccthreads.os src/yafraycore/noise.os src/yafraycore/background.os src/yafraycore/sphere.os src/yafraycore/texture.os src/yafraycore/metashader.os src/yafraycore/targaIO.os src/yafraycore/triangle.os src/yafraycore/vector3d.os src/yafraycore/photon.os src/yafraycore/params.os src/yafraycore/HDR_io.os src/yafraycore/spectrum.os -lpthread ld: /usr/lib64/libpthread.a(pthread_create.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib64/libpthread.a: could not read symbols: Bad value scons: *** [src/yafraycore/libyafraycore.so] Error 1 scons: building terminated because of errors.
I recompile yafray with -fPIC does not help at all. Replace 'ld' by 'g++' solves the linking problem. But I dont know how to do that using scons! Even if I create libyafraycore.so manually, running scons will still try to ld!
Out of no choice, I use a quick and dirty workaround. Generate the list of commands with dry run option. Replace the 'ld' commands with 'g++'. Then execute the list of commands.
$ scons -n > run $$ Edit run, replace 'ld ' by 'g++ '. Using vi, run ':%s/ld /g++ ' $$ Remove scons outputs and -no_archive in run if you dont like to see warning outputs. $ chmod +x run $ ./run $ ls src/yafray
I got the 'yafray' executable file created. Installation is not done yet. We still have to install yafray .so library.
# You can install the .so into /usr/lib or /usr/local/lib. $ mkdir /usr/local/lib/yafray $ cp src/backgrounds/*.so src/lights/*.so src/shaders/*.so /usr/local/lib/yafray/ $ cp src/yafraycore/*.so src/interface/*.so /usr/local/lib/ # Remember to add /usr/local/lib into ld.so.conf.d/ $ ldconfig # You can install yafray into /usr/bin or /usr/local/bin $ cp src/yafray /usr/local/bin
DONE!!! scons disappointed me.

You can actually prevent the
You can actually prevent the warnings being output by scons by changing the line as following:
common_env=Environment(ENV=os.environ, CXXFLAGS = config.cxxflags, SHLINK = "g++", LINK = "g++", SHLINKFLAGS = "-shared");This removes the -no_archive from the command. Be aware that you actually do need the g++ - stuff there too, because ld links the libraries wrong.
br,
Mathy
Post new comment