Compiler

RSS for tag

Discuss the various compiler and toolchain technologies used in development.

Posts under Compiler tag

98 results found
Sort by:
Post not yet marked as solved
28 Views

XCode 13 framework references

Hello, I've noticed, that since Xcode 13 my framework classes references are not working. Even though the project compiles and works, the imported framework and it's classes references could not be found, also autocomplete for the methods is not working. The same behavior is for XCFramework and for the "Fat" framework. Any ideas on how to fix it, should the framework be built differently?
Asked
by VIKTAS.
Last updated
.
Post not yet marked as solved
33 Views

Compile of c file with Xcode 13 take too long

Hi, We have a large workspace with multiple targets with a mix of Objective C and Swift code. We have been doing our best to update the frameworks used and use module maps where possible. However with Xcode 13 our build times for one target have ****-out to a very large time. I was able to trace it to one file in a framework: However in another target it is significantly less: These two targets are not that different in terms of frameworks linked and files etc. Have not been able to identify exactly what might be causing the differences here. Note also if we compile the framework on it's own then the compile time is at the lower value. This file is large ~ 8MB and contains some large switch statements. it is not including any objective c or swift just c headers with an enum. Any ideas on what to look for here would be most welcome. Thants
Asked Last updated
.
Post not yet marked as solved
76 Views

CF_RETURNS_RETAINED on function pointer return values?

https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/working_with_core_foundation_types If we define a C function that returns a CFType, Swift can (sometimes) bridge the memory management semantics. If Swift cannot bridge the memory management semantics, we can end up with an Unmanaged type: CFStringRef StringByAddingTwoStrings(CFStringRef s1, CFStringRef s2); bridges to: public func StringByAddingTwoStrings(_ s1: CFString!, _ s2: CFString!) -> Unmanaged<CFString>! We can improve the bridging with the CF_RETURNS_RETAINED annotation: CFStringRef StringByAddingTwoStrings(CFStringRef s1, CFStringRef s2) CF_RETURNS_RETAINED; now bridges to: public func StringByAddingTwoStrings(_ s1: CFString!, _ s2: CFString!) -> CFString! What does not seem to be documented is how to improve bridging when function pointer return values should be annotated. For example: typedef CFStringRef (*StringByAddingTwoStrings)(CFStringRef, CFStringRef); bridges to: public typealias StringByAddingTwoStrings = @convention(c) (CFString?, CFString?) -> Unmanaged<CFString>? Is there any way to annotate the function pointer to properly communicate the memory management semantics? Adding the CF_RETURNS_RETAINED to the function pointer does not seem to help.
Asked Last updated
.
Post not yet marked as solved
309 Views

cannot find type in scope xcode 13

I had many swift compiler errors of this type : "Cannot find type 'className' in scope" after passing from Xcode 12.5 to Xcode 13. And the error is always referred to Objective-C classes. The project is for an iOS 11 app for iPad. The bridging-header is correctly set and the project with the same build-settings has never given this error before Xcode 13. I'll try to clean the derived data folder without success. the strange thing is project compile successfully and I can run on simulator as well but after few second from a successful compilation on any swift files that use objective-c class is fired the swift compiler error. Any idea? thanks
Asked
by mrcdev.
Last updated
.
Post not yet marked as solved
100 Views

Urgent: distributing release build by command line

Hello, I finished my SwiftUI application. I uploaded the images and the promotional text. I have to generate and upload the release file. I never did it before. This is my first iOS app. I cannot add my developer account to XCode, because it does not recognize the password maybe, an error is issued from the server. This is a common issue. It happens to me and other developers with apparently no solution(?). I tried with Catilina XCode 12.4 and BigSur XCode 13. I need to release my app for the review process as soon as possible. I think it is possible also with command line but I do not know. I found this page: How do I archive and export my app for distribution I wonder whether the account/password issue would be fixed or not, even with the command line instructions. My app is ready but I am stuck with this strange issue. How to solve this problem with XCode or command line? Thanks
Asked
by am74.
Last updated
.
Post not yet marked as solved
1.9k Views

Xcode 13 beta | Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug

I have a project which has iOS 10.0 deployment target in which I import Network framework in some class and conditionally using it depending on the host app’s iOS version.   With Xcode 13 beta 4(13A5201i), I am able to compile and run the project successfully while debugging on iPhone device but it gives below error. This was working fine with Xcode 12.5.1 /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:19: 'NWConnection' is only available in iOS 12.0 or newer /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:1: Add @available attribute to enclosing extension /Application/NWBrowserManager.swift:10:8: Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
Asked Last updated
.
Post marked as solved
72 Views

export log for Build With Timing Summary

When I use "Build With Timing Summary" in Xcode I can see elapsed times in the build log. When I export the log (or copy/paste a section), the times aren't included. Is there a way to include them so I can analyze the results?
Asked
by mjmsmith.
Last updated
.
Post not yet marked as solved
9.8k Views

