Compiler

RSS for tag

Discuss the various compiler and toolchain technologies used in development.

Posts under Compiler tag

118 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Swift Macros: Adding an enum case with an associated value produces incorrect results
Reproduced in Xcode versions 15.0.1 and 15.1 beta 3. If a Macro adds an enum case with an associated value, other cases are transformed at runtime. In the example below, the case foo is translated into the Macro-generated case bar(false). There is lots of other strange behavior, such as: Case declarations in the same file as the enum are not transformed. For example, in the code above, a function written in SimpleEnum.swift can produce SimpleEnum.foo, whereas functions in other files cannot (the declarations are transformed). Manually-defined cases with associated values are not transformed. For example, a manually-defined case foobar(Bool) can be declared and used normally everywhere. Additional enum cases without associated values get transformed to different cases. For example, if SimpleEnum has manual cases foo, foobar, and foobarfoo, and a Macro-generated bar(Bool), these transformations take place: foo -> bar(false) foobar -> bar(true) foobarfoo -> foo etc. Not all associated value types in the Macro-generated case are treated the same. String associated values seems to work properly. Int yields incrementing transformations (e.g. foo -> bar(0), foobar -> bar(1), foobarfoo -> bar(2)) Radar: FB13417290
3
3
886
Nov ’23
Problem with variadic C functions
I am the author of the open-source Dynace. This is an OO extension to C. It has been in production use for around 20 years. It has been used on DOS, all Windows, Linux, macOS/Intel, VMS, PLAN9, COSMIC, SUNOS, etc. all without a problem. However it does not run on Apple M1, M2 machines. I traced the problem to variadic function calls. I am creating a va_list in a ... function. I then pass the va_list to a second function. I wrote something to copy the the va_list (via va_copy) to see what I am getting. The first function works okay. But the second function does not. (I know you can't re-use a va_list.) I have spend a couple of days on this and can't find a problem with my code. I tried creating a simple example but it worked. Apparently the problem is situational. Anyway, I have no idea what is wrong or what to do next. I'd sure appreciate any help! Thanks!
2
0
601
Nov ’23
Does XCode Cloud not support Obj-c runtime flags?
When building/archiving a mixed Obj-C/Swift app from an XCode Cloud Workflow, it seems that the GCC_PREPROCESSOR_DEFINITIONS (Preprocessor Macros) are not used. We use them for environment switching based on scheme and we'd like to send a test build to Testflight through XCode Cloud for internal testing. If this is the case, is the only option to rewrite code to use Swift Active Compilation Conditions?
1
0
405
Nov ’23
Xcode 15.0.1 code not showing compiler errors in code | Keeps failing build without showing error.
I have been using workspace to incorporate the Firebase Auth functionality in my application. I am using Xcode 15.0.1 and Firebase 10.18.0. I have included the screenshot for that as well. In which you can see that I have typed fs and g on two separate lines and it should show me the error but it's now. Also I have commented out the import of Firebase so it should also display me the error that Auth.auth() is unidentified function. I have tried restarting my Xcode and mac as well.
0
0
416
Nov ’23
Why are only @objc marked methods visible in objective C
I was going through this apple documention and it states, "By default, the generated header contains interfaces for Swift declarations marked with the public or open modifier", however, In my Xcode project, the public methods are not visible in the objective C code, and only the methods that are marked with @objc are visible. Is there some problem in my code or Is this a bug?
1
0
403
Nov ’23
Load a library with LC_LOAD_DYLIB instead of LC_LOAD_WEAK_DYLIB
Hello, I have create a dynamic library with gcc: gcc -dynamiclib liblib1.c -o liblib1.dylib I have create a binary which needs this dynamic library: gcc -L./ -llib1 test.c -o test I have looked at mach-o commands in test binary. I have seen the library is loaded with LC_LOAD_WEAK_DYLIB. How can i load the library with LC_LOAD_DYLIB instead of LC_LOAD_WEAK_DYLIB ? And i have a second question: Is it possible to compile the binary with a static linking of the library ? I have tried with -static option, like i do on Linux but it does not work on macOS and i don't understand why... Thanks
1
0
730
Nov ’23
How to include <bits/stdc++.h> file using clang++ compiler?
Hi, I am a student and I wanted to include &lt;bits/stdc++.h&gt; file in my code so that it will help me avoid including many files in my program to save time during competitive programming, but while including above file in my program, it gives error "file not found", since clang++ do not have it present by default, so I want to add it manually. Please help me fix the issue. I already added bits folder at this location : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 following which I also created stdc++.h file but still error persists!!. I also made bits folder with stdc++.h file at this location too : /Library/Developer/CommandLineTools/usr/include/c++/v1 but again couldn't fix the error!! I also made respective changes in Homebrew folder (to fix it in g++ too, but again couldn't fix it!!)
6
2
5.1k
Nov ’23
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
12
0
11k
Nov ’23
Xcode 12.5 Multiple commands produce framework and ProcessXCFramework
Hi, I'm from the App Center SDKs team. After updating Xcode from 12.4 to 12.5 our team faced build issues similar to this: Multiple commands produce '/Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework': 1) Command: ProcessXCFramework /Users/user/appcenter-sdk-apple/AppCenter-SDK-Apple/XCFramework/AppCenter.xcframework /Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework ios simulator 2) Target 'AppCenter iOS Framework' has create directory command with output '/Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework' Repro steps: Build AppCenter iOS Framework target. Build AppCenter target which creates an xcframework for iOS, macOS, and tvOS platforms. Build AppCenter iOS Framework and/or AppCenter Analytics iOS Framework target. Build SasquatchPuppet target (it uses AppCenter iOS Framework and AppCenter Analytics Framework targets). After the issue happened only Product > Clean build folder can help. We've tried to automate cleaning the build artifacts (BUILD_DIR) etc, but it doesn't help. Also, we've tried to use separate Product Names for XCFramework and mere Frameworks, but it was not possible for us in the end because of the xcconfig variables visibility. Similar issue: https://developer.apple.com/forums/thread/679542
3
1
46k
Nov ’23
How to fully apply parallel computing on CPU and GPU of M1max
Project is based on python3.8 and 3.9, containing some C and C++ source How can I do parallel computing on CPU and GPU of M1max In deed, I buy Mac m1max for the strong GPU to do quantitative finance, for which the speed is extremely important. Unfortunately, cuda is not compatible with Mac. Show me how to do it, thx. Are Accelerate(for CPU) and Metal(for GPU) can speed up any source by building like this: Step 1: download source from github Step 2: create a file named "site.cfg"in this souce file, and add content: [accelerate] libraries=Metal, Acelerate, vecLib Step 3: Terminal: NPY_LAPACK_Order=accelerate python3 setup.py build Step 4: pip3 install . or python3 setup.py install ? (I am not sure which method to apply) 2、how is the compatibility of such method? I need speed up numpy, pandas and even a open souce project, such as https://github.com/microsoft/qlib 3、just show me the code 4、when compiling C++, C source, a lot of errors were reported, which gcc and g++ to choose? the default gcc installed by brew is 4.2.1, which cannot work. and I even tried to download gcc from the offical website of ARM, still cannot work. give me a hint. thx so much urgent
1
1
2.3k
Oct ’23
Command PhaseScriptExecution Failed
Hello All, I am stuck in this error for a week. I tried reinstalling Xcode 14.1, adding '-f' in frameworks.sh but neither worked. Below is the error. I would really appreciate if you can help. Also, build gets succeeded and also I can run the app on the simulator, but I cannot archive it. Error PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus\ Decision\ Aid/IntermediateBuildFilesPath/Lupus\ Decision\ Aid.build/Release-iphoneos/Lupus\ Decision\ Aid.build/Script-570BD887603D2E782013C015.sh (in target 'Lupus Decision Aid' from project 'Lupus Decision Aid') cd /Users/dhiralpanjwani/Downloads/iOS/Lupus\ Decision\ Aid\ copy /bin/sh -c /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus\\ Decision\\ Aid/IntermediateBuildFilesPath/Lupus\\ Decision\\ Aid.build/Release-iphoneos/Lupus\\ Decision\\ Aid.build/Script-570BD887603D2E782013C015.sh mkdir -p /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus Decision Aid/BuildProductsPath/Release-iphoneos/Lupus Decision Aid.app/Frameworks /Users/dhiralpanjwani/Downloads/iOS/Lupus Decision Aid copy/Pods/Target Support Files/Pods-Lupus Decision Aid/Pods-Lupus Decision Aid-frameworks.sh: line 43: source: unbound variable Command PhaseScriptExecution failed with a nonzero exit code
1
1
1.4k
Oct ’23
XCode 14.3.x and XCode 15 Beta Hangs On Compiling
We have a 7-year old codebase that uses a mix of frameworks including Rx and Firebase through Cocoapods. The compilation works fine up to XCode 14.2 but for some unknown reason the compilation just stuck / hang on XCode 14.3.x and XCode 15. There are several warnings in the codebase but the compiler does not output any error. Which is why we don't know what the exact issue(s) is/are. What's the change in XCode 14.3.x that could be causing this issue? If anyone has an idea on possible fix, willing to try it out.
2
0
1.3k
Oct ’23
Use the terminal to compile applications using xcode that is no longer supported on the desktop
You can still use some xcode that is no longer supported on the desktop through the terminal. For example, my mocOS is 14.0, I installed xcode14 and xcode15 in /Applications, but xcode14 is no longer supported on the desktop. /Applications/Xcode_14.0.app # not supported /Applications/Xcode_15.0.app Switch to xcode14 and use xcodebuild: export DEVELOPER_DIR=/Applications/Xcode_14.0.app xcodebuild -version # work well I want to know if there is any problem with this approach? What does the Xcode development team think of this approach? Is there any relevant documentation that I can know about?
1
0
352
Oct ’23
'assert.h' file not found
I'm trying to build C project with XCode 15.0, but always get error 'assert.h' file not found. I tried to clean and restart XCode, reinstall XCode and reboot, set different framework versions and project formats. I found all entries of stdarg.h with Finder and made sure, that all directories, containing stdarg.h, contain also assert.h, but stdarg.h includes are resolved, assert.h - not. How could this be ? Many thanks for any help. Ventura 13.6, M2, Command line tools version 2397
1
1
1.1k
Oct ’23
Documentation for MACOSX_DEPLOYMENT_TARGET?
Has MACOSX_DEPLOYMENT_TARGET been deprecated? I do not seem to find any proper documentation of it at apple.com. Background: I'm building C-based application(s) and libraries (both Intel and AS) that are distributed compiled/linked to our users. I would like to update my build machines from 10.15 (Intel) and 11 (AS), to macOS 12 (or even higher, if possible) but I would like to be sure that our users can run the executable and that they can link their code against our libraries (and our object code) also on older versions of macOS. Ideally I would like to continue to support users on macOS 10.15 on Intel and 11 on AS, but macOS 11 on Intel would also be acceptable. It seems MACOSX_DEPLOYMENT_TARGET (perhaps combined with SDKROOT) could allow this, but I have not been able to find anything except rumors, i.e. no proper documentation at any Apple site. Testing is not really an option since at least some problems would likely only occur at runtime (e.g. due to weak linking). I am using the command line tools and GNU make (no Xcode project or some such, also no App Store). Any pointers would be greatly appreciated!
3
0
1.5k
Oct ’23