EDIT (22/06-21): I went thru all my nugets one by one and found that the extra mtouch args. comes from the Xamarin.Firebase.iOS nugets. Someone over there has made the lib. so that it append some global mtouch flags. (the current stable version appends "-ObjC -lc++ -lsqlite3 -lz")
Since it dont seem to help to open an issue over there i must somehow make my lib. work with those flags. great...
I have a weird problem with building a ios forms app.
We have made a dll of a native library (openCV2) with some functions we need.
we have made a PoC that builds and runs just fine, but when we take it to the "real" app it cant build.
right before the build fails i see in the log:
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch #/Users/xxx/Library/Caches/Xamarin/mtbs/builds/xxx.iOS/xxxx/obj/iPhone/Debug/device-builds/iphone11.2-14.6/response-file.rsp -v -v -v -v --gcc_flags=-ObjC
while on the PoC app the same line is:
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch #/Users/xxx/Library/Caches/Xamarin/mtbs/builds/xxx.iOS/xxxx/obj/iPhone/Debug/device-builds/iphone11.2-14.6/response-file.rsp
i know the "-v -v -v -v" is from my additional mtouch args. but no where (that i can find) is the gcc_flags set and i cant find a way to remove it.
what i have tried with no luck:
linking Foundation framework in the additional mtouch args. linking
Foundation framework in the LinkWithAttribues.cs file in the binding
project none, sdk-only and all linking. looked at diffrenses in the
project files made all the changes i can think of in the LinkWith
file eg. linker flags, smart linking c++ and the like. tried with and
w/o this linker flag 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
made sure the code in the implementation and PoC is 100% the same
made the iOS build options 100% the same in project and PoC
installed the xamarin.swift nuget
tried both 4.8 and 5.0 xamarin forms
im running
vs for mac 8.10 (for binding project)
vs2019 16.10.1 (for app building)
xamarin.ios 14.19 on both
does anyone have a idea on what is going wrong here?
Im at the end of my rope, any help or ideas on where to look would be greatly appricieted.
here is the complete "failing" build log:
1> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch #/Users/appteam/Library/Caches/Xamarin/mtbs/builds/xxx.iOS/xxx/obj/iPhone/Debug/device-builds/iphone11.2-14.6/response-file.rsp -v -v -v -v --gcc_flags=-ObjC
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): warning : Could not find or use auto-linked library 'swiftObjectiveC'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): warning : Could not find or use auto-linked library 'swiftCore'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): warning : Could not find or use auto-linked library 'swiftQuartzCore'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftObjectiveC'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCore'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftQuartzCore'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftos'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreGraphics'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftDarwin'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreFoundation'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCompatibility50'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftDispatch'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftAVFoundation'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreMedia'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftAccelerate'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftFoundation'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftsimd'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreImage'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreAudio'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftUIKit'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftCoreMIDI'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : warning: Could not find or use auto-linked library 'swiftMetal'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Foundation):Foundation.DataProtocol.copyBytes(to: Swift.UnsafeMutableRawBufferPointer) -> Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Foundation.__DataStorage.init(bytes: Swift.UnsafeRawPointer?, length: Swift.Int) -> Foundation.__DataStorage. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata accessor for Foundation.__DataStorage. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata accessor for Foundation.Data.RangeReference. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Foundation.Data._bridgeToObjectiveC() -> __C.NSData. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static Foundation.Data._unconditionallyBridgeFromObjectiveC(__C.NSData?) -> Foundation.Data. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol conformance descriptor for Foundation.Data : Foundation.DataProtocol in Foundation. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata for Foundation.Data. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: associated type descriptor for Swift.Sequence.Element. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: associated type descriptor for Swift.IteratorProtocol.Element. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: associated type descriptor for Swift.Sequence.Iterator. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: associated type descriptor for Swift.RawRepresentable.RawValue. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Foundation):Swift.Dictionary._bridgeToObjectiveC() -> __C.NSDictionary. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Hashable.hash(into: inout Swift.Hasher) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Hashable.hashValue.getter : Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol descriptor for Swift.Hashable. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: base conformance descriptor for Swift.Hashable: Swift.Equatable. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for static Swift.Equatable.== infix(A, A) -> Swift.Bool. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol descriptor for Swift.Equatable. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift.String.hash(into: inout Swift.Hasher) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift.String.write<A where A: Swift.TextOutputStream>(to: inout A) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata for Swift.String. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol witness table for Swift.String : Swift.Hashable in Swift. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence.makeIterator() -> A.Iterator. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A.Element>) -> (A.Iterator, Swift.Int). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence.underestimatedCount.getter : Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence._copyToContiguousArray() -> Swift.ContiguousArray<A.Element>. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence._customContainsEquatableElement(A.Element) -> Swift.Bool?. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.Sequence.withContiguousStorageIfAvailable<A>((Swift.UnsafeBufferPointer<A.Element>) throws -> A1) throws -> A1?. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: associated conformance descriptor for Swift.Sequence.Swift.Sequence.Iterator: Swift.IteratorProtocol. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol descriptor for Swift.Sequence. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Swift):Swift.Sequence.withContiguousStorageIfAvailable<A>((Swift.UnsafeBufferPointer<A.Element>) throws -> A1) throws -> A1?. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.RawRepresentable.rawValue.getter : A.RawValue. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.RawRepresentable.init(rawValue: A.RawValue) -> A?. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol descriptor for Swift.RawRepresentable. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Foundation):Swift.Array._bridgeToObjectiveC() -> __C.NSArray. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static (extension in Foundation):Swift.Array._unconditionallyBridgeFromObjectiveC(__C.NSArray?) -> [A]. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static Swift.Array._allocateBufferUninitialized(minimumCapacity: Swift.Int) -> Swift._ArrayBuffer<A>. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Foundation):Swift.Double._bridgeToObjectiveC() -> __C.NSNumber. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static (extension in Foundation):Swift.Double._forceBridgeFromObjectiveC(_: __C.NSNumber, result: inout Swift.Double?) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata for Swift.Double. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata for Swift.Float. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift.Int.hashValue.getter : Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata for Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol conformance descriptor for Swift.Int : Swift.BinaryInteger in Swift. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: method descriptor for Swift.IteratorProtocol.next() -> A.Element?. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol descriptor for Swift.IteratorProtocol. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Swift):Swift.BinaryInteger.description.getter : Swift.String. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift._StringGuts.grow(Swift.Int) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata accessor for Swift._ArrayBuffer. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: protocol conformance descriptor for Swift._ArrayBuffer<A> : Swift._ArrayBufferProtocol in Swift. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift._CocoaArrayWrapper.endIndex.getter : Swift.Int. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: Swift._CocoaArrayWrapper.subscript.getter : (Swift.Int) -> Swift.AnyObject. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: static Swift._DictionaryStorage.allocate(capacity: Swift.Int) -> Swift._DictionaryStorage<A, B>. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: type metadata accessor for Swift._DictionaryStorage. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error MT5210: Native linking failed, undefined symbol: (extension in Swift):Swift._ArrayBufferProtocol._outlinedMakeUniqueBuffer(bufferCount: Swift.Int) -> (). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
(... shortend ...)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(380,3): error : linker command failed with exit code 1 (use -v to see invocation)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Can you please check changing the Linker Behavior to "Link Framework SDKs only" :
I am trying to setup OpenCV in the MS Visual Studio Code 2019 through CMake.
Open CV version = 4.1.2
While running the build for the INSTALL it is giving the following error.
"Done building project "INSTALL.vcxproj" -- FAILED."
Following are the detailed error messages.
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/seam_finders.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/timelapsers.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/util.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/util_inl.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/warpers.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/stitching/detail/warpers_inl.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/x64/vc16/lib/opencv_superres412.lib
2>-- Installing: C:/Users/adity/repos/darknet/build/install/x64/vc16/bin/opencv_superres412.dll
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/superres.hpp
2>-- Installing: C:/Users/adity/repos/darknet/build/install/include/opencv2/superres/optical_flow.hpp
2>CMake Error at modules/python3/cmake_install.cmake:44 (file):
2> file cannot create directory: C:/Program
2> Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.2544.0_x64__qbz5n2kfra8p0/Lib/site-packages/cv2.
2> Maybe need administrative privileges.
2>Call Stack (most recent call first):
2> modules/cmake_install.cmake:170 (include)
2> cmake_install.cmake:125 (include)
2>
2>
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: The command "setlocal
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd" exited with code 1.
2>Done building project "INSTALL.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 148 up-to-date, 0 skipped ==========
run Visual Studio with administrative privileges. it will succeed with no errors
The application is ready for Xamarin IOS.
Yesterday there was no problem. I did visual studio update for hot restart to 16.7.3.
Today when I turn it on, I am remote to the mac, but when I say build, I get linking failed errors like the following, about 33.
I haven't installed any nuget packages etc.
It took me a day to undo the last changes I made.
It builds when not connected to the Mac but when I connect to the mac I get these errors anyway.
I can't figure it out. Can you help me?
This is the project output while building:
2> takikuyumculuk.iOS -> C:\Users\Onur\source\repos\takikuyumculuk\takikuyumculuk\takikuyumculuk.iOS\bin\iPhoneSimulator\Release\takikuyumculuk.iOS.exe
2> Detected signing identity:
2>
2> Bundle Id: com.takikuyumculuk.apple
2> App Id: com.takikuyumculuk.apple
2> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch #/Users/takikuyumculuk/Library/Caches/Xamarin/mtbs/builds/takikuyumculuk.iOS/9d7e2ac1ac9741d6ee40a3186654ad40/obj/iPhoneSimulator/Release/response-file.rsp "--gcc_flags=-ObjC -lc++ -lsqlite3 -lz"
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULIsLoggableLevel. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULLogBasic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULLogError. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULLogInfo. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULLogWarning. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _GULSetLoggerLevel. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5211: Native linking failed, undefined Objective-C class: GULAppDelegateSwizzler. The symbol '_OBJC_CLASS_$_GULAppDelegateSwizzler' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5211: Native linking failed, undefined Objective-C class: GULAppEnvironmentUtil. The symbol '_OBJC_CLASS_$_GULAppEnvironmentUtil' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5211: Native linking failed, undefined Objective-C class: GULMutableDictionary. The symbol '_OBJC_CLASS_$_GULMutableDictionary' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5211: Native linking failed, undefined Objective-C class: GULNetwork. The symbol '_OBJC_CLASS_$_GULNetwork' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5211: Native linking failed, undefined Objective-C class: GULSwizzler. The symbol '_OBJC_CLASS_$_GULSwizzler' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusCodeCannotAcceptTraffic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusCodeNotFound. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusCodeNotModified. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusCodeUnavailable. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusNoContent. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _kGULNetworkHTTPStatusOK. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_decode. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_decode_varint. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_encode. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_encode_string. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_encode_submessage. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_encode_tag_for_field. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_encode_varint. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_istream_from_buffer. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_ostream_from_buffer. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5210: Native linking failed, undefined symbol: _pb_read. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'System.Net.Security' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'dl' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): warning MT5215: References to 'kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lc++ -lsqlite3 -lz
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error : ] in GoogleAppMeasurement(APMMeasurement_87bdad44f2b9aa68c2d607a36be1b8c5.o)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error : ] in GoogleAppMeasurement(APMMeasurement_87bdad44f2b9aa68c2d607a36be1b8c5.o)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error : ] in GoogleAppMeasurement(APMMeasurement_87bdad44f2b9aa68c2d607a36be1b8c5.o)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error : ] in GoogleAppMeasurement(APMMeasurement_87bdad44f2b9aa68c2d607a36be1b8c5.o)
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(884,3): error : linker command failed with exit code 1 (use -v to see invocation)
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
This is the image of errors:
Background:
On a Windows 10 PC, I have a c++ codebase. Using CMAKE I generate an Mingw-w64 project (using Eclipse IDE) and a Visual Studio 2017 project. I like compiling my projects with different build systems as each gives different warnings and errors.
As part of the Mingw build, I can enable clang-tidy checks using CMAKE's CXX_CLANG_TIDY. This works well, producing a co-compile showing many interesting warnings from clang-tidy.
When I installed mingw-w64, llvm and VS I was careful not to allow these to populate the PATH environment variable, so a regular command prompt won't run gcc, clang, or CL or any associated tools. The environment is set up by a batch file before launching Eclipse or Visual Studio.
This has worked well for years (I'm still using clang 7.0.1). Both IDE's compile the same code base just fine...
Until I upgrade to Visual Studio 2019, including it's own copy of clang 10.0.0.
Now, my original clang 7.0.1 has stopped working! As I only use clang-tidy it took a while to narrow this down, but the original clang is looking for the system headers in the new clang's include location. The headers it finds are too new and the build fails.
I have found many things to try on SO and elsewhere (although any pointers are welcome) like supplying a --sysroot switch, so this question is more specific:
Question:
When there are no apparent environment variables to point to a specific clang location, where does clang find it's default target triple and therefore it's -internal-isystem paths? Why does my previously-working clang installation now look for it's system headers in a more recently installed clang location?
With a Windows command prompt:
cd C:\Program Files\LLVM\bin (my original clang location)
C:\Program Files\LLVM\bin>clang test.cpp -v
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
"C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows-msvc19.26.28806 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\7.0.1" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\7.0.1\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.18362.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt" -fdeprecated-macro -fdebug-compilation-dir "C:\\Program Files\\LLVM\\bin" -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.26.28806 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\Foo\\AppData\\Local\\Temp\\test-c0aac1.o" -x c++ test.cpp
clang -cc1 version 7.0.1 based upon LLVM 7.0.1 default target x86_64-pc-win32
#include "..." search starts here:
#include <...> search starts here:
C:\Program Files\LLVM\lib\clang\7.0.1\include
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt
End of search list.
In file included from test.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\string:9:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\yvals_core.h:462:2: error:
STL1000: Unexpected compiler version, expected Clang 9.0.0 or newer.
#error STL1000: Unexpected compiler version, expected Clang 9.0.0 or newer.
Where C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include is the installed-only-today clang 10.0.0 location, so clearly not compiled into clang.exe.
Where does clang get it's defaults from?
The only "ground truth" is the code of clang itself.
With multiple versions of MSVC installed, clang will use different tricks to setup environment when initializing MSVC toolchain driver (see MSVCToolChain::MSVCToolChain() at the link above)
To solve a similar case I used VCToolsInstallDir environment variable to direct clang to old MSVC include paths.