-
Notifications
You must be signed in to change notification settings - Fork 266
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
Veldrid.StartupUtilities / Sdl2 do not add sdl2 binary #24
Comments
It turns out that, for some reason, the osx-x64 binaries are not used if you run the program through nuget packages (e.g. if you just use I think this is a bug in the .NET Core SDK, because on Windows, the win-x64 binaries ARE used, and the situation should be exactly the same. A couple of workarounds:
The first one is probably easier since it should just be a global install and will work with all programs you build. I am going to try to figure out why the runtime isn't automatically locating the osx-x64 binary but IS finding the win-x64 binary. |
I copied .dylib into my bin folder and it works for now. Thank you for the other 2 workarounds. I did not know about the publish functionality. |
Glad to help. I will update the thread when I understand more about why it is not working as-is. |
It turns out this was actually a bug in my NativeLibraryLoader project. It wasn't able to locate libsdl2.dylib in the nuget package if you're running on macOS 10.13 (High Sierra). The new 1.0.5 version of that package should fix this issue. If you manually add this to your project, it will upgrade that package and everything should work:
The next patch for Veldrid will also update the dependency to 1.0.5. Just to be sure: you are running on macOS 10.13, correct? |
Yes. 10.13.2. I added the reference and it works without the binary. Best, |
Hi, is this fixed in 4.4.0?
When I call:
I don't get any error when I run TexturedCube sample or NeoDemo, though, not sure what I'm doing different. |
Could you give more info about which versions of the packages you are referencing, which runtime you are using, and which OS (and version) you are on? |
OS: macOS 10.13.2 (17C88) Veldrid packages:
Runtime: Mono JIT compiler version 5.12.0.309 (2018-02/39d89a335c8 Thu Sep 27 06:54:53 EDT 2018) |
I'll have to double check what mono does with binaries in nuget packages. It's possible that it is like .NET Framework in that you need to target a specific platform (e.g. x86 or x64) for the correct binary to be copied to your output directory. Could you try building for x64 specifically and see if that helps? |
Same results (tried both x64 and x86, both debug and release). |
What are you using to generate the project and build it with? With Visual Studio for Mac, I'm always getting an old-style project file, which doesn't support the new NuGet package convention for native binaries. In one of those kinds of projects, you can add something like this to the project:
I'm not sure how you are supposed to be able to target mono using the new .NET SDK, although I managed to get it working with some hacks. It only wanted to deploy the native binary if I explicitly built for osx-x64: |
I'm using the new-style project file. |
Hi @mellinoe, are you still looking at this? For now I've worked around it by copying the file directly to my bin folder. The path from which I copied the file is: Also seeing that in NeoDemo the path is defined differently: Which looks a little suspicious as well? |
@tzachshabtay I will try to improve the situation in the next release, but I'm not sure I will be able to get the experience as good as it is with .NET Core. I highly recommend targeting .NET Core if you are able -- there are many benefits aside from this one. |
@tzachshabtay And as for the confusion regarding file paths:
That's just an MSBuild variable that stores the full path to the directory containing the current script. |
@mellinoe I hope to target both .net core and mono eventually. Targeting just .net core is just not an option, though, as it doesn't support Windows 7 (and Android & IOS as well), also Mono supports more linux distros from what I can gather. Not sure I understand your explanation regarding the file paths. |
That's true regarding Linux and Android/iOS, but .NET Core does support Windows 7.
Yes, that's the main problem here for mono. In .NET Core, no script is needed because it pulls them automatically out of the NuGet package. For mono, I need to add something like this, using NuGet's "old-style" build hooks. |
Ah, thanks, not sure why I was under the impression that it doesn't support windows 7.
Interesting, how does it work exactly? Any binary file in the package get copied? Or do you mark to be copied in the nuspec or something? |
It's convention-based. You put the binaries under a specific folder structure that determines which "runtimes" the binary applies to. |
Hi @mellinoe so while this problem is definitely fixed on mac, I just got around to testing on Windows 10 and I'm getting "SDL2.dll not found" on startup (using DNF 4.6.1 and Veldrid 4.6.1). |
@tzachshabtay Are you targeting a specific architecture (x64 or x86)? |
@mellinoe no, I'm using |
Hi,
I just trying your tutorials with vs code on mac.
My .csproject file after part1 of your tutorial looks like this
... <ItemGroup> <PackageReference Include="Veldrid" Version="4.0.0" /> <PackageReference Include="Veldrid.StartupUtilities" Version="4.0.0" /> </ItemGroup> ...
However, running
dotnet restore
does not include the binary.Headerfiles are loaded, because autocompletion works.
But the program will crash at runtime.
Sdl2Window window = VeldridStartup.CreateWindow(ref windowCI); // crash
I dont know if nuget should resolve binary dependencies, but from the tutorial it seems like it should just work with these commands.
Thanks you for this API.
Best,
Marc
The text was updated successfully, but these errors were encountered: