<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 12, 2016, at 1:02 PM, Slava Pestov <<a href="mailto:spestov@apple.com" class="">spestov@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 12, 2016, at 10:11 AM, Joe Groff via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Feb 12, 2016, at 3:13 AM, Труб Илья via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:<br class=""><br class="">As Joe suggested, I try to build swiftc and libSwiftCore on linux with some OpenSource ObjC runtime. Now, I have successfully built swiftc, but when building Swift.o, it generates a lot of homogenous errorsl for example:<br class=""><br class="">home/itrub/swift-root/swift/stdlib/public/core/ObjCMirrors.swift:23:45: error: argument type '_swift_shims_CFStringRef' (aka 'UnsafeMutablePointer<objc_object>') does not conform to expected type '_CocoaStringType' (aka 'AnyObject')<br class="">return _cocoaStringToSwiftString_NonASCII(theDescription)<br class=""> ^~~~~~~~~~~~~~<br class="">/home/itrub/swift-root/swift/stdlib/public/core/StringBridge.swift:27:54: error: cannot convert value of type '_CocoaStringType' (aka 'AnyObject') to expected argument type '_swift_shims_CFStringRef' (aka 'UnsafeMutablePointer<objc_object>')<br class="">let result = _swift_stdlib_CFStringCreateCopy(nil, source)<br class=""><br class="">There are also other errors, but all of them concern with mutual convertation of AnyObject and UnsafeMutablePointer<objc_object> or UnsafeMutablePointer<U>. Could somebody hint me direction of further researches? What swift compiler code and existence of which Objc-runtime functions I have to check firstly?<span class="Apple-converted-space"> </span><br class=""><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The errors suggest that it isn't recognizing CFStringRef as a CoreFoundation type, and is just importing it as a plain 'struct objc_object*' pointer type. The C importer is tuned toward Apple's headers so might need a lot of tweaking to properly handle a different CF implementation. The bridging code in the standard library is generally pretty intimately tied to the Apple implementation of NSString/NSArray/NSDictionary, so you might want to disable it altogether in order to make progress on the core interop.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Joe</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div class=""><br class=""></div>The bigger issue would be that IRGen only emits Objective-C metadata in a format compatible with Apple's runtime, right? Even if you got the headers to import and your code to link, we would need to change code generation to support the GNU runtime.</div></div></div></blockquote><br class=""></div><div>Definitely, I think you'd want to get the runtime ABI squared away before trying to get the standard library bridging code ported over. It might be a good idea to hack up the stdlib so that its ObjC interop support can be disabled independent of the compiler and runtime.</div><div><br class=""></div><div>-Joe</div><br class=""></body></html>