Revert Apple Clang Version For NVCC - ios

I am trying to run NVCC to compile a CUDA program on my Mac.
When I try to run NVCC, I am receiving the following error: "nvcc fatal : The version ('70300') of the host compiler ('Apple clang') is not supported".
I recently updated my XCode version to 7.3, and my Mac to 10.11.4.
Is there any way to revert my Clang Version?

Go to https://developer.apple.com/downloads/, log in and then download http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg, and install, as was suggested by fabregaszy.
Run the following command to switch to the old version:
sudo xcode-select --switch /Library/Developer/CommandLineTools
Run the following command to quickly check clang version:
clang --version

The accepted answer says to download the next-to-latest command line tools and install them, then select them by typing in the console
sudo xcode-select --switch /Library/Developer/CommandLineTools
Its been asked how to revert to the original version of the tools. This is achieved by
sudo xcode-select --switch /Applications/Xcode.app

I just had the same issue after upgrading to XCode 7.3 on 10.11. Reinstalling the previous (7.2) command line tools didn't downgrade the default clang compiler. To fix this I used a previous XCode.app package to rename and copy the XcodeDefault.xctoolchain directory into the Toolchains director in the current /Applications/Xcode.app. You have to right click on Xcode.app to "Show package contents" then browse to the Toolchains dir.
Then (re)start Xcode, hit command-, for preferences, then go to locations. You will see the dropdown for Command Line Tools. Change this to the version of the toolchain you copied over.
You can check the default version of clang in Terminal:
clang -v OR llvm-gcc -v
Now nvcc should work

I came into the same issue.
I think the old command-line tools which can be downloaded from
https://developer.apple.com/downloads/
may solve this issue.
Updated:
I downloaded from the link below and installed, the clang version was successfully reverted to Apple LLVM version 7.0.2 clang-700. But please keep an eye on your OS X version.
http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg

I would try homebrew's version of llvm, it works for me.
brew install llvm37
Then, set your compiler to homebrew's clang:
/usr/local/bin/clang++-3.7 or whatever respondes to
which clang++-3.7
That way you can leave your OS X dev environment defaults as they are.

Unfortunately, installing Command Line Tools from X-code version 7.2. currently is not solving this.
Trying to compile results in:
nvcc fatal : GNU C/C++ compiler is no longer supported as a host compiler on Mac OS X.
What did the trick for me, was to uninstall Xcode 7.3 and install Xcode 6.2 from the Apple developer site.

Rename Xcode exists in your mac as Xcode-7.app in /Applications folder.
Then download Xcode6.4 from https://developer.apple.com/download/more/ and install it.

80100 can work with some nvcc programs
I used "80100" and nvcc work for some of my other programs.
... but not sample
`
...
nvcc fatal : The version ('80100') of the host compiler ('Apple clang') is not supported
...
`
install CLT 8.2 (Command line tool from Apple) it is sort of ok with message about "command line tools instance"
I google and see a discussion about this (https://github.com/arrayfire/arrayfire/issues/1384) about array fire nvcc issue and thanks to the hint to switch to CLT 8.2, the last version not current one. It is sort of ok with warning message about "command line tools instance"
Need to use "sudo make" to compile sample code:
`
...
$ sudo make
Password:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
expr: syntax error
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery.o -c deviceQuery.cpp
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -m64 -Xcompiler -arch -Xcompiler x86_64 -Xlinker -rpath -Xlinker /Developer/NVIDIA/CUDA-8.0/lib -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery deviceQuery.o
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
mkdir -p ../../bin/x86_64/darwin/release
cp deviceQuery ../../bin/x86_64/darwin/release
$ ./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
...
`

I had the same problem!
Looked in my Time Machine Backups and copied Xcode.app (7.2.1) in my /Application folder. You could also download it from the Apple Developer Page and move it into your /Application folder.
After it's done, you can change the Xcode Command Line Version in your Preferences of Xcode to 7.2.1
Then nvcc will work again (even with pycuda-2016.1).
clang --version
gives me:
Apple LLVM version 7.0.2 (clang-700.1.81)

Related

Not able to build openh264 for ios because of libstdc++

I am trying to build openh264 for ios. I have downloaded the source code from the latest release. then changed the PREFIX in makefile to ios_local. After that I did make OS=ios ARCH=arm64 which completed with lot of warning.
After that when I did sudo make OS=ios ARCH=arm64 install It exited with error like below
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libopenh264.2.0.0.dylib] Error 1
After researching it seems like Apple does not support libstdc++ now, so mac os compatible version is libc++ which is supposed to be installed when you install XCode. My XCode version is Version 10.2.1 (10E1001) which is more than enough to get this libc++ I think.I am using macOS Mojave. What's going wrong here?

dsymutil missing compiling GNU bash on iOS

I'm trying to compile GNU bash 4.3.30 on (and for) my iPad 2, iOS 8.4 using Clang, ld64, cctools, GNU make and the iOS 8.1 SDK. When processing bashversion, Clang is "unable to execute dsymutil", and reports that it "doesn't exist", exiting with error 1.
$ make
(...)
"/usr/bin/ld" -demangle -dynamic -arch armv7 -iphoneos_version_min 5.0.0 -syslibroot /var/mobile/iPhoneOS8.1.sdk -o bashversion -lcrt1.3.1.o -L./lib/termcap /var/tmp/bashversion-814fa1.o buildversion.o -lSystem
"dsymutil" -o bashversion.dSYM bashversion
clang: error: unable to execute command: Executable "dsymutil" doesn't exist!
clang: error: dsymutil command failed with exit code 1 (use -v to see invocation)
make: *** [bashversion] Error 1
$ echo $CC
clang --sysroot /var/mobile/iPhoneOS8.1.sdk -v
$ clang --version
clang version 3.5.0 (trunk)
Target: armv7-apple-darwin-14.0.0
Thread model: posix
$ ld -v
#(#)PROGRAM:ld PROJECT:ld64-
configured to support archs: i386 x86_64 armv4t armv5 armv6 armv7 armv7f armv7k armv8 arm64 arm64v8
$ which dsymutil
$ dsymutil
-sh: dsymutil: command not found
$ find / -name dsymutil
$
Apparently, my iPad has no dsymutil. So, where can I find one? Does it come with Xcode? Or is there any way to compile GNU bash 4.3.30 without it?
Dsymutil is a closed source tool, and is not available for iOS.
But that's not much of a problem, just create a symlink to /bin/true,
i.e.
ln -s /bin/true /usr/bin/dsymutil

stop compilation switching to clang

No matter what I try, any compilation I attempt always calls clang. For example, in CMake, setting CC=/usr/bin/gcc has no effect and clang is still called. In terminal entering any compiler results in clang being called:
~/tinyos-main/tools$ nescc
clang: error: no input files
~/tinyos-main/tools$ gcc
clang: error: no input files
Can I stop this? Running on OS X Yosemite and using home-brew.
~$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
No, gcc is not installed as /usr/bin/gcc. Clang is installed as /usr/bin/gcc, because Apple doesn't ship gcc anymore. If you want gcc, you need to install it (presumably by saying brew install gcc) and then setting CC=/usr/local/bin/gcc.

Compile Poco Library for iPhone5S (arm64)

I want to compile the Poco Library for iPhone5S(arm64). However, I come across the following compile error.
Step to Do
./configure --config=iPhone -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL
make IPHONE_SDK_VERSION_MIN=4.3 POCO_TARGET_OSARCH=arm64 -s -j4
And following error was found.
/Users/edrictse/Downloads/poco-1.4.6p2-all/build/script/makedepend.gcc src/LogFile.cpp /Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/.dep/iPhoneOS/arm64/LogFile.d /Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/obj/iPhoneOS/arm64/debug_static /Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/obj/iPhoneOS/arm64/release_static /Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/obj/iPhoneOS/arm64/debug_shared /Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/obj/iPhoneOS/arm64/release_shared -Iinclude -I/Users/edrictse/Downloads/poco-1.4.6p2-all/CppUnit/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Foundation/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/XML/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Util/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Net/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Crypto/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/NetSSL_OpenSSL/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Data/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Data/SQLite/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Data/ODBC/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Data/MySQL/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/Zip/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/PageCompiler/include -I/Users/edrictse/Downloads/poco-1.4.6p2-all/PageCompiler/File2Page/include -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -mthumb -miphoneos-version-min=4.3 -Wall -Wno-sign-compare -DPOCO_BUILD_HOST=edric-macbook.local -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS
ls: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-: No such file or directory
/Users/edrictse/Downloads/poco-1.4.6p2-all/build/script/makedepend.gcc: line 24: -MM: command not found
ls: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-: No such file or directory
Poco Library Version : poco-1.4.6p2
XCode Version : 5.0
Can anyone provide me the solution.
Thanks.
I just downloaded poco library and was able to do the configure easily via:
[/tmp]:;./configure --config=iPhone -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL make IPHONE_SDK_VERSION_MIN=4.3 POCO_TARGET_OSARCH=arm64 -s -j4
Configured for iPhone
I suspect what you really need to do here is make certain your Xcode command line tools are installed. When you go to Xcode preferences, do you have them installed and set to the latest version, like this?
Command line tools (if you don't see them in that pop-up menu) can be downloaded from http://developer.apple.com/downloads
Finally I come up with the solution which credit from this thread.
Step 1: Configure
./configure —config=iPhone —static —no-tests —no-samples --omit=Data/ODBC,Data/MySQL
For OpenSSL support
./configure —config=iPhone —static —no-tests —no-samples --omit=Data/ODBC,Data/MySQL --include-path=[OPENSSL INCLUDE PATH]
Step 2: Change the Compile
Open file in "poco-1.4.6p2-all/build/config/iPhone", Change :
for CC: xcrun -find -sdk iphoneos clang
for CXX: xcrun -find -sdk iphoneos clang++
Step 3: Make your library
make IPHONE_SDK_VERSION_MIN=3.0 POCO_TARGET_OSARCH=armv6 -s -j4
make IPHONE_SDK_VERSION_MIN=3.2 POCO_TARGET_OSARCH=armv7 -s -j4
make IPHONE_SDK_VERSION_MIN=4.3 POCO_TARGET_OSARCH=armv7s -s -j4
make IPHONE_SDK_VERSION_MIN=4.3 POCO_TARGET_OSARCH=arm64 -s -j4

/usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64)

having this problem on installing several things on my mac,
i think this problem is coming from upgrading my leopard to snow leopard. Also this problem also is linked with macports i think.
/usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64)
Any ideas?
Update
To be more specific this happens on installing nokogiri gem
and the log looks like:
xslt_stylesheet.c:127: warning: passing argument 1 of ‘Nokogiri_wrap_xml_document’ with different width due to prototype
cc -dynamic -bundle -undefined suppress -flat_namespace -o nokogiri.bundle
html_document.o html_element_description.o html_entity_lookup.o html_sax_parser_context.o nokogiri.o xml_attr.o xml_attribute_decl.o xml_cdata.o xml_comment.o xml_document.o xml_document_fragment.o xml_dtd.o xml_element_content.o xml_element_decl.o xml_encoding_handler.o xml_entity_decl.o xml_entity_reference.o xml_io.o xml_libxml2_hacks.o xml_namespace.o xml_node.o xml_node_set.o xml_processing_instruction.o xml_reader.o xml_relax_ng.o xml_sax_parser.o xml_sax_parser_context.o xml_sax_push_parser.o xml_schema.o xml_syntax_error.o xml_text.o xml_xpath_context.o xslt_stylesheet.o -L. -L/usr/local/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L. -lruby -lexslt -lxslt -lxml2 -lpthread -ldl -lobjc
ld: in /usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64)
collect2: ld returned 1 exit status
make: *** [nokogiri.bundle] Error 1
This is not about MacPorts:
zlib is installed as i386, so you have to build it for x86-64. Here's how to do it:
Update: As Nick says in his comment, you first have to remove old zlib files: sudo rm /opt/local/lib/libz*
Download zlib source code from its webpage
Extract the source, and open a terminal in source location
./configure, make and sudo make install
If it still doesn't work, remove ruby and install it again (you can do it with RVM)
Hope it helped you.
You might have x86_64 compiled zlib installed in
/usr/local/opt/zlib/ or alternatively do a brew install zlib
this will install zlib in /usr/local/Cellar/.
Temporary remove libz.* from /usr/local/lib/ into a backup folder.
Do gem install nokogiri -v '<version>' --with-zlib-dir=<zlib directory path from step 1>
Nokogiri must be installed by now. Restore the backup libz again.
It is a macport migration to snow leopard issue, sadly you have to reinstall macports and all the ports to have the right architecture. Read the wiki here: https://trac.macports.org/wiki/Migration

Resources