ngraph-bridge
ngraph-bridge copied to clipboard
macOS users need to use clang (make 'gcc' a symbolic link to clang)
I thought I'd put this up as an issue to help anyone who got confused (like me) by the instructions to use gcc 4.8 for building ngraph-bridge (and building tensorflow with the --use_prebuilt_tensorflow option). I am building using the following command: python3 build_ngtf.py --use_prebuilt_tensorflow
On macOS, you can put a symbolic link (/usr/local/bin/gcc) to force building to use gcc and not clang. My mac was set up like this. When building ngraph-bridge/tensorflow, this will produce the error: gcc: error: unrecognized command line option '-fobjc-link-runtime’
This is because this option ('-fobjc-link-runtime’) is recognised by clang not gcc.
In order to get the build working, I needed to issue the following: rm /usr/local/bin/gcc ln -s /usr/bin/clang /usr/local/bin/gcc
Thanks for the report. The typical way to override C/C++ compilers used during the build is to set the CC
and CXX
environment variables. I believe that something like the following should work for you:
$ CC=clang CXX=clang python3 build_ngtf.py --use_prebuilt_tensorflow
If yes, then we could add a note to the "Note to macOS users" section in the README.
macOS uses clang by default. I set mine up to use gcc (using a symbolic link to gcc at /usr/local/bin/gcc) because I had to build another package using gcc. Building ngraph-bridge worked fine as soon as I deleted my symbolic link (/usr/local/bin/gcc). So it should be enough to just note in the README that macOS users need to use clang. The table in the README indicates that, but maybe there could be a reference to it in the notes.