Page 1 of 3

HOWTO - compile on OSX 2020

Posted: Fri Jan 17, 2020 3:34 pm
by u3dreal
Hi i'm about to put together a guide on how to compile LuxCore on macOS operating systems.

This is a start.

Compile LuxCoreRender on OSX 10.13+

Install latest Xcode and Command Line Tools for your OS version.

Install Homebrew

Code: Select all

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install brew stuff and python3

Code: Select all

brew install pyenv cmake bison gnu-sed gnu-tar xz libtool autoconf automake
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
eval "$(pyenv init -)”.
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.4
pyenv global 3.7.4
pip install numpy
pip install pillow
pip install pyside2
Compile Dependencies

Code: Select all

pyenv shell 3.7.4

git clone https://github.com/LuxCoreRender/MacOSCompileDeps.git

cd MacOSCompileDeps

./cut_deps_release
This will leave you with a .tar


Compile LuxCore

Code: Select all

git clone https://github.com/LuxCoreRender/LuxCore.git
cd LuxCore
Copy tar to LuxCore root and unpack. Just double-click. or

Code: Select all

tar xzf MacDistFiles.tar.gz
change

Code: Select all

SET(AZURE 1) # Set 0 when compiled locally and not on azure
to "0" in cmake/PlatformSpecific.cmake

Now do

Code: Select all

export PATH="/usr/local/opt/bison/bin:/usr/local/bin:$PATH"
DEPS_SOURCE=`pwd`/macos

mkdir build
cd  build
cmake -DOSX_DEPENDENCY_ROOT=$DEPS_SOURCE -DCMAKE_BUILD_TYPE=Release ..
make
now copy paste this to a text file ... like "pack_lux_osx.sh" and save it.

Code: Select all

#!/bin/bash

DEPS_SOURCE=`pwd`/macos

### packing opencl version

mkdir release_OSX

###luxcoreui bundle

echo "Bundeling OpenCL Version"

cp -R macos/mac_bundle/LuxCore.app release_OSX
cp build/Release/luxcoreui release_OSX/LuxCore.app/Contents/MacOS

cd release_OSX

mkdir -p LuxCore.app/Contents/Resources/libs/

#libomp

cp -f $DEPS_SOURCE/lib/libomp.dylib LuxCore.app/Contents/Resources/libs/libomp.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libomp.dylib
install_name_tool -id @executable_path/../Resources/libs/libomp.dylib LuxCore.app/Contents/Resources/libs/libomp.dylib

#libembree

cp -f $DEPS_SOURCE/lib/libembree3.3.dylib LuxCore.app/Contents/Resources/libs/libembree3.3.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libembree3.3.dylib
install_name_tool -id @executable_path/../Resources/libs/libembree3.3.dylib LuxCore.app/Contents/Resources/libs/libembree3.3.dylib
install_name_tool -change @rpath/libtbb.dylib @executable_path/../Resources/libs/libtbb.dylib LuxCore.app/Contents/Resources/libs/libembree3.3.dylib
install_name_tool -change @rpath/libtbbmalloc.dylib @executable_path/../Resources/libs/libtbbmalloc.dylib LuxCore.app/Contents/Resources/libs/libembree3.3.dylib

#libOpenImageDenoise

cp -f $DEPS_SOURCE/lib/libOpenImageDenoise.1.0.0.dylib LuxCore.app/Contents/Resources/libs/libOpenImageDenoise.1.0.0.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libOpenImageDenoise.1.0.0.dylib
install_name_tool -id @executable_path/../Resources/libs/libOpenImageDenoise.1.0.0.dylib LuxCore.app/Contents/Resources/libs/libOpenImageDenoise.1.0.0.dylib
install_name_tool -change @rpath/libtbb.dylib @executable_path/../Resources/libs/libtbb.dylib LuxCore.app/Contents/Resources/libs/libOpenImageDenoise.1.0.0.dylib
install_name_tool -change @rpath/libtbbmalloc.dylib @executable_path/../Resources/libs/libtbbmalloc.dylib LuxCore.app/Contents/Resources/libs/libOpenImageDenoise.1.0.0.dylib

#libtbb

cp -f $DEPS_SOURCE/lib/libtbb.dylib LuxCore.app/Contents/Resources/libs/libtbb.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libtbb.dylib
install_name_tool -id @executable_path/../Resources/libs/libtbb.dylib LuxCore.app/Contents/Resources/libs/libtbb.dylib

#libtiff

cp -f $DEPS_SOURCE/lib/libtiff.5.dylib LuxCore.app/Contents/Resources/libs/libtiff.5.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libtiff.5.dylib
install_name_tool -id @executable_path/../Resources/libs/libtiff.5.dylib LuxCore.app/Contents/Resources/libs/libtiff.5.dylib

#libOpenImageIO

cp -f $DEPS_SOURCE/lib/libOpenImageIO.1.8.dylib LuxCore.app/Contents/Resources/libs/libOpenImageIO.1.8.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libOpenImageIO.1.8.dylib
install_name_tool -id @executable_path/../Resources/libs/libOpenImageIO.1.8.dylib LuxCore.app/Contents/Resources/libs/libOpenImageIO.1.8.dylib
install_name_tool -change @rpath/libtiff.5.dylib @executable_path/../Resources/libs/libtiff.5.dylib LuxCore.app/Contents/Resources/libs/libOpenImageIO.1.8.dylib

#libtbbmalloc

cp -f $DEPS_SOURCE/lib/libtbbmalloc.dylib LuxCore.app/Contents/Resources/libs/libtbbmalloc.dylib
chmod +w LuxCore.app/Contents/Resources/libs/libtbbmalloc.dylib
install_name_tool -id @executable_path/../Resources/libs/libtbbmalloc.dylib LuxCore.app/Contents/Resources/libs/libtbbmalloc.dylib

#luxcoreui

install_name_tool -change @rpath/libomp.dylib @executable_path/../Resources/libs/libomp.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libembree3.3.dylib @executable_path/../Resources/libs/libembree3.3.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libtbb.dylib @executable_path/../Resources/libs/libtbb.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libOpenImageIO.1.8.dylib @executable_path/../Resources/libs/libOpenImageIO.1.8.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libtbbmalloc.dylib @executable_path/../Resources/libs/libtbbmalloc.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libtiff.5.dylib @executable_path/../Resources/libs/libtiff.5.dylib LuxCore.app/Contents/MacOS/luxcoreui
install_name_tool -change @rpath/libOpenImageDenoise.0.dylib @executable_path/../Resources/libs/libOpenImageDenoise.1.0.0.dylib LuxCore.app/Contents/MacOS/luxcoreui

echo "LuxCoreUi installed"

###luxcoreconsole

cp ../build/Release/luxcoreconsole LuxCore.app/Contents/MacOS

#luxcoreconsole

install_name_tool -change @rpath/libomp.dylib @executable_path/../Resources/libs/libomp.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libembree3.3.dylib @executable_path/../Resources/libs/libembree3.3.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libtbb.dylib @executable_path/../Resources/libs/libtbb.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libOpenImageIO.1.8.dylib @executable_path/../Resources/libs/libOpenImageIO.1.8.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libtbbmalloc.dylib @executable_path/../Resources/libs/libtbbmalloc.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libtiff.5.dylib @executable_path/../Resources/libs/libtiff.5.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole
install_name_tool -change @rpath/libOpenImageDenoise.0.dylib @executable_path/../Resources/libs/libOpenImageDenoise.1.0.0.dylib ./LuxCore.app/Contents/MacOS/luxcoreconsole

echo "LuxCoreConsole installed"

### pyluxcore.so

mkdir pyluxcore

cp ../build/lib/Release/pyluxcore.so pyluxcore
cp ../build/lib/pyluxcoretools.zip pyluxcore

cd pyluxcore

#libomp

cp -f $DEPS_SOURCE/lib/libomp.dylib ./libomp.dylib
chmod +w ./libomp.dylib
install_name_tool -id @loader_path/libomp.dylib ./libomp.dylib

#libembree 

cp -f $DEPS_SOURCE/lib/libembree3.3.dylib ./libembree3.3.dylib
chmod +w ./libembree3.3.dylib
install_name_tool -id @loader_path/libembree3.3.dylib ./libembree3.3.dylib
install_name_tool -change @rpath/libtbb.dylib @loader_path/libtbb.dylib ./libembree3.3.dylib
install_name_tool -change @rpath/libtbbmalloc.dylib @loader_path/libtbbmalloc.dylib ./libembree3.3.dylib

#libtbb

cp -f $DEPS_SOURCE/lib/libtbb.dylib ./libtbb.dylib
chmod +w ./libtbb.dylib
install_name_tool -id @loader_path/libtbb.dylib ./libtbb.dylib

#libtiff

cp -f $DEPS_SOURCE/lib/libtiff.5.dylib ./libtiff.5.dylib
chmod +w ./libtiff.5.dylib
install_name_tool -id @loader_path/libtiff.5.dylib ./libtiff.5.dylib

#libOpenImageIO

cp -f $DEPS_SOURCE/lib/libOpenImageIO.1.8.dylib ./libOpenImageIO.1.8.dylib
chmod +w ./libOpenImageIO.1.8.dylib
install_name_tool -id @loader_path/libOpenImageIO.1.8.dylib ./libOpenImageIO.1.8.dylib
install_name_tool -change @rpath/libtiff.5.dylib @loader_path/libtiff.5.dylib ./libOpenImageIO.1.8.dylib

#libtbbmalloc

cp -f $DEPS_SOURCE/lib/libtbbmalloc.dylib ./libtbbmalloc.dylib
chmod +w ./libtbbmalloc.dylib
install_name_tool -id @loader_path/libtbbmalloc.dylib ./libtbbmalloc.dylib

#libOpenImageDenoise

cp -f $DEPS_SOURCE/lib/libOpenImageDenoise.1.0.0.dylib ./libOpenImageDenoise.1.0.0.dylib
chmod +w ./libOpenImageDenoise.1.0.0.dylib
install_name_tool -id @loader_path/libOpenImageDenoise.1.0.0.dylib ./libOpenImageDenoise.1.0.0.dylib
install_name_tool -change @rpath/libtbb.dylib @loader_path/libtbb.dylib ./libOpenImageDenoise.1.0.0.dylib
install_name_tool -change @rpath/libtbbmalloc.dylib @loader_path/libtbbmalloc.dylib ./libOpenImageDenoise.1.0.0.dylib

#pyluxcore.so

install_name_tool -change @rpath/libomp.dylib @loader_path/libomp.dylib pyluxcore.so
install_name_tool -change @rpath/libembree3.3.dylib @loader_path/libembree3.3.dylib pyluxcore.so
install_name_tool -change @rpath/libtbb.dylib @loader_path/libtbb.dylib pyluxcore.so
install_name_tool -change @rpath/libtiff.5.dylib @loader_path/libtiff.5.dylib pyluxcore.so
install_name_tool -change @rpath/libOpenImageIO.1.8.dylib @loader_path/libOpenImageIO.1.8.dylib pyluxcore.so
install_name_tool -change @rpath/libtbbmalloc.dylib @loader_path/libtbbmalloc.dylib pyluxcore.so
install_name_tool -change @rpath/libOpenImageDenoise.0.dylib @loader_path/libOpenImagedenoise.1.0.0.dylib pyluxcore.so

echo "PyLuxCore installed"

### denoise

#denoise
cp ../../macos/bin/denoise .
chmod +w ./denoise
install_name_tool -id @executable_path/denoise ./denoise
install_name_tool -change @rpath/libOpenImageDenoise.0.dylib @executable_path/libOpenImageDenoise.1.0.0.dylib denoise
install_name_tool -change @rpath/libOpenImageDenoise.1.0.0.dylib @executable_path/libOpenImageDenoise.1.0.0.dylib denoise
install_name_tool -change @rpath/libtbb.dylib @executable_path/libtbb.dylib denoise
install_name_tool -change @rpath/libtbbmalloc.dylib @executable_path/libtbbmalloc.dylib denoise

echo "Denoise installed"

cd ../..

# Set up correct names for release version and SDK
if [[ -z "$VERSION_STRING" ]] ; then
    VERSION_STRING=latest
fi

### creating opencl DMG

echo "Creating OpenCL Version DMG ..."

hdiutil create luxcorerender-$VERSION_STRING-mac64$SDK_BUILD.dmg -volname "LuxCoreRender-$VERSION_STRING" -fs HFS+ -srcfolder release_OSX/

echo "Done !"

Do

Code: Select all

chmod +x pack_lux_osx.sh
and run it

Code: Select all

./pack_lux_osx.sh
This should end up with a distributable .dmg.

Have fun and good luck.

Re: HOWTO - compile on OSX 2020

Posted: Fri Jan 17, 2020 4:00 pm
by Fox
I see you have Ubuntu 18.04, i wonder if the building works on 19.10 too?

Re: HOWTO - compile on OSX 2020

Posted: Fri Jan 17, 2020 4:04 pm
by u3dreal
Fox wrote: Fri Jan 17, 2020 4:00 pm I see you have Ubuntu 18.04, i wonder if the building works on 19.10 too?
OSX macos no linux

But i should work compiled it on popOS! 19.10

Re: HOWTO - compile on OSX 2020

Posted: Fri Jan 17, 2020 4:34 pm
by Dade
This should go here (https://wiki.luxcorerender.org/Compiling_LuxCore) or, for consistency with other platform, in a README.txt here (https://github.com/LuxCoreRender/MacOSCompile).

Do you have an Wiki account ?

Re: HOWTO - compile on OSX 2020

Posted: Fri Jan 17, 2020 4:39 pm
by u3dreal
I first want to try it here then if it works for others i will put it there ... and no idea if i have a wiki account

Re: HOWTO - compile on OSX 2020

Posted: Tue Jan 21, 2020 1:05 pm
by u3dreal
So did anyone try and succeed ?

Re: HOWTO - compile on OSX 2020

Posted: Wed Jan 29, 2020 10:49 pm
by Ahr0n
I got stuck on this step:

change
CODE: SELECT ALL
SET(AZURE 1) # Set 0 when compiled locally and not on azure
to "0" in cmake/PlatformSpecific.cmake

What exactly should I do here? A simple instruction for non-terminal guy is needed :D

Re: HOWTO - compile on OSX 2020

Posted: Thu Jan 30, 2020 10:18 am
by u3dreal
Open cmake/PlatformSpecific.cmake in a text editor and change the 1 to 0.

Code: Select all

SET(AZURE 1) # Set 0 when compiled locally and not on azure

Code: Select all

SET(AZURE 0) # Set 0 when compiled locally and not on azure
and save afterwards

Re: HOWTO - compile on OSX 2020

Posted: Thu Jan 30, 2020 10:01 pm
by Ahr0n
Okay, thanks for last reply. The next step:

1st. Question:
export PATH="/usr/local/opt/bison/bin:/usr/local/bin:$PATH"

- Pasting this command makes nothing in terminal. I assume there are variables that I have to change but I don't know which exactly. Please tell me what I need to change to execute this.

2nd Question:

DEPS_SOURCE=`pwd`/macos

'pwd' - password here yup? so '1234' /macos?

3rd Question:

pack_lux_osx.sh

- Should I save this file in /build directory? If not where exactly?

I assume that will be everything but now I need to examine how can I go through these steps.

Re: HOWTO - compile on OSX 2020

Posted: Fri Jan 31, 2020 7:38 am
by u3dreal
Ahr0n wrote: Thu Jan 30, 2020 10:01 pm Okay, thanks for last reply. The next step:

1st. Question:
export PATH="/usr/local/opt/bison/bin:/usr/local/bin:$PATH"

- Pasting this command makes nothing in terminal. I assume there are variables that I have to change but I don't know which exactly. Please tell me what I need to change to execute this.

2nd Question:

DEPS_SOURCE=`pwd`/macos

'pwd' - password here yup? so '1234' /macos?

3rd Question:

pack_lux_osx.sh

- Should I save this file in /build directory? If not where exactly?

I assume that will be everything but now I need to examine how can I go through these steps.
export PATH="/usr/local/opt/bison/bin:/usr/local/bin:$PATH"
Just adds /usr/local/opt/bison/bin to the PATH Variable. There is no visual result in the terminal.

1. copy and paste each line one by one into the terminal and execute them. You don't have to change anything !!!
2. pwd means the folder you are in !! In this case LuxCore root.
3. place the pack_lux_osx.sh in the root / LuxCore folder.