Page 1 of 1

Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Tuesday 07 February 2017 21:11
by bellyd
Building on trixwood’s clear instructions to compile Domoticz for MacOS (http://www.domoticz.com/wiki/Mac_OS_X), I’d thought it might be useful for others to see what has changed since last year. Before I edit the Wiki page let me summarize what I found:

0) I executed the compilation on a fresh (‘virgin’) Parallels MacOS 10.12.3 virtual machine (Parallels) using latest brew and Xcode 8.2.1. To get the virtual machine running without SIP see the end of this post.

1) Installing necessary libraries
brew install boost —with-python: the —with-python option doesn’t exist and is ignored. Can be removed from the instructions.
brew install zlib: brew formula doesn’t exist and this install can be ignored (zlib is present in MacOS/Xcode by default?). Remove from instructions.
brew install openssl: comes with lots of warnings and caveats but is still required to compile Domoticz successfully. The export LDFLAGS and CPPFLAGS statements were of no use (I still ended up with Domoticz compile errors caused by openssl). See export commands below which solved the errors.
brew linkapps python3: brew linkapps is no longer a current brew operation though it still works. Not sure what the effect is if you leave it out (as used to be the case).

2) Compile OpenZWave
I would place this instruction in front of downloading the Domoticz source. For newbies this avoids them installing OpenZWave within the Domoticz folder. Please note the way OpenZWave is installed causes brew doctor to report a lot of warnings of ’unbrewed’ OpenZWave dylib and header files)
Also note I had to use sudo make install (combined with turning off SIP) to get the pkgconfig executable (chown 755) and copied into /usr/lib/pkgconfig.

3) Compile Domoticz
First hurdle to take was to get openssl properly recognized. This required export OPENSSL_ROOT_DIR=/usr/local/opt/openssl/ and export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include/.
I had to reference Python 3.6 in the cmake options (I’m glad trixwood had clearly signalled this change in the instructions).
Combined with turning off the Python plugins the cmake working for me was: cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/Headers -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib -DUSE_PYTHON_PLUGINS=NO CMakeLists.txt
Perhaps the following cmake may also work if you have no other Python libraries installed: cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_PLUGINS=NO CMakeLists.txt

There are still a lot of warnings listed when compiling Domoticz but these don’t prevent you from generating a MacOS executable!

Procedure to turn off SIP on a Parallels virtual machine:
0. Shutdown your macOS VM.
1. Add to its boot flags (VM config -> Hardware -> Boot Order -> Advanced settings -> Boot flags) string "vm.efi.mac_recovery=1" - this forces VM to boot into Recovery mode.
2. Start your VM and it will be in Recovery.
3. Disable SIP.
4. Shutdown VM.
5. Disable Recovery mode setting boot flat value to "0".
6. Start VM - it will boot normally but without SIP.

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Wednesday 08 February 2017 6:06
by trixwood
Could you add this to the wiki? Make an sierra section :-)

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Wednesday 15 November 2017 21:36
by osks
I noticed that if I install pkgconfig with homebrew (brew install pkgconfig) before I compile OpenZWave, it will not try to install in /usr/lib but instead /usr/local/lib, and then I didn't have to disable SIP protection.

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Thursday 11 January 2018 20:04
by febalci
On High Sierra, make gives an error because of boost 1.66 (latest). So i reverted my boost and boost-python versions to 1.59. I also did not include the -DUSE_PYTHON_PLUGINS=NO option since i want to use the Plugin Framework. It compiles and works with boost 1.59, however still no Plugin support...

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Saturday 13 January 2018 8:46
by Sarcas
I've been trying for days now to compile a version for 10.13.2 with zwave. Seeing the outdated and incomplete info on how to compile I guess it is hardly used for macos? I'll see if downgrading boost fixes stuff...

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Monday 23 July 2018 17:30
by Infern0
febalci wrote: Thursday 11 January 2018 20:04 On High Sierra, make gives an error because of boost 1.66 (latest). So i reverted my boost and boost-python versions to 1.59. I also did not include the -DUSE_PYTHON_PLUGINS=NO option since i want to use the Plugin Framework. It compiles and works with boost 1.59, however still no Plugin support...
See here:
https://github.com/domoticz/domoticz/issues/2589

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Saturday 19 January 2019 2:54
by sion
hi all.
just wondering if anyone has domoticz running on mac os high sierra, with plugins?

i followed the instructions to Compile Domoticz, but i keep getting:

Code: Select all

fatal error: 
      'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/domoticz.dir/main/EventSystem.cpp.o] Error 1
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
make: *** [all] Error 2
jsut wanted to check before i keep trying :)

Thanks,
Sion.

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Saturday 17 August 2019 23:13
by Jespertheend
sion wrote: Saturday 19 January 2019 2:54 i followed the instructions to Compile Domoticz, but i keep getting:

Code: Select all

fatal error: 
      'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/domoticz.dir/main/EventSystem.cpp.o] Error 1
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
make: *** [all] Error 2
I had this same issue, but it turned out the python location provided in my cmake command was incorrect.

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release  -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Headers -DPYTHON_LIBRARY=/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib CMakeLists.txt
fixed it for me but it depends on what python version you have installed.

Re: Compiling Domoticz on MacOS -- update for 10.12.3 Sierra

Posted: Sunday 06 October 2019 13:22
by FredWst
Hi

I compile with this option :

cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DCMAKE_BUILD_TYPE=Release -DPYTHON_INCLUDE_DIR=/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Headers -DPYTHON_LIBRARY=/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib CMakeLists.txt

Fred