Clang error after using OpenFrameworks Project Generator - xcode

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

Related

Xamarin iOS binding library (Swift) build error due linker issues

I have Xamarin.iOS project and I'm trying to use Vivalnk sdk (a Swift 5 framework) in it.
I'm attempting to walk through this guide:
https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-swift/walkthrough
Note that I've ignored building native library step as Swift sdk was provided with objective-c headers built-in.
So, I used an objective sharpie to generate ApiDefinitions.cs and StructsAndEnums.cs files.
Once used this command : (Objective c)
sharpie bind --sdk=iphoneos14.2 --output="XamarinApiDef" --namespace="Binding" --scope="/VivalnkSDK.framework/Headers/" "/VivalnkSDK.framework/Headers/VVBleManager.h"
and once used this : (Swift)
sharpie bind -sdk iphoneos14.2 -scope VivalnkSDK.framework/Headers/ VivalnkSDK.framework/Headers/VVBleManager.h
And finally, I used the following command's results:
sharpie bind -sdk iphoneos14.2 -scope VivalnkSDK.framework/Headers/ VivalnkSDK.framework/Headers/VivalnkSDK-swift.h
Then, I created iOS binding library, replaced these files with old ones, and set the build action according to Microsoft's document.
Then, I added Vivalnk framework to Native References, set smartlink to true, and force load to false.
After a successful binding library build, I referenced this iOS binding library to my Xamarin.iOS project and use it but when I bulid Xamarin.iOS project, got 249 errors like following errors:
Could not find or use auto-linked library 'swiftFoundation' (Vivalnk) Native linking
Native linking failed, undefined symbol: nominal type descriptor for Swift.Double. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210) (Vivalnk)
I search a lot on the internet and also tried these:
Set Linker behavior to Link Framework SDKs only.
Install Xamarin.Swift in both projects.
Add this :
-/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Wl,-rpath -Wl,#executable_path/Frameworks
to Linker Flags of native reference in the iOS binding library.
Add this :
--gcc_flags -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/ -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Wl,-rpath -Wl,#executable_path/Frameworks
in additional mtouch arguments in the executable project's iOS Build options.
I checked the location of Xcode, it is exactly there.
But none of them worked for me. I tested in both Visual Studio for Mac and windows and nothing changed.
I created a sample project here which contains everything you need to reproduce build errors:
https://github.com/SomayeEbrahimi/Vivalnk.iOS
Environment:
Vivalnk architecture sdk: Arm64
Visual Studio for mac Version: 8.8.4
Visual Studio for windows : 16.8.3
Xamarin.iOS version : 14.6.0.15
XCode Version: 12.2
Swift Version: 5
Update
If I add "Foundation" to frameworks of native reference, those errors will disappear and we will have the following error
Vivalnk.iOS/Vivalnk/error MT5209: Error: in XCode/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCompatibility50.a(Overrides.cpp.o),
building for iOS, but linking in object file built for iOS Simulator, for architecture arm64 (Vivalnk) Native linking

Force SDK for make and xcrun version error

I am trying to compile with make using c++ on a 10.15 system under Xcode and Command Line Tools 12.2. It keeps wanting to use the 10.15 SDK which does not support arm64. I am thus getting architecture not supported errors.
My make file contains:
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
and the build command contains:
-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
Curiously:
xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
xcrun --show-sdk-version
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" cannot be located.
xcrun: error: unable to lookup item 'SDKVersion' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk'
Any ideas? There was a clean install on Xcode 11.7 previously and then I copied 12.2 (replacing 11.7). I have verified that the SDK (v15) exists at /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk and the OSX11 SDK is also in the SDK folder.
A build for x86_64 works fine.

Xcode 7 - How to remove ld: warning: -read_only_relocs cannot be used with x86_64

I have recently updated to Xcode 7 and now receive the following warning when I compile:
ld: warning: -read_only_relocs cannot be used with x86_64
I don't think I changed anything in the build settings or code to create this. Does anyone know what is causing this warning and how to remove it?
I have found the problem for those interested. As mentioned in the comment, I'm using the Twilio API and if you install this via cocoapods it adds the -read_only_relocs flag to the Other Linker Flags in Xcode (found under Build Settings). Not only does this generate the warning above (on the simulator) but it wont compile on an actual device because you can't have both BITCODE = YES and this flag. If you want to compile, you will need to set Enable Bitcode to No in the Build Options.

Building POCO on OSX gives warning during linking

Hi I have built Poco on OSX 10.11 using the following commands:
./configure --static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL,Data/MongoDB --include-path=$OPENSSL_INCLUDE_PATH
make -j2
My deployment target in XCODE is set to 10.10 and hence when I run the project I get several warnings of type:
ld: warning: object file (libPocoNetSSL.a(PrivateKeyFactory.o) was built for newer OSX version (10.11) than being linked (10.10)
How can I build POCO for 10.10, Is there any custom flag or directive that can be used?
Any help would be appreciable.
Try adding -mmacosx-version-min=10.10 to Darwin-clang.

Error when trying to archive xcode project

My project runs fine when I run it using the iPhone simulator, and when I run it on a device. When I try to archive it for submission, I get this error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This was directly before the error and I'm not sure if it's related:
ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Volumes/Macintosh HD/Users/dog94a/Google Drive/Capstone/Backups/Approach/Approach/GMaps/GoogleMaps.framework/GoogleMaps for architecture armv7s
The default behavior of the Debug build configuration is to only build the active architecture (Build Active Architecture Only build setting is YES). This is not the case for the Release build configuration, which will build all architectures supported by your Valid Architectures build setting. What this means is that you're likely not targeting an armv7s device during your Debug builds (iPhone 5, latest iPad, etc), so you're not attempting to build that architecture until you do an archive which uses the Release build configuration by default.
The error indicates that your project is configured to create a binary that has armv7s instructions for when it runs on devices of that type, but the GoogleMaps.framework binary you're trying to link against was not built with an armv7s slice. To fix this, you either have to update to the latest version of the GoogleMaps.framework and hope they built it with armv7s enabled, or remove armv7s from your Valid Architectures build setting (obviously the former is preferable).
Once I have included a framework and at compile time nagged the linker for armv7. Now you have armv7s, which is the iphone5?
Solution to my problem it was: remove all files from that framework.
Compile that framework ( double check at Valid architectures settings to be there the desired architecture
Re-add the newly compiled framework.
Try and maybe it helps or even solve your problem too!

Resources