bindbc-sdl
bindbc-sdl copied to clipboard
No library assertion failure
On macOS Big Sur M1 comes up with not supported - no library.
'''d SDLSupport ret = loadSDL(); if(ret != sdlSupport) { // Handle error. For most use cases, this is enough. The error handling API in // bindbc-loader can be used for error messages. If necessary, it's possible // to determine the primary cause programmtically:
if(ret == SDLSupport.noLibrary) {
// SDL shared library failed to load
assert(0, "no library");
}
'''
So install it?
Of course, I've installed it. I used Home Brew, that's worked before.
And that's the kind of information you need to include when you report an issue. I can't make assumptions about what you have or haven't done. Please always include as much relevant information as you can think of.
So the next thing to do is to see where homebrew installed it. The default paths the loader tries to load from are listed here:
https://github.com/BindBC/bindbc-sdl/blob/master/source/bindbc/sdl/dynload.d#L43
Please check and see if SDL is installed in one of those locations, or somewhere else.
It may also help if you print the error messages instead of just asserting. Often, the system errors are no more than "failed to load library", but it's worth a try.
Yeah, I think it is to do with not finding the library. Thanks for your help.
Yes. that's what the error means. So I need to figure out why. If homebrew has changed where it installs SDL on Big Sur, then I'll need to add that new path to the list of default search paths. And I need your help to determine if that's the case. Were you able to find where it is installed?
It's actually my brothers' computer. It works on my Big Sur computer like normal. He's visiting at the moment, I don't know when he leaves. Hopefully I can have another shot at it.
The following is the only place I found it on his computer. That's part of Home Brew (eg. cellar). /usr/local/Cellar/sdl2/2.0.10/lib
[edit]
Maybe it's to do with him starting on Big Sur. I upgraded to Big Sur from a lower version.
If SDL isn't anywhere else on the system, then maybe the install failed? I would try to run homebrew install
again to see what comes up. And if that turns up nothing, then homebrew remove
followed by another install. If you see no errors doing any of that, then either SDL is being installed somewhere and you missed it, or there may be an issue with homebrew.
Home brew does treat Arm64 different than Intel installations of Big Sur. Neither say about where they install to ('brew info').
So please do a search for "SDL2.framework" and/or "libSDL2.dylib".
Nothing, I don't think mac searches in a lot of the non user files.
Then have a look in "/System/Library/Frameworks/" or "/usr/local/lib". I'm not a regular Mac user, and I have only cursory knowledge about homebrew and common directory trees. Maybe find out who maintains the SDL2 homebrew, or ask in a homebrew-related forum somewhere, or perhaps even in the SDL forums, if anyone knows where it gets installed.
Found these files in /opt/homebrew/lib libSDL2-2.0.0.dylib libSDL2.a libSDL2.dylib
[edit]
He hasn't got XCode installed.
He hasn't got XCode installed.
Well that may be the problem then.
At any rate, I found this:
https://stackoverflow.com/questions/28016258/using-homebrew-installed-sdl2-with-xcode
It seems the normal install path via homebrew is /usr/local/lib
. And brew search sdl2
should tell you where it's actually installed.
Sorry, actually he has got xcode installed.
[edit]
brew search just shows possible libs and whether they're installed or not. Not where they're installed.
Okay then. If there's nothing in /usr/local/lib
, I don't know if the /opt/homebrew/lib path is the install location or a cache.
See if there's a /opt/homebrew/bin/sdl2-config
and run that with the --libs
switch.
Okay. Solved it.
https://docs.brew.sh/Installation
This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon and /home/linuxbrew/.linuxbrew for Linux)
So I'll need to add the '/opt/homebrew/lib/' path to the default list. For now, as a workaround, you can do this:
loadSDL("/opt/homebrew/lib/libSDL2.dylib");
I'll push an update soonish.
I still get the same - no library error.
Then try passing loadSDL("/opt/homebrew/lib/libSDL2-2.0.0.dylib")
. And please print out the error messages if this fails.
It still fails.
core.exception.AssertError@../JecsdlLib/source/jecsdl/setup.d(32): no library
??:? _d_assert_msg [0x1049db2f4] ../IniLib/source/dini/dini.d:546 bool jecsdl.setup.bindbcSetup() [0x1049a6d6f] ../IniLib/source/dini/dini.d:546 bool jecsdl.setup.jecsdlsetup(immutable(char)[], int, int, bindbc.sdl.bind.sdlvideo.SDL_WindowFlags).init() [0x1049a6ffe] ../IniLib/source/dini/dini.d:546 int jecsdl.setup.jecsdlsetup(immutable(char)[], int, int, bindbc.sdl.bind.sdlvideo.SDL_WindowFlags) [0x1049a6fbe] ../IniLib/source/dini/dini.d:546 int type_hear_and_see.init(immutable(char)[][]) [0x1049abc29] source/main.d:116 _Dmain [0x104905cca] Program exited with code 1
I meant the error messages from the bindbc loader:
https://github.com/BindBC/bindbc-loader#error-handling
That will tell us what the system reported. It will probably be useless, but still worth a try.
I can't get the error messages to work.
Error: undefined identifier logError
That's because it's not a real function. The comment in the example says, "A hypothetical logging function". Try this:
import std.stdio, std.string;
writefln("%s: %s", fromStringz(info.error), fromStringz(info.message));
: dlopen(, 2): no suitable image found. Did find: /usr/lib/: not a file /usr/lib: not a file
And that was from calling load with the "opt/homebrew/lib" path? What prints when you call loadSDL()
with no arguments?
Hmm. Actually, I wonder what that bit about "/usr/lib" means. Can you see any SDL libraries in "/usr/lib"?
I see other libraries in "/usr/lib", but not SDL libraries.
It found the one I have in my test programs folder, but says not suitable.
libSDL2.dylib: dlopen(libSDL2.dylib, 2): no suitable image found. Did find: libSDL2.dylib: mach-o, but wrong /usr/local/lib/libSDL2.dylib: dlopen(/usr/local/lib/libSDL2.dylib, 2): image not found /usr/local/lib/libSDL2/libSDL2.ddlopen(/usr/local/lib/libSDL2/libSDL2.dylib, 2): image not found: dlopen(/usr/local/lib/libSDL2/libSDL2.dylib, 2): image not found ../Frameworks/SDL2.framework/SDLdlopen(../Frameworks/SDL2.framework/SDL2, 2): image not found: dlopen(../Frameworks/SDL2.framework/SDL2, 2): image not found /Library/Frameworks/SDL2.framewodlopen(/Library/Frameworks/SDL2.framework/SDL2, 2): image not found: dlopen(/Library/Frameworks/SDL2.framework/SDL2, 2): image not found /System/Library/Frameworks/SDL2.dlopen(/System/Library/Frameworks/SDL2.framework/SDL2, 2): image not found: dlopen(/System/Library/Frameworks/SDL2.framework/SDL2, 2): image not found /opt/local/lib/libSDL2.dylib: dlopen(/opt/local/lib/libSDL2.dylib, 2): image not found
I don't know how I had the previous one with missing stuff, this is what I get with "/opt/homebrew/lib/libSDL2-2.0.0.dylib": /opt/homebrew/lib/libSDL2-2.0.0.dlopen(/opt/homebrew/lib/libSDL2-2.0.0.dylib, 2): no suitable image found. Did find: /opt/hom: dlopen(/opt/homebrew/lib/libSDL2-2.0.0.dylib, 2): no suitable image found. Did find: /opt/hom
Okay. I don't know what else to do for now. I'll put this on my todo list and look into it more when I can.
Ok. Thanks any way.
One thing to note: the error message with the /opt path is different. Notice that the other errors say, "image not found", but for the /opt path it says, "No suitable image found". That part that says "did find" is being cut off, but that's something to look into.