How to add optional libraries by Homebrew

Dear experts

I used Homebrew to install root, recently I found that I need the fftw3 library, so I want to add it into root. But I can’t find how to do so (just like cmake arguments or ccmake), can someone tell how to do this?

Best regards

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: MacOS
Compiler: Not Provided

Hi @Crisps!

See also this thread here:

As explained there, you can’t easily change the flags because homebrew ships the ROOT binaries already built with certain flags.

Maybe it’s better to build ROOT from source outside homebrew in this case:

But by far the best solution would be to build math/fftw on to of an existing ROOT installation.
You just need a customized version of the CMake file, like I suggest in this PR:

Building math/fftw standalone just takes a few seconds, and if the headers are installed in your system inculde paths, then ROOT’s TVirtualFFT will pick it up and it will be just like you have installed ROOT with fftw3=ON without having to rebuild ROOT!

Let me know if you need any help with this.

1 Like

Thank you for the explanation, if I build fftw standalone of I need to build root from source? Or I can just use current version installed by HomeBrew and also build FFTW by HomeBrew?

Either is fine, but of course installing ROOT from HomeBrew is easier :slight_smile:

Let me know if the standalone fftw build works! If you put the CMake file I wrote in the math/fftw directory, it should be as easy as pointing CMake to this directory for the configuration: cmake <root_src>/math/fftw.

Sorry I didn’t understand which file should I put in which directory… if I installed root and fftw by homebrew separately I won’t have any CMake file inside, and I didn’t find math/fftw directory… does this mean that I must install root from source?

No, you don’t have to install ROOT from source. You only need to clone the root source code repository, because the math/fftw is in there:

In the math/fftw directory, you replace the existing CMakeLists.txt file with the one for standalone building that I wrote:

Then, you can just build math/fftw like a regular CMake project and ignore the rest of the root repository.