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

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
600
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
404
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
415
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
401
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
726
Nov ’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
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
351
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.4k
Oct ’23
Clang 15.0 make c++ code 5 times slower than Clang 14.3.1
Hi, I am running Mac Intel I7 post 2020 with Sonoma and clang 15.0 . The Clang 15.0 makes c++ code running 5 times slower than it was before upgrade from Ventura 13.6 and Clang 14.3.1 The other trouble is that Sonoma does not allow to revert to Clang 14.3.1 . I do not use Xcode only command line tools . here my options : g++ -std=c++17 -Ofast -march=native -funroll-loops -flto -DNDEBUG -o a prog.cpp So what happened to C++ ?
0
0
678
Sep ’23
Xcode 14.3/15.0 Always Regenerates Objective-C Header from Swift Modules
Hi all, Our Objective-C project has quite a few Swift submodule that are linked with static Mach-O. The submodules are built and used in Objective-C files (.m, .mm) using the syntax #import <MyModule/MyModule-Swift.h> Since Xcode 14.3 and the early versions of Xcode 15.0, whenever I make any code changes in the .m .mm files (even just a space), all files using the Swift submodules are rebuilt. During my checks, I noticed the generated header of the submodules (MyModule-Swift.h) is regenerated even when its content hasn't changed. The modification time of the header file leads to the rebuilding of all Objective-C files. Of course, our project has a clean build when importing *-Swift.h in the .pch file, sometimes errors are thrown due to header changes during the build process. This behavior was not present in Xcode 14.2. More info I've tried configuring some flags in the Build settings, but they didn't work. Does anyone have any solutions to suggest for fixing this issue and saving our project ? :( Thanks!
1
0
449
Oct ’23
Document for Apple Clang Assembler
Please tell me where I can find the documents for Apple Clang ARM assembler? After I compiled my C source code to ARM assembly code using Apple Clang, it of course generated a lot of ARM assembly code (GNU syntax), but for some of them I can't find related documents, for example the .build_version directive. The generated ARM assembly code is here: .section __TEXT,__text,regular,pure_instructions .build_version macos, 13, 0 sdk_version 13, 3 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #64 str w8, [sp, #16] ; 4-byte Folded Spill stur wzr, [x29, #-4] ; implicit-def: $x8 ... add sp, sp, #64 ret .cfi_endproc ; -- End function .section __TEXT,__cstring,cstring_literals l_.str: ; @.str .asciz "a + b = %d\r\n" .subsections_via_symbols
1
0
691
Sep ’23
Problem with C++ header using whatever IDE or editor
I’m completely a newbie in the coding world. Been learning C++ for some days. I actually bought my MBA M1 to learn coding. But problems seem to appear whenever I tried to code #include . I use the latest Codelite as my IDE and when I hover towards the red arrow it says the following- error: no member named 'nullptr_t' in the global namespace I have tried this investigation provided by Eskimo - https://developer.apple.com/forums/thread/734833 But again the same errors keep occurring. As a complete newbie, I don’t know much things about these so any help would be amazing for me…. FYI I use the latest clang version as my command line tool and SIP is enabled. I tried restarting my Mac and tried multiple IDEs and code editors like vscode and nano etc. and macOS default terminal, but the the error kept the the same. Also running Ventura 13.3.1 …… Please provide me simply explained instructions to solve this annoying problem…..
17
1
1.7k
Sep ’23
ARM64 bit file with C files Xcode compile
Hi All, Instead of using embedded asm ( __asm), how could I write a arm64.s file and integrate to a command line test project with c files ? #include <stdio.h> extern int myadd(int a, int b); int main(int argc, const char * argv[]) { // insert code here... printf("Hello, World!\n"); int r = myadd( 10 , 4); return 0; } And .s file .global myadd .p2align 2 .type myadd,%function myadd: // Function "myadd" entry point. .fnstart add r0, r0, r1 // Function arguments are in R0 and R1. Add together // and put the result in R0. bx lr // Return by branching to the address in the link // register. .fnend Error -- /Users/prokashsinha/Arm/ArmAndC/asmfunction.s:9:1: error: unknown directive .type myadd,%function ^ /Users/prokashsinha/Arm/ArmAndC/asmfunction.s:12:1: error: unknown directive .fnstart ^ /Users/prokashsinha/Arm/ArmAndC/asmfunction.s:13:5: error: invalid operand for instruction add r0, r0, r1 ^ /Users/prokashsinha/Arm/ArmAndC/asmfunction.s:15:1: error: unrecognized instruction mnemonic, did you mean: b, bcax, bl, br, sb, tbx? bx lr ^ /Users/prokashsinha/Arm/ArmAndC/asmfunction.s:17:1: error: unknown directive .fnend ^
1
0
487
Aug ’23
Xcode 15 beta 6: is xrOS no longer considered as iOS?
In Xcode 15 beta 6, I found that when building visionOS apps, #if os(iOS) is no longer considered part of the project. This behavior is different from beta 1 to beta 5. Is this intentional? This change has caused third-party dependencies that use #if os(iOS) and have not yet explicitly supported visionOS to fail to compile. Is there a way to switch back to the old behavior? After all, requiring all third-party dependencies to explicitly support visionOS is quite difficult.
3
0
1.1k
Aug ’23