-
-
Save xianyi/2957847 to your computer and use it in GitHub Desktop.
Replace the native OS X assembler (/usr/bin/as) by a script which calls the clang assembler. (http://old.nabble.com/Re%3a-gcc,-as,-AVX,-binutils-and-MacOS-X-10.7-p32584737.html)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HAS_INPUT_FILE=0 | |
ARGS=$@ | |
while [ $# -ne 0 ]; do | |
ARG=$1 | |
# Skip options | |
if [ $ARG == "-arch" ] || [ $ARG == "-o" ]; then | |
# Skip next token | |
shift | |
shift | |
continue | |
fi | |
if [ `echo $ARG | head -c1` == "-" ]; then | |
shift | |
continue | |
fi | |
HAS_INPUT_FILE=1 | |
break | |
done | |
if [ $HAS_INPUT_FILE -eq 1 ]; then | |
clang -c -x assembler $ARGS | |
else | |
clang -c -x assembler $ARGS - | |
fi |
Thanks this solved my problem! I had installing xgboost which gave me the following error: FATAL:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
I noticed something was wrong with the assembler since running $as --version also gave me a similar error. Replacing /usr/bin/as with the above solved the problem.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a bunch for this!
When I use it with include flags (e.g. g++ -I/opt/local/include/), then I get warnings such as
clang: warning: argument unused during compilation: '-I /opt/local/include/'
Would it be possible to filter out includes from $ARGS before passing them into clang?