Page 1 of 1

Mac blendluxcore

Posted: Sat Apr 17, 2021 2:56 am
by Shirley Ashikman
Now that blender has released an ARM version, will there be luxcore ARM release for blender?

Re: Mac blendluxcore

Posted: Fri Aug 13, 2021 8:07 pm
by u3dreal
I have made many tries to do so ... but compiling all the deps and luxcore for ARM does not seem to be so trivial on an x86_64 machine.
Everything that goes into luxcore will have to be crosscompiled.

I do not have an Arm Mac... that of course would make things a lot easier though compiling deps will be a challenge.
As far as I know GitHub / azure does not yet support ARM hosts.

Re: Mac blendluxcore

Posted: Fri Aug 13, 2021 8:23 pm
by Shirley Ashikman
Thank you. It's nice to know someone tried to do it.

Re: Mac blendluxcore

Posted: Tue Aug 17, 2021 11:35 am
by FarbigeWelt
u3dreal wrote: Fri Aug 13, 2021 8:07 pm I have made many tries to do so ... but compiling all the deps and luxcore for ARM does not seem to be so trivial on an x86_64 machine.
Everything that goes into luxcore will have to be crosscompiled.

I do not have an Arm Mac... that of course would make things a lot easier though compiling deps will be a challenge.
As far as I know GitHub / azure does not yet support ARM hosts.
I own a MacBook Air, M1, 16 GB. I own a Mac Mini, latest Intel version from mid 2020. Therefore I could and want to learn compiling LuxCore on both Apple Mac systems. Compiling LuxCore on Windows 10 Pro was quite easy with just a few traps only - at least in 2019.
I have an Apple developer account with a certificate valid (already paid).
I guess I need some support from you, u3dreal, to be able to get a successful compilation running.
Your help and advices are more than welcome.

Re: Mac blendluxcore

Posted: Tue Aug 17, 2021 11:18 pm
by u3dreal
OK you can follow this guide.
https://www.wiki.luxcorerender.org/Comp ... _10.13_.2B

Make sure to use python 3.9.2 and corresponding numpy '1.19.5' via pip like in the guide. These are the versions Blender 2.93+ uses.

Try first to compile the deps as arm64 only not universal2. You have to set archtecture for the build system that the dep uses.
I think there are tree different ones.

It will be a hell of googleing for you to find out how you might get around the problems. Sometimes a newer version than Luxcore uses is necessary... etc...

I can only offer to help if you really can't get along. It's much easier if you (me) sit in front of the screen.

It would be hard enough i think even if you would mail me the M1 ... :roll:

Don't get me wrong but compiling on osx is hell if you do it without XCode ... If you mange to get the deps compiled i see light at the end of the tunnel.

But anyhow. Good luck

Re: Mac blendluxcore

Posted: Sat Aug 21, 2021 8:29 am
by FarbigeWelt
u3dreal wrote: Tue Aug 17, 2021 11:18 pm OK you can follow this guide.
https://www.wiki.luxcorerender.org/Comp ... _10.13_.2B


But anyhow. Good luck
Thank you for your answer.
It will take a while for me to get done all the steps mentioned in the guide and adapt them M1 architecture as well.
My vacations end on this week's Sunday eve. This means me seriously working on the topic starts not before next week's beginning.

Re: Mac blendluxcore

Posted: Sat Sep 04, 2021 10:42 am
by u3dreal
Just an update on my side ... after finally finding out that zlib was the problem why i could not compile the deps as static libs.
... there was the definition of Z_FIXED missing in zlib header in the newest version which is needed by png ...

I was able to compile most of the libs as static and universal2. only embree and OIDN are missing so far.

Now i hang at compiling embree since you need a special version of ispc that support arm64 target.

If you want to you can try to acomplish that. That would help alot.
Use

Code: Select all

-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64
So we get uninvesal2 libs.

The newest version of embree should work on arm but read for yourself.
https://github.com/lighttransport/embree-aarch64

Code: Select all

Compiling for M1 macOS with TBB and ISPC

First you'll need to build and install TBB. Grab the source from the TBB Github and build and install it with CMake. For TBB, use the CMake command below. It's also recommended to set an install prefix to install it locally, -DCMAKE_INSTALL_PREFIX=<path to install>

$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release \
   -DCMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG=-mmacosx-version-min=11 \
   -DCMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG=-mmacosx-version-min=11 \
   -DTBB_STRICT=OFF \
   -DTBB_TEST=OFF \
   ..
$ make install

For ISPC support you'll need to build ISPC, either from the fork https://github.com/Twinklebear/ispc enabling the macOS + arm/neon target, or from the main repo if the pull request https://github.com/ispc/ispc/pull/1943 has been merged. ISPC should be built using their provided build script by running scripts/build.sh from the root directory of the ISPC repo. On M1 you can pass -j 8 to use all 8 cores when building ISPC. The ISPC compiler will be installed under <ispc repo>/install/bin/, which you'll want to add to your path.

Finally, you can build Embree. If you're building with ISPC support, you'll also pass -DEMBREE_ISPC_SUPPORT=ON, If you have GLFW installed you can also set -DEMBREE_TUTORIALS_GLFW=ON to build the interactive tutorials. It's also recommended to set an install prefix to install embree locally, -DCMAKE_INSTALL_PREFIX=<path to install>

$ mkdir build && cd build
$ cmake \
   -DCMAKE_BUILD_TYPE=Release \
   -DEMBREE_ARM=ON \
   -DEMBREE_IOS=ON \
   -DEMBREE_TASKING_SYSTEM=TBB \
   -DEMBREE_TUTORIALS=ON \
   -DEMBREE_RAY_PACKETS=ON \
   -DEMBREE_MAX_ISA=AVX2 \
   -DEMBREE_NEON_AVX2_EMULATION=ON \
   -DAS_MAC=ON \
   -DCMAKE_OSX_ARCHITECTURES=arm64 \
   -DCMAKE_OSX_DEPLOYMENT_TARGET=11 \
   -DTBB_DIR=<tbb install dir>/lib/cmake/TBB/ \
   -DEMBREE_ISPC_SUPPORT=ON \
   ..
$ make install

To avoid warnings about failing to set thread affinity with TBB, run the tutorials with --set_affinity 0, and when creating the embree device in your code, pass set_affinity=0 to rtcNewDevice:

RTCDevice device = rtcNewDevice("set_affinity=0");

Build monolithc embree with TBB(experimental)

EMBREE_USE_EMBEDDED_TBB=On builds the embree with local tbb. (Dowload TBB and extract it to thrid_party/tbb. Adding TBB as a submodule was removed as original Intel Embree did)

This will enable building monolithic embree library with single cmake build procedure. (Would make embree build with TBB support for emerging architecures and cross compiling easier)

  -DEMBREE_TASKING_SYSTEM=Internal \
  -DEMBREE_USE_EMBEDDED_TBB=On \
with these option
( DEMBREE_TASKING_SYSTEM=Internal \
-DEMBREE_USE_EMBEDDED_TBB=On \ )

embree will be build as mono block including tbb that would also be really good since tbb is not recommended to build as a static lib.
which would be possible this way.

If we can make this happen .. compiling luxcore for arm / uninversal2 "should" be relaively straight forward.

So long

u3dreal