Problem using boost-python for VST host using xcode to MacOS

I created a VST host in C++ and I want to use a python wrapper using boost-python3 in macos with xcode.
I added :

/usr/local/include
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m/`Preformatted text

to header search path, and:

> /usr/local/Cellar/boost-python3/1.70.0_1/lib
> /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/

to library search path.
When trying to compile I get the linking error:

Undefined symbols for architecture x86_64:
  "_PyUnicode_Type", referenced from:
      boost::python::to_python_value<char const* const&>::get_pytype() const in Source.o
  "__Py_NoneStruct", referenced from:
      boost::python::api::object::object() in Source.o
  "boost::python::detail::init_module(PyModuleDef&, void (*)())", referenced from:
      _PyInit_hello_ext in Source.o
  "boost::python::detail::gcc_demangle(char const*)", referenced from:
      boost::python::type_info::name() const in Source.o
  "boost::python::detail::scope_setattr_doc(char const*, boost::python::api::object const&, char const*)", referenced from:
      void boost::python::def<char const* (*)()>(char const*, char const* (*)()) in Source.o
  "boost::python::objects::function_object(boost::python::objects::py_function const&)", referenced from:
      boost::python::api::object boost::python::detail::make_function_aux<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> >(char const* (*)(), boost::python::default_call_policies const&, boost::mpl::vector1<char const*> const&) in Source.o
  "boost::python::objects::py_function_impl_base::~py_function_impl_base()", referenced from:
      boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl() in Source.o
  "boost::python::converter::do_return_to_python(char const*)", referenced from:
      boost::python::to_python_value<char const* const&>::operator()(char const* const&) const in Source.o
  "boost::python::converter::registry::query(boost::python::type_info)", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in Source.o
  "boost::python::objects::py_function_impl_base::max_arity() const", referenced from:
      vtable for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in Source.o
  "boost::python::converter::registration::expected_from_python_type() const", referenced from:
      boost::python::converter::expected_pytype_for_arg<char const*>::get_pytype() in Source.o
  "typeinfo for boost::python::objects::py_function_impl_base", referenced from:
      typeinfo for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > > in Source.o
  "vtable for boost::python::objects::py_function_impl_base", referenced from:
      boost::python::objects::py_function_impl_base::py_function_impl_base() in Source.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The linker output is:

Ld build/Debug/Midi2KontaktDLL.dylib normal x86_64
    cd /Users/didi/Development/Juce/Midi2KontaktDLL/Builds/MacOSX
    export MACOSX_DEPLOYMENT_TARGET=10.11
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -L/Users/didi/Development/Juce/Midi2KontaktDLL/Builds/MacOSX/build/Debug -L/usr/local/Cellar/boost-python3/1.70.0_1/lib -L/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib -F/Users/didi/Development/Juce/Midi2KontaktDLL/Builds/MacOSX/build/Debug -filelist /Users/didi/Library/Developer/Xcode/DerivedData/Midi2KontaktDLL-eupsdkbbrcwqymategfreyedipek/Build/Intermediates.noindex/Midi2KontaktDLL.build/Debug/Midi2KontaktDLL\ -\ Dynamic\ Library.build/Objects-normal/x86_64/Midi2KontaktDLL.LinkFileList -install_name /usr/local/lib/Midi2KontaktDLL.dylib -mmacosx-version-min=10.11 -Xlinker -object_path_lto -Xlinker /Users/didi/Library/Developer/Xcode/DerivedData/Midi2KontaktDLL-eupsdkbbrcwqymategfreyedipek/Build/Intermediates.noindex/Midi2KontaktDLL.build/Debug/Midi2KontaktDLL\ -\ Dynamic\ Library.build/Objects-normal/x86_64/Midi2KontaktDLL_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -framework Accelerate -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreMIDI -framework IOKit -framework OpenGL -framework QuartzCore -framework WebKit -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/didi/Library/Developer/Xcode/DerivedData/Midi2KontaktDLL-eupsdkbbrcwqymategfreyedipek/Build/Intermediates.noindex/Midi2KontaktDLL.build/Debug/Midi2KontaktDLL\ -\ Dynamic\ Library.build/Objects-normal/x86_64/Midi2KontaktDLL_dependency_info.dat -o /Users/didi/Development/Juce/Midi2KontaktDLL/Builds/MacOSX/build/Debug/Midi2KontaktDLL.dylib

I would appreciate any help!

If you want to link to a library, you don’t only need to specify the library search path, you also have to specify the actual library to link against. Go to the Xcode exporter in the projucer and put boost-python3 into the “External libraries to Link” field.

Side note: Normally libraries installed with homebrew should be found by just filling the External Libraries to Link field and don’t need an additional header search path to be supplied, as homebrew makes sure that the libraries are added to the standard linker search paths. At least on my Mac this just works.

Thanks!
Unfortunately I got:
library not found for -lboost-python3
although I put the path in the library search path:
/usr/local/Cellar/boost-python3/1.70.0_1/lib
Do you know how to solve it?

It seems that it is a very long journey…
I added boost_python37 into the “External libraries to Link” field and now it compiles and links properly (working fine with the simple boost example).
However when using:

    BOOST_PYTHON_MODULE(Midi2Kontakt)
     {
         using namespace boost::python;
         //def("greet", greet);
         //def("initkontakt", initKontakt )
         class_<RenderKontakt>("RenderKontakt", init<int, int>())
         .def("loadPlugin", &RenderKontakt::loadPlugin)
         .def("midi2wav", &RenderKontakt::loadMidi)
         ;
     }

I get after import the class to python:

>>>import Midi2Kontakt
JUCE v5.4.2
>>> Kontakt = Midi2Kontakt.RenderKontakt(44100,512)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() should return None, not 'NoneType'

I checked it in various blogs, and it is probably because different python versions. I use python3 and and linked against boost_python3.
Any idea how to make it works? Thanks!