Post not yet marked as solved
Whenever I try to compile any C++ program with march=native on a Macbook with a M1 chip, I get the following error when using clang:
clang: error: the clang compiler does not support '-march=native'
However, it used to work on an older Macbook with an Intel CPU. Does clang not support this architecture (yet)?
clang --version gives:
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.2.0
Post not yet marked as solved
Hi,
I am trying to use command line tools gcc on MacBook M1. It is throwing some strange errors, for example the printf function throws.
Thanks for any advice that you may be able to provide,
:)
Post not yet marked as solved
I have a swift project that operates on pixels (image generation) in parallel. Running the exact same code with the same settings (81M pixels) on my 2017 iMac and my M1Ultra (release builds, MacOS). The M1 Ultra takes nearly 2 min and the iMac takes 10.3 seconds. The main difference in profiler is calls to retain/release totaling 84 seconds on M1Ultra and 2 seconds on iMac i7. Like, how is this even possible? It makes this $4K Mac Studio a boat anchor as far as my need for it. Despite having 20 threads running vs 8, the MS is horrifically slow solely due to the retain/release molasses.
This is not a user app but a command line app. Instruments seems hopeless to tell me exactly what is even calling retain/release. I can see its ARM vs Intel code generation and otherwise the rest of the code seems equivalent.
If someone from Apple would comment I'd be willing to burn a support ticket (I used to work at DTS long ago). Otherwise I will post it to Medium to see if anyone can explain this.
This is the whole reason I spent so much on the MS, now it seems a waste of $.
I need to set the value of a variable according to a preprocessor rule, like in the example below.
var doSomething = false
#if targetEnvironment(macCatalyst)
doSomething = true
#endif
if doSomething {
print("Execute!")
}
If I build the code for an iOS simulator, Xcode will generate a "Will never be executed" alert at the print("Execute!") line.
This make sense because preprocessor rules are evaluated before compilation and therefore the code above, when the target is an iOS simulator, corresponds to:
var doSomething = false
if doSomething {
print("Execute!")
}
I just want to know if there is any advices for handling cases like that.
Ideally, I would like to avoid using the preprocessor condition for every statement, like so:
#if targetEnvironment(macCatalyst)
print("Execute!")
#endif
but rely on a variable like the original example.
I would also prefer to avoid completely disabling in Xcode the display of "Will never be executed" warnings for all source codes.
Is there a way to set the "doSomething" variable so that Xcode doesn't display the warning in a case like that?
Thank you
Post not yet marked as solved
I'm creating framework in Swift and going to support both Swift and Objective-C. I repeatedly used @objcMembers on class to expose public properties and methods. Today, I noticed that non-public aka internal properties were accessible from Objective-C. Is there a way to hide internal properties and methods while using @objcMembers ?
Post not yet marked as solved
I am using Xcode 13.1 and get the following Apple Mach-O Linker Error when building in Release mode only (project can be successfully built in Debug mode) :
ld: reference to symbol (which has not been assigned an address) __ZNSt3__113__vector_baseINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEED2Ev in '__ZNSt3__16vectorINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEED1Ev' from <my-path-placeholder>tmp.a(Tmp.o) for architecture arm64
This error only happens on newer versions of Xcode (13 and up).
Any ideas?
Apple will develop a Fortran compiler for the new Apple Silicon platform?
Post not yet marked as solved
I'm having issues with compiling and linking. Randomly, either the compiler or the linker fails with error reports similar to this:
Process: ld [39849]
Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
Identifier: ld
Version: ???
Code Type: X86-64 (Native)
Parent Process: clang [39847]
Responsible: Xcode [11293]
User ID: 501
Date/Time: 2022-03-08 20:49:34.2264 -0700
OS Version: macOS 12.2.1 (21D62)
Report Version: 12
Anonymous UUID: 65A32827-D6E1-71EE-C648-BD8683BC8BB0
Time Awake Since Boot: 10000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007d9738aab060
Exception Codes: 0x0000000000000001, 0x00007d9738aab060
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [39849]
VM Region Info: 0x7d9738aab060 is not in any region. Bytes after previous region: 138083053240417 Bytes before following region: 2198373486496
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
mapped file 1414c1000-141543000 [ 520K] r--/r-- SM=COW ...t_id=b04ff949
---> GAP OF 0x7f95d09bd000 BYTES
MALLOC_LARGE 7f9711f00000-7f9717f00000 [ 96.0M] rw-/rwx SM=PRV
...
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libLTO.dylib 0x112bcbf54 (anonymous namespace)::SCCPSolver::markUsersAsChanged(llvm::Value*) + 20
1 libLTO.dylib 0x112bc7d7e (anonymous namespace)::SCCPSolver::Solve() + 94
2 libLTO.dylib 0x112bc5eed llvm::runIPSCCP(llvm::Module&, llvm::DataLayout const&, std::__1::function<llvm::TargetLibraryInfo const& (llvm::Function&)>, llvm::function_ref<llvm::AnalysisResultsForFn (llvm::Function&)>) + 2749
3 libLTO.dylib 0x112ae1136 (anonymous namespace)::IPSCCPLegacyPass::runOnModule(llvm::Module&) + 86
4 libLTO.dylib 0x11246ab95 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 709
5 libLTO.dylib 0x1126f91f1 llvm::LTOCodeGenerator::optimize(bool, bool, bool, bool) + 945
6 libLTO.dylib 0x111ee7993 lto_codegen_optimize + 51
7 ld 0x10b5eac31 lto::Parser::codegen(lto::OptimizeOptions const&, ld::Internal&, LLVMOpaqueLTOCodeGenerator*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 301
8 ld 0x10b5eb71c lto::Parser::optimizeLTO(std::__1::vector<lto::File*, std::__1::allocator<lto::File*> >, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 536
9 ld 0x10b5eddfe lto::Parser::optimize(std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 1134
10 ld 0x10b5ee8bf lto::optimize(std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> > const&, ld::Internal&, lto::OptimizeOptions const&, ld::File::AtomHandler&, std::__1::vector<ld::Atom const*, std::__1::allocator<ld::Atom const*> >&, std::__1::vector<char const*, std::__1::allocator<char const*> >&) + 69
11 ld 0x10b611318 ld::tool::Resolver::linkTimeOptimize() + 666
12 ld 0x10b611bb4 ld::tool::Resolver::resolve() + 166
13 ld 0x10b598abd main + 307
14 dyld 0x111e2f4fe start + 462
I'm thinking this is either a problem with the RAM or my computer is overheating.
Thoughts?
Post not yet marked as solved
I am working with a big project event is take 40 minutes to generate dSYM file.
Is there any way I can replace the dsymutil with custom version.
Post not yet marked as solved
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.
Post not yet marked as solved
How can playground or any app exec an swift code or show an update live of view that we are make?
I want to know this because i want to build app that help you to build views without coding..so i want the same Features that used on swift playground and xcode that exec swift code and show update live of view.
Post not yet marked as solved
Need some help debugging an issue that only started after upgrading to Monterey. Our application is failing to start resulting in a segmentation fault. I am new to debugging such things on MacOS. Using lldb I get the following back trace. Tells me a little but I am unsure how to approach the issue. Looks like it may be related to loading symbols from a dynamic library? Oh, and yes, everything was rebuilt and all dependent libraries installed / upgraded with brew, etc.
Thanks,
Bob
(lldb) bt
* thread #1, stop reason = signal SIGSTOP
* frame #0: 0x0000000000000000
frame #1: 0x00007ff807e34bb2 libobjc.A.dylib`load_images + 1358
frame #2: 0x0000000115a0a41c dyld`dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*) + 170
frame #3: 0x0000000115a0fbfd dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 167
frame #4: 0x0000000115a0fbeb dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
frame #5: 0x0000000115a0fbeb dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
frame #6: 0x0000000115a0fcac dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 108
frame #7: 0x0000000115a2332e dyld`dyld4::APIs::runAllInitializersForMain() + 222
frame #8: 0x0000000115a01358 dyld`dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3438
frame #9: 0x0000000115a004b4 dyld`start + 388
Post not yet marked as solved
Hello,
When trying to open a project written in approximately August in xcode 13.2.1 version, I get the error 'module compiled with swift 5.3.2 cannot be imported by the swift 5.5.2 compiler'. As you can see in the attachment, I get 127 errors when I run it with the 5.3.2 toolchain. How can I upgrade an existing project to version 5.5.2?
Thank you in advance for your help
Post not yet marked as solved
TimeoutError: Timed out waiting for connection to DTServiceHub after 15.0 seconds.
I'm getting this error when trying to preview SwiftUI views. And I'm getting it for a brand new app with nothing else going on. I've tried the usual troubleshooting like Clean Build Folder.
Also having trouble getting the app to build on my Apple Watch. I'm wondering if this is a serious bug with Xcode 13.2.1 (13C100)
Post not yet marked as solved
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
Post not yet marked as solved
I am creating an app that uses firebase on Xcode. I installed the 64 bit version I read others recommended on the new M1 Macs and every time I open up my computer again, I get 15 errors of 'Redefinition of Firebase' in all files like the modulemap, object.h, dispatch.h, CFNetwork.h, AXFoundation.h as well as 'Could not build module 'CoreFoundation'
I am not sure what to do since I am new to the swift language and Xcode. I have not been using the workspace rather the project and it worked the first time I installed it. I also tried uninstalling and redoing the pod install, but to no avail.
I would like my code to work as I am just trying to make a way for others to sign in so I can build the rest of the app. Thanks!
Post not yet marked as solved
objdump seems to always print an error message, example:
malcolm@Malcolms-Air keeperfx % objdump --version
Apple LLVM version 13.0.0 (clang-1300.0.29.30)
Optimized build.
Default target: arm64-apple-darwin21.3.0
Host CPU: vortex
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
arm - ARM
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
armeb - ARM (big endian)
thumb - Thumb
thumbeb - Thumb (big endian)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
malcolm@Malcolms-Air keeperfx % clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
malcolm@Malcolms-Air keeperfx % clang -c src/actionpt.c
In file included from src/actionpt.c:19:
In file included from src/actionpt.h:22:
src/bflib_basics.h:153:15: warning: '__stdcall' calling convention is not supported for this target [-Wignored-attributes]
typedef void (__stdcall *TbNetworkCallbackFunc)(struct TbNetworkCallbackData *, void *);
^
1 warning generated.
malcolm@Malcolms-Air keeperfx % objdump -f actionpt.o
actionpt.o: file format mach-o arm64
/Library/Developer/CommandLineTools/usr/bin/objdump: error: 'actionpt.o': Invalid/Unsupported object file format
The warning message should have no impact on objdumps ability to produce a result.
I have been looking for objcopy as I need to rename some functions in a precompiled library. I installed the gnu binutils version (brew install binutils) .. this generates a file that the gnu binutils thinks is perfect. The Apple objdump throws up error messages.
Post not yet marked as solved
Yesterday I abandoned Catalina and Xcode 12.3 and installed Big Sur 11.2 (20D64) and Xcode 12.4 on my MacBook Pro 16" top config.
Now compiling my app is twice slower, when I select and work on a XIB file the fans begin to run fast and noisy and at any compile-launch I get 57 log messages like this
ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
The are many other smaller troubles but let's focus on these ones. What does it mean ScanAllPluginsInLibrary ? I have been searching on Google and found nothing explaining.
Post not yet marked as solved
Just updated to Monterey and when building openexr the following error occurred:
ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.tbd for architecture x86_64
My mac is a Intel CPU model.
Anyone knows what's going on?
Post not yet marked as solved
I'm a university student and this is my first time coding anything. I was doing pretty good but now, for some reason, my xcode will only run the first .c file i made within the project, even if i have a different one selected. My screen is shown in this screenshot to make it make more sense.
https://imgur.com/a/yjNi9QA
The "Hello world" code is in the first "main.c" file on the left, but whenever i try to run q1d or q2a, it only runs Hello World, not the actual files.
Please help!!!!