Xcode 12 different definitions in different modules build error

In the Xcode 12 betas I'm seeing an issue with importing Swift modules with @objc annotations. Given two Swift modules which expose classes of the same name: // FrameworkOne @objc public class Thing: NSObject { &#9;&#9;public override init() {} &#9;&#9;@objc &#9;&#9;public func doSomething() {} } // FrameworkTwo @objc public class Thing: NSObject { &#9;&#9;public override init() {} &#9;&#9;@objc &#9;&#9;public func doSomethingElse() {} } And if I have imported both of the frameworks into an ObjC file and interact with the classes in either of them: #import <Foundation/Foundation.h> @import FrameworkOneObjC; @import FrameworkTwoObjC; @interface Example : NSObject @end @implementation Example (void) example { &#9;&#9;Thing *thing = [[Thing alloc] init]; } @end Then I'm seeing this build error: 'Thing' has different definitions in different modules; first difference is definition in module 'FrameworkOne.Swift' found method name 'doSomething' But in 'FrameworkTwo.Swift' found method name 'doSomethingElse' Is this expected behaviour? If so, is there any way to opt out? In my case FrameworkOne & FrameworkTwo are external dependencies, and I'm unable to change the names of the classes.
Asked
by mike-velu.
Last updated
.
Post marked as solved
353 Views

Archive build w/ SwiftUI dependency fails in Xcode 13

My app uses a 3rd party lib (AMPopTip) which conditionally includes some SwiftUI code. The app builds and runs fine in Xcode 13, but the archive build fails with errors such as: Cannot find type 'View' in scope Cannot find 'UIHostingController' in scope These errors only show up for armv7 architecture. At first, I thought I should not be building for armv7, but in fact the same archive build works fine in Xcode 12.5.
Asked
by sharp11.
Last updated
.
Post not yet marked as solved
192 Views

Xcode 13. Argument list too long while using SPM(Swift Package Manager)

I am using spm in my project. When I build via Xcode 13, I get error "Argument list too long". After some research I found multiple repeat of flags -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks. Have you any idea how to fix this? full log: CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'TryToReproduce' from project 'MyProject') cd /Users/renat/Sources/MyProject export DEVELOPER_DIR\=/Applications/Xcode-13.0.0.app/Contents/Developer export SDKROOT\=/Applications/Xcode-13.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk /Applications/Xcode-13.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc ... -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxCocoa -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxRelay -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxSwift -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/TensorFlowLiteSwift -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxCocoa -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxRelay -I /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/RxSwift -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator/PackageFrameworks -F /Users/renat/DerrivedData/Build/Products/Debug-iphonesimulator -F /Users/renat/Sources/release-ios/ios/Pods/TensorFlowLiteC/Frameworks -F /Users/renat/Sources/release-ios/ios/Pods/YandexMapKit -F /Users/renat/Sources/release-ios/ios/Pods/YandexRuntime -F /Users/renat/Sources/release-ios/ios/lib -F /Users/renat/Sources/release-ios/iOS ... I already created an empty project and checked adding packages to an empty project, the problem is reproducible
Asked Last updated
.
Post not yet marked as solved
202 Views

dyld library crash with dlopen RTLD_LAZY | RTLD_LOCAL

Hi, I'm trying to load libgcrypt library (brew install libgcrypt) with dlopen/dlsym but getting a crash when I use RTLD_LAZY | RTLD_LOCAL mode with dlopen. Any other combination works, for example: RTLD_LAZY | RTLD_GLOBAL RTLD_NOW | RTLD_GLOBAL RTLD_NOW | RTLD_LOCAL I have attached a tiny sample program to reproduce the issue: $ gcc -o dyld_test dyld_test.c $ ./dyld_test gcry_check_version dyld: lazy symbol binding failed: Symbol not found: __gcry_check_version Referenced from: /usr/local/lib/libgcrypt.dylib Expected in: flat namespace dyld: Symbol not found: __gcry_check_version Referenced from: /usr/local/lib/libgcrypt.dylib Expected in: flat namespace I have tried to build dyld myself but failed to succeed. https://opensource.apple.com/source/dyld/dyld-852.2/ Any help would be really appreciated. Thank you, Aleix dyld_test.c
Asked Last updated
.
Post not yet marked as solved
545 Views

Issue with the GLSL Compiler on M1 OpenGL driver?

