Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find entry point named "objc_msgSend_stret" in shared library '/usr/lib/libobjc.A.dylib For Apple Silicon Based Macs #477

Open
scruffykat opened this issue Jan 11, 2023 · 8 comments

Comments

@scruffykat
Copy link

When running on macOS (2021 M1 Pro) an exception error is raised, with the details: "Unable to find entry point named "objc_msgSend_stret" in shared library '/usr/lib/libobjc.A.dylib"

Tested it on my old PC (Windows) with no issues so is Mac related.

@Eeveelution
Copy link

what macOS version are you running?

@scruffykat
Copy link
Author

scruffykat commented Jan 11, 2023

MacOS Ventura 13.1

@scruffykat
Copy link
Author

scruffykat commented Jan 11, 2023

I checked my usr/lib/ folder and I cannot seem to find libobjc.A.dylib.

That is likely the issue but I have no idea how to manually get the file to put it there, or if you even need that file there in new versions of MacOS

@scruffykat
Copy link
Author

Any updates on how to fix this?

@mellinoe
Copy link
Collaborator

I believe the fix here should be the same as what was done in this commit). The short answer is that objc_msgSend_stret just shouldn't be used in this codepath on M1 processors. The longer answer is that the code already has some notion of whether the stret function variants should be used, but it's not handled very consistently (see this function and the places it is used), and it doesn't take processor arch into account (thus the TODO marker there...).

If anyone with an M1 processor is able to test the quick fix (e.g. the same thing that @frenzibyte did in the commit above), I'd be happy to merge it in.

@mellinoe
Copy link
Collaborator

Also, it would help to know what stack trace you see when you get this exception. Is this still a problem in the latest version of the code?

@lkj01010
Copy link

That not fixed. stack is

Unhandled exception. System.EntryPointNotFoundException: Unable to find an entry point named 'objc_msgSend_stret' in shared library '/usr/lib/libobjc.A.dylib'.
at Veldrid.MetalBindings.ObjectiveCRuntime.objc_msgSend_stret(Void* retPtr, IntPtr receiver, Selector selector)
at Veldrid.MetalBindings.ObjectiveCRuntime.objc_msgSend_stret[T](IntPtr receiver, Selector selector)
at Veldrid.MetalBindings.NSView.get_frame()
at Veldrid.MTL.MTLSwapchain..ctor(MTLGraphicsDevice gd, SwapchainDescription& description)
at Veldrid.MTL.MTLGraphicsDevice..ctor(GraphicsDeviceOptions options, Nullable`1 swapchainDesc)
at Veldrid.GraphicsDevice.CreateMetal(GraphicsDeviceOptions options, SwapchainDescription swapchainDescription)
at Veldrid.StartupUtilities.VeldridStartup.CreateMetalGraphicsDevice(GraphicsDeviceOptions options, Sdl2Window window, Boolean colorSrgb)
at Veldrid.StartupUtilities.VeldridStartup.CreateMetalGraphicsDevice(GraphicsDeviceOptions options, Sdl2Window window)
at Veldrid.StartupUtilities.VeldridStartup.CreateGraphicsDevice(Sdl2Window window, GraphicsDeviceOptions options, GraphicsBackend preferredBackend)
at Veldrid.StartupUtilities.VeldridStartup.CreateWindowAndGraphicsDevice(WindowCreateInfo windowCI, GraphicsDeviceOptions deviceOptions, GraphicsBackend preferredBackend, Sdl2Window& window, GraphicsDevice& gd)
at Veldrid.StartupUtilities.VeldridStartup.CreateWindowAndGraphicsDevice(WindowCreateInfo windowCI, GraphicsDeviceOptions deviceOptions, Sdl2Window& window, GraphicsDevice& gd)
at ImGuiNET.Program.Main(String[] args) in /Users/Midstream/Documents/Dev/C#/Other/ImGui.NET/src/ImGui.NET.SampleProgram/Program.cs:line 39

@frenzibyte
Copy link
Contributor

@lkj01010 Are you sure you're running latest version of Veldrid? This path is impossible to reach for M1/M2-based machines:

public CGRect frame
{
get
{
return RuntimeInformation.ProcessArchitecture == Architecture.Arm64
? CGRect_objc_msgSend(NativePtr, "frame")
: objc_msgSend_stret<CGRect>(NativePtr, "frame");
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants