1.  install the Xcode command line tools, it will give you gcc, make and most commandline tools. To install open terminal and type "xcode-select —install"
  2. You need a few other libraries for successfully building minifi on a mac. I used brew to install the additional libraries (make,leveldb,uuid,boost ).  
    1. if you don have brew execute "/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    2. if you already have brew make sure to update it by "brew update". if you get errors doing update check Fix brew update error section.
  3. install the additional libraries
    1. brew install cmake
    2. brew install leveldb
    3. brew install ossp-uuid
    4. brew install boost
    5. brew install doxygen
  4. Build minifi . Clone the Minfi-cpp git project. In context to this guide i have minifi-cpp under /opt/code/nifi-minifi-cpp
    1.  Change Directory to minifi source folder - cd /opt/code/nifi-minifi-cpp
    2. mkdir build
    3. cd build
    4. cmake ..
    5. make
    6. make package
  5. You should have a tar.gz file in the build folder. Untar and run minifi by “bin/minifi.sh start”
  6. Alternately you can run minifi from the /opt/code/nifi-minifi-cpp/build folder using “nohup main/minifi &”
  7. If you get an error for MINIFI_HOME or ../conf, make sure there is a conf folder , with minifi.properties at the minifi root level.

 

Debugging Minifi

  1. Run with debug log level.
    1. vi main/MinifiMain.cpp and change logger->setLogLevel(logging::info);  to logger->setLogLevel(logging::debug);
  2. Step by Step debugging
    1. go to your build director "cd build"
    2. o debug build minifi with debug optionns "cmake -DCMAKE_BUILD_TYPE=Debug .."
    3. execute make
    4. you should already have lldb from command line install. execute "lldb -f main/minifi"
    5. you should now see a lldb prompt. issue the commands on the lldb prompt.
    6. set a breakpoint to where you want to start debugging "(lldb) breakpoint set --file FlowController.cpp --line 229"
    7. delete break point (lldb) breakpoint delete <id>
    8. start minifi "process launch" , add --stop-at-entry to break at the main method.
    9. step through the code using s -> step-in , n->step-over, f->step-out


 

Fix brew update error

  1. sudo chown -R ${whoami} /usr/local - gives you ownership of /usr/local
  2. cd /usr/local
  3. git reset --hard FETCH_HEAD
  4. git checkout Library

 

  • No labels