I have Xcode 7.3 installed, and the swiftc command line compiler declares that is is version 2.2, yet it is configured to target the macos10.9 sdk:
🍺> swiftc -v
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
FWIW I am running OS X 10.11.6. Compiling Metal API code using this swiftc in this configuration results in errors such as:
src/Application.swift:76:29: error: 'MTLBuffer' is only available on OS X 10.11 or newer
var _mtlPositionBuffer : MTLBuffer?
And finally, to address this, I've compiled with the flag:
-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
to no avail. How do you change the sdk/platform target for the swiftc command line compiler?
Looking at what Xcode does when compiling swift code, it uses the following CLI flag, which seems to address the problem here nicely:
-target x86_64-apple-macosx10.11
Related
I'm trying to update an OpenFrameworks project using the Project Generator.
After updating the project, I'm now getting the following error in Xcode 8.2.1:
clang: error: unknown argument: '-mmacosx-version-min'
That flag is found in the Apple LLVM 8.0 - Custom Compiler Flags section of Build Settings in both my Project and Target:
Anyone have an idea on what the issue may be? I'm on macOS 10.12.1 Sierra.
You can remove the -mmacosx-version-min flag; Xcode uses MACOSX_DEPLOYMENT_TARGET.
MACOSX_DEPLOYMENT_TARGET specifies the minimum version of OS X for the build target.
↳ Configuring a Project for SDK-Based Development
I have a Mac dev machine that has installed Xcode 7.3.1 and Xcode 8.0.
After updating to CUDA 8, I set up the system to use the Xcode 7.3.1 command line tools, as Xcode 8 command line tools are currently unsupported by nvcc 8.0.
After updating the OS from OS X 10.11 El Capitan to macOS 10.12 Sierra, I am no longer able to compile a hello world program with CUDA 8.
The compilation fails, the output containing hundreds of lines of /usr/include headers, starting with:
/usr/include/stdio.h(133): error: expected a ")"
/usr/include/stdio.h(134): error: expected a ")"
/usr/include/stdio.h(134): error: "_Nullable" has already been declared in the current scope
I downloaded and re-installed the Command Line Tools (OS X 10.11) for Xcode 7.3.1 that seem to have been corrupted through the OS update.
nvcc 8.0 now works as intended.
This is a strange problem. My XCode version is 6.3.2. After I installed the command line tools, I could not compile any more. Any compilation that need to link with a dylib will cause the error like:
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libm.dylib' for architecture x86_64
This happens when I use pip to install uwsgi and compile mongrel2 manually.
I have already export SDKROOT to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk and xcrun --show-sdk-path is showing that. gcc --version shows:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
I know that gcc is link to clang, and I have tried to add option -mmacosx-version-min=10.9 to the CFLAGS, but nothing fixed.
I want to change the SDK to MacOSX, not iOS Simulator, how can I do that? Or what can I do to fix this.
I compiled my App using Qt 5.3.2 on my Mac OS X 10.9 and it runs on Mac OS X 10.6 without any issue. But due to a bug in Qt 5.3.2 (unfixed) which causes the apps to crash on maximizing, if focus is on tree view, I had to switch to Qt 5.4.
After compiling my app using Qt 5.4 on Mac OS X 10.9, it no more runs on Mac OS X 10.6. It crashes with the error:
dyld: library not loaded: /usr/lib/libc++.1.dylib Qt
After some searching I figured out that
Running Qt apps on Mac OS X 10.6 is not supported by Qt 5.4 binaries available on Qt Website. A custom build is required for the same.
As per one source:
To make clang++ produce binaries compatible with g++ from llvm-gcc-4.2.1, use these compiler and linker flags: -stdlib=libstdc++ -mmacosx-version-min=10.6
These will make sure we link with the 10.6 CRT and that we do not link with libc++ (the default C++ library for clang++).
For custom build:
./configure -prefix $PWD/qtbase -opensource -no-c++11 -debug-and-release -nomake examples -nomake demos
10.6 is no longer supported in Qt 5.4
If you even compile it manually using -no-c++11, your app resulting executable will crash on 10.6
5.3.2 is the last to support 10.6 with -no-c++11
I'm trying to build a static, universal Qt from source on Mac OS X 10.6 using the following command:
sh configure -static -opensource -universal
The problem, I have been told, is that PPC is not supported on 10.6 so I am getting many errors and the build eventually fails.
So I need to build for a different target version of OS X - 10.4 or 10.5. How can I do that? Do I need to add some parameters to my configure line and, if so, which ones?
Try using the -sdk option to configure. e.g.
./configure -sdk /Developer/SDKs/MacOSX10.5.sdk -opensource -universal
...if you want to make binaries targeting OSX 10.5 and later.
Statically linking is a separate issue again. I would not recommend it, especially since OSX already supports app bundles anyway, which I believe gives most of the same benefits to the end-user as static linking.