Hello, I am doing a cross-platform project that uses C++ and OpenGL ( I know I should be using MoltenVK or Metal, but OpenGL is nice and simple for starting out and is cross platform). I am also doing most of my development on a M1 Macbook Pro, which supports up to OpenGL 4.1. The M1 also only supports up to 16 active fragment shader samplers ( maximum number of supported image units) I am currently working on a batch rendering system that uses an array of textures thats uploaded to the GPU and the shader can switch based off of the index into a sampler array. Heres the shader that I am using ( the vertex and fragment shaders are combined, but the program parses them separately) : #type vertex #version 410 core layout(location = 0) in vec3 a_Position; layout(location = 1) in vec4 a_Color; layout(location = 2) in vec2 a_TexCoord; layout(location = 3) in float a_TexIndex; layout(location = 4) in float a_TilingFactor; uniform mat4 u_ViewProjection; out vec4 v_Color; out vec2 v_TexCoord; out float v_TexIndex; out float v_TilingFactor; void main() { v_Color = a_Color; v_TexCoord = a_TexCoord; v_TexIndex = a_TexIndex; v_TilingFactor = a_TilingFactor; gl_Position = u_ViewProjection * vec4(a_Position, 1.0); } #type fragment #version 410 core layout(location = 0) out vec4 color; in vec4 v_Color; in vec2 v_TexCoord; in float v_TexIndex; in float v_TilingFactor; uniform sampler2D u_Textures[16]; void main() { color = texture(u_Textures[int(v_TexIndex)], v_TexCoord * v_TilingFactor) * v_Color; } However, when the program runs I get this message: UNSUPPORTED (log once): POSSIBLE ISSUE: unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable I double and triple checked my code and im binding everything correctly to the shader (if im not feel free to point it out :), and the only thing I found on the web relating to this error was saying that it was an error within the GLSL compiler on the new M1s. Is this true? Or is it a code issue? Thanks side note: I am using EMACS to run Cmake and do C++ development, so if you try and test my project on Xcode and it doesnt include the shaders its most likely a Cmake/Xcode copy issue.
Asked
by trzroy.
Last updated
.
Post not yet marked as solved
194 Views

Operating System availability checks have incorrect behavior on iOSAppOnMac: #available(iOS 15, *) is always true, ProcessInfo().isOperatingSystemAtLeast works as expected

Apple Silicon computers support running iOS apps. The property iOSAppOnMac of ProcessInfo is true for these apps. Checks like #available(iOS 15, *) are used to only access new APIs on operating systems that support them. For iOSAppOnMac apps on Big Sur #available(iOS 15, *) evaluates to true despite ProcessInfo().isOperatingSystemAtLeast(.init(majorVersion: 15, minorVersion: 0, patchVersion: 0) evaluating to false. So without an additional check code like the example below crashes with an unrecognized selector exception. Steps to reproduce: Use an API only available for iOS 15 e.g. UITabBar.scrollEdgeAppearance Use #available(iOS 15, *) as condition Code compiles, but crashes at runtime due to unrecognized selector on an iOSAppOnMac Big Sur device Workaround: Add ProcessInfo().isOperatingSystemAtLeast(.init(majorVersion: 15, minorVersion: 0, patchVersion: 0)) as condition. Code sample from our app: if #available(iOS 15, *), ProcessInfo().isOperatingSystemAtLeast(.init(majorVersion: 15, minorVersion: 0, patchVersion: 0)) { let tabBarScrollEdgeAppearance = tabBar.standardAppearance // ... tabBar.scrollEdgeAppearance = tabBarScrollEdgeAppearance } Expectation: I expect #available(iOS 15, *) to evaluate to false on iOSAppOnMac processes running Big Sur. Or in general, if the operating system major version returned by ProcessInfo is x then #available(iOS x+1, *) should be false. Actual behavior: #available(iOS x, *) always evaluates to true on iOSAppOnMac processes potentially causing crashing by using unavailable APIs.
Asked
by kai_.
Last updated
.
Post not yet marked as solved
296 Views

Possible compiler/dyld bug

Has anyone seen a problem like this? I have a C program #include stdio.h char map[0x7fffffff]; int main(void){ printf("!\n"); } When I compile this from the command line and run it, I get the following message: dyld: Library not loaded: /usr/lib/libSystem.B.dylib   Referenced from: /Users/td/./a.out   Reason: image not found Abort trap: 6 If I reduce the size of the array enough (say to 100), or if I malloc the storage, the error goes away and the program runs correctly. I'm using Xcode 12.4, macOS 11.2.3 on a Mac mini (M1, 2020, 16GB). cc --version says it's Apple clang version 12.0.0 (clang-1200.0.32.29) Target: arm64-apple-darwin20.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin C++ behaves the same.
Asked
by TomDuff.
Last updated
.
Post not yet marked as solved
100 Views

How to resolve the error "Cannot find protocol statement for FBSDK Session Provisioning"?

Hi guys, how are you? I'm trying to run my app in IOS emulator with Xcode, but when I run the build, the app returns the following error: "Cannot find protocol statement for FBSDK Session Provisioning". How can I resolve this error?
Asked Last updated
.