Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS users need to use clang (make 'gcc' a symbolic link to clang) #446

Open
dbonner opened this issue Jan 18, 2020 · 2 comments
Open

macOS users need to use clang (make 'gcc' a symbolic link to clang) #446

dbonner opened this issue Jan 18, 2020 · 2 comments

Comments

@dbonner
Copy link

dbonner commented Jan 18, 2020

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

@adk9
Copy link
Contributor

adk9 commented Jan 23, 2020

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.

@dbonner
Copy link
Author

dbonner commented Jan 23, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants