Compiling on Linux

Discussion related to the LuxCore functionality, implementations and API.
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Compiling on Linux

Post by jensverwiebe »

@Dade
After recent embree findmodule changes i found the keywords should be in other order else
an precedence of systemwide libs vs. repo libs happens.

My working diff:

Code: Select all

+++ b/cmake/Packages/FindEmbree.cmake
@@ -23,7 +23,7 @@ IF (NOT EMBREE_INCLUDE_PATH)
                /opt/local/include)
 ENDIF()
 
-FIND_LIBRARY(EMBREE_LIBRARY NAMES embree libembree.so.2 PATHS
+FIND_LIBRARY(EMBREE_LIBRARY NAMES libembree.so.2 embree PATHS
        ${EMBREE_ROOT}/lib/x64
        ${EMBREE_ROOT}/lib
        ${EMBREE_ROOT}/build
@@ -37,7 +37,7 @@ IF (NOT EMBREE_LIBRARY)
 ENDIF()
 
 # Embree requires Intel TBB library
-FIND_LIBRARY(TBB_LIBRARY NAMES tbb libtbb.so.2 PATHS
+FIND_LIBRARY(TBB_LIBRARY NAMES libtbb.so.2 tbb PATHS
        ${EMBREE_ROOT}/lib/x64
        ${EMBREE_ROOT}/lib
        ${EMBREE_ROOT}/build

Sidenote: be aware the embree 2.17.ff now depends on libtbbmalloc too, so it should be distributed ( but must not linked to luxcore ).
This especially is relevant for the

Code: Select all

./build-64-sse2 LuxCore-opencl 5
script.

Code: Select all

ldd libembree.so.2
	linux-vdso.so.1 =>  (0x00007ffcb23fc000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc6c1c23000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc6c1a1f000)
	libtbb.so.2 => /media/Workdata3/Development/Lux_dev/linux_reboot/BlendLuxCore/bin/./libtbb.so.2 (0x00007fc6c17c8000)
	libtbbmalloc.so.2 => /media/Workdata3/Development/Lux_dev/linux_reboot/BlendLuxCore/bin/./libtbbmalloc.so.2 (0x00007fc6c1574000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc6c1270000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc6c0f6a000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc6c0d54000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc6c098b000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fc6c43b1000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc6c0783000)

If you wonder about the pathes: i typically do "patchelf --set-rpath '$ORIGIN' libembree.so.2" to assure embree does NOT use system libs.
Such makes a preload bash-script obsolete in case.
One can also cover both actual structures we have ( example ) :

Code: Select all

patchelf --set-rpath '$ORIGIN:$ORIGIN/../lib' luxcoreui
This will look in runpath first, then runpath/../lib, then system. Could be used in the SET(CMAKE_INSTALL_RPATH "bla:blubb")

EDIT: cp/paste typo

Away from this tested just both script or direct make is pretty straightforward on linux as is.

Jens
Last edited by jensverwiebe on Thu Feb 01, 2018 1:06 pm, edited 3 times in total.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Compiling on Linux

Post by Dade »

jensverwiebe wrote: Thu Feb 01, 2018 11:34 am @Dade
After recent embree findmodule changes i found the keywords should be in other order else
an precedence of systemwide libs vs. repo libs happens.

My working diff:

Code: Select all

+++ b/cmake/Packages/FindEmbree.cmake
@@ -23,7 +23,7 @@ IF (NOT EMBREE_INCLUDE_PATH)
                /opt/local/include)
 ENDIF()
 
-FIND_LIBRARY(EMBREE_LIBRARY NAMES embree libembree.so.2 PATHS
+FIND_LIBRARY(EMBREE_LIBRARY NAMES libembree.so.2 embree PATHS
        ${EMBREE_ROOT}/lib/x64
        ${EMBREE_ROOT}/lib
        ${EMBREE_ROOT}/build
@@ -37,7 +37,7 @@ IF (NOT EMBREE_LIBRARY)
 ENDIF()
 
 # Embree requires Intel TBB library
-FIND_LIBRARY(TBB_LIBRARY NAMES tbb libtbb.so.2 PATHS
+FIND_LIBRARY(TBB_LIBRARY NAMES libtbb.so.2 tbb PATHS
        ${EMBREE_ROOT}/lib/x64
        ${EMBREE_ROOT}/lib
        ${EMBREE_ROOT}/build

"embree" is for Windows and "libembree.so.2" is for Linux, I don't see how swapping the order can make any difference :?:
Support LuxCoreRender project with salts and bounties
jensverwiebe
Supporting Users
Posts: 141
Joined: Tue Jan 09, 2018 6:48 pm

Re: Compiling on Linux

Post by jensverwiebe »

Dunno either, but i tested this empirically a few times.
Lemme check over, i saw you again changed something in the find_embree.

EDIT: seems i missed one pull or it crossed with my testing stash, now its finding correct.

Jens
neo2068
Developer
Developer
Posts: 260
Joined: Tue Dec 05, 2017 6:06 pm
Location: Germany

Re: Compiling on Linux

Post by neo2068 »

Hi!
I am currently on my notebook (fresh installation of ubuntu 16.04 LTS) and tried to compile luxcore, but it fails with a zlib linking error. It also seems that the linker didn't find the libraries and it tries to link against the system zlib library without -fPIC compilation. The preceding stages have ran smoothly.
Any idea how to solve this?

Code: Select all

[ 67%] Built target pyluxcoretools_copy_dir
[ 68%] Built target pyluxcoretools
[ 98%] Built target slg-core
[ 98%] Linking CXX shared module ../../lib/pyluxcore.so
/usr/bin/ld: cannot find -lembree3
/usr/bin/ld: cannot find -ltbb
/usr/bin/ld: cannot find -ltbb
/usr/bin/ld: cannot find -lIex
/usr/bin/ld: cannot find -lIlmImf
/usr/bin/ld: cannot find -lHalf
/usr/bin/ld: cannot find -lImath
/usr/bin/ld: cannot find -lIlmThread
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libz.a(zutil.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src/luxcore/CMakeFiles/pyluxcore.dir/build.make:298: recipe for target 'lib/pyluxcore.so' failed
make[2]: *** [lib/pyluxcore.so] Error 1
CMakeFiles/Makefile2:358: recipe for target 'src/luxcore/CMakeFiles/pyluxcore.dir/all' failed
make[1]: *** [src/luxcore/CMakeFiles/pyluxcore.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
 !!! pyluxcore compilation failed
i7 5820K, 32 GB RAM, NVIDIA Geforce RTX 2080 SUPER + GTX 1080, Windows 10 64bit, Blender 2.83.5
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Compiling on Linux

Post by Dade »

neo2068 wrote: Fri Jun 08, 2018 6:49 am I am currently on my notebook (fresh installation of ubuntu 16.04 LTS) and tried to compile luxcore, but it fails with a zlib linking error. It also seems that the linker didn't find the libraries and it tries to link against the system zlib library without -fPIC compilation. The preceding stages have ran smoothly.
Any idea how to solve this?
Have you tried to start from a fresh copy of LinuxCompile repository ? Or, at least, to delete dist/linux_deps.tgz file if you are using an old copy :?:

You seem to have the old binary libraries.
Support LuxCoreRender project with salts and bounties
neo2068
Developer
Developer
Posts: 260
Joined: Tue Dec 05, 2017 6:06 pm
Location: Germany

Re: Compiling on Linux

Post by neo2068 »

I deleted LinuxCompile and pulled a fresh version from github. The build script downloaded linux_deps.tgz from

Code: Select all

https://github.com/LuxCoreRender/LinuxCompileDeps/releases/download/luxcorerender_v2.1alpha1
But the error is still there. I put a symlink LuxCore_pyluxcore into LinuxCompile and started the build process with

Code: Select all

./build-64-sse2 LuxCore_pyluxcore
i7 5820K, 32 GB RAM, NVIDIA Geforce RTX 2080 SUPER + GTX 1080, Windows 10 64bit, Blender 2.83.5
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Compiling on Linux

Post by Dade »

You may have under distfiles directory both the old and new version of the files, try this:

Code: Select all

rm -rf target-64-sse2 distfiles LuxCore_pyluxcore/CMakeCache.txt
git checkout .
./build-64-sse2 LuxCore_pyluxcore
I have tried to compile on a VM with Ubuntu 16.04 LTS and it works fine for me.
Support LuxCoreRender project with salts and bounties
neo2068
Developer
Developer
Posts: 260
Joined: Tue Dec 05, 2017 6:06 pm
Location: Germany

Re: Compiling on Linux

Post by neo2068 »

Dade wrote: Fri Jun 08, 2018 3:37 pm You may have under distfiles directory both the old and new version of the files, try this:

Code: Select all

rm -rf target-64-sse2 distfiles LuxCore_pyluxcore/CMakeCache.txt
git checkout .
./build-64-sse2 LuxCore_pyluxcore
I have tried to compile on a VM with Ubuntu 16.04 LTS and it works fine for me.
Thanks, that helped and I could compile. :D
i7 5820K, 32 GB RAM, NVIDIA Geforce RTX 2080 SUPER + GTX 1080, Windows 10 64bit, Blender 2.83.5
Support LuxCoreRender project with salts and bounties
neo2068
Developer
Developer
Posts: 260
Joined: Tue Dec 05, 2017 6:06 pm
Location: Germany

Re: Compiling on Linux

Post by neo2068 »

LuxCoreUI and manual python import works but when I use it in Blender i get

Code: Select all

Traceback (most recent call last):
[Exporter] Init
ERROR: std::bad_cast
Traceback (most recent call last):
  File "/home/michael/.config/blender/2.79/scripts/addons/BlendLuxCore/engine/viewport.py", line 19, in view_update
    engine.session = engine.exporter.create_session(context)
  File "/home/michael/.config/blender/2.79/scripts/addons/BlendLuxCore/export/__init__.py", line 150, in create_session
    renderconfig = pyluxcore.RenderConfig(config_props, luxcore_scene)
RuntimeError: std::bad_cast

i7 5820K, 32 GB RAM, NVIDIA Geforce RTX 2080 SUPER + GTX 1080, Windows 10 64bit, Blender 2.83.5
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Compiling on Linux

Post by Dade »

neo2068 wrote: Sat Jun 09, 2018 6:40 pm LuxCoreUI and manual python import works but when I use it in Blender i get

Code: Select all

Traceback (most recent call last):
[Exporter] Init
ERROR: std::bad_cast
Traceback (most recent call last):
  File "/home/michael/.config/blender/2.79/scripts/addons/BlendLuxCore/engine/viewport.py", line 19, in view_update
    engine.session = engine.exporter.create_session(context)
  File "/home/michael/.config/blender/2.79/scripts/addons/BlendLuxCore/export/__init__.py", line 150, in create_session
    renderconfig = pyluxcore.RenderConfig(config_props, luxcore_scene)
RuntimeError: std::bad_cast

Does it happen also with official binaries ? It could be the Blender international font settings :?:
Support LuxCoreRender project with salts and bounties
Post Reply