-
Notifications
You must be signed in to change notification settings - Fork 37
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
Issues on building the application #3
Comments
For whatever it's worth, I still have some memory leak issues I need to hammer out. That being said, this looks like you either have |
This looks like what I fixed over the weekend (maybe do an extra pull?). But I think it was also only there due to a bug in I have |
Ah I see it, yea I never tagged the fix I did over the weekend, let me do that so it'll play nicer with go modules. There is now EDIT: Nevermind I did tag it, and I guess it was last week, but yea v0.1.3 has the fix to that bug |
Lol these are The machine running the code doesn't need to be on that version, but you'll need the latest development libraries to compile. |
Okay but I am on gstreamer version 1.18 on my Windows platform. The initial C.free errors were a simple problem of not including stdlib.h in Windows environment. I have fixed that, however, now I am running into a problem specific to type signatures. Note: I am currently trying to build directly from your main branch. Will still poke around and see if I can get this to build. Edit: Forgot to add the errors previously. |
TIL from what you just showed me that either my code doesn't support windows, or the specific compiler you are using. Is weird coz I could have sworn I had tested it on Windows before, but perhaps I was in WSL and don't remember clearly. There are things that could be done to mitigate those errors, I'll just have to dig into it later and it will likely require some code moving into the C files with OS checks. Feel free to open a PR if you figure it out before I do. |
After looking at it closer, I think the fix should be as easy as replacing the C.gulong calls to C.gsize calls for the type related errors, since they are the Glib equivalent of size_t anyways. For example in the function below.
As for the error related to C.free, I was only able to resolve it once I included stdlib.h in the gst.go.h file. After these changes I was able to compile it successfully on Windows. Let me know if this fixes are okay for you, then I will send a PR with my changes. |
This makes sense. Nice find!
This confuses the crap out of me. Mainly, because I know it was working fine on *nix because Anyways. feel free to send the PR over and I can test it out on my setups also. |
Hi! I'm on Windows 10 with go-gst v0.1.9 and Go 1.15.6 and had the C.free errors as well:
I see this issue was closed but I'm not sure it's truly fixed in the current version. If I go in
to:
the C.free error goes away and I get new errors:
Then I did a search&replace of
|
I just pulled the latest master (0.1.9), indeed there is a type errror at line 277 in cgo.exports.go! But I think you should just replaced the C.gulong( call that is showing the error and not in all the files. Then it should compile fine. If you managed to fix this issue, maybe can send a PR with the changes? About the problem related to the includes, I made a stupid mistake in my PR, indeed it didnt actually fix the issue. It seems that gst.h never includes stdlib.h at all and on my machine, I have manually edited the gst.h file to include stdlib for some reason (I cant remember why) and that made it look like the problem was solved in go-gst and I can compile fine. I think we need a better way to solve the include issue @tinyzimmer. Maybe we should include stdlib.h in wherever necessary as well? |
I'll need to improve the actions or something to try to catch these errors on multiple systems. I do most of my development on Linux where these issues don't arise. When I put a Including I'll do a commit switching all of those ulong (in the glib package and here) as well as seeing if an explicit stdlib include in cgo_exports works. Will chime in here with a tag for yall to test. |
Let me know if |
I did it there too. go.mod is updated to a new tag. It was things like this
which led me to fork it in the first place to make this easier.
…On Mon, Jan 11, 2021, 07:22 Shashi ***@***.***> wrote:
[image: image]
<https://user-images.githubusercontent.com/28664567/104148990-8c4c8600-540f-11eb-956c-f9a7eca48949.png>
Probably need similar change in the glib library as well?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJFREMYXS4FFE56QKJU2VQDSZKDJRANCNFSM4VC2VQTA>
.
|
Created #8 as a reference for all the changes I needed to make it compile on Windows. It seems your changes to glib is not needed actually since the original g_signal_handler_block() was always expected to take in a gulong and not gsize. |
I've replaced the v0.1.10 tag with the fixes - let me know if it works out |
Works for me. @darkvertex Please check as well just incase. |
Got good news and bad news... First the good news: Now the bad news, the older version
So I don't know what else you changed between v0.1.10 to v0.2.0, but I guess you fixed it! 🤷 |
In case someone new comes looking for how to make it work in Windows, this worked for me:
@ECHO OFF
set GSTREAMER_ROOT=C:/gstreamer/1.0/mingw_x86_64
set CGO_ENABLED=1
set PKG_CONFIG_PATH=%GSTREAMER_ROOT%/lib/pkgconfig
go build -v -o gstdemo.exe
@ECHO OFF
set GSTREAMER_ROOT=C:/gstreamer/1.0/mingw_x86_64
set GST_PLUGIN_PATH_1_0=%GSTREAMER_ROOT%/lib/gstreamer-1.0
set GST_PLUGIN_SYSTEM_PATH_1_0=%GSTREAMER_ROOT%/lib/gstreamer-1.0
set PATH=%PATH%;%GSTREAMER_ROOT%/bin
set GST_REGISTRY_1_0=%HOME%/.cache/gstreamer-1.0/gstreamer-cerbero-registry
set GST_PLUGIN_SCANNER_1_0=%GSTREAMER_ROOT%/libexec/gstreamer-1.0/gst-plugin-scanner
set GIO_EXTRA_MODULES=%GSTREAMER_ROOT%/lib/gio/modules
.\gstdemo.exe
NOTE: If you're missing a compatible compiler, installing MinGW-w64 from Chocolatey worked for me and Go's cgo compiler seemed to detect it. -- You will also need |
Thanks for the rundown. I'll find some way to adapt this into the docs 😄 |
Cool. The more people that can enjoy this nice module the better! :) Just edited my previous comment to mention that pkg-config is also needed and linking to the one I use from Chocolatey that worked for me. |
@darkvertex Any luck getting the Delve debugger working for the example in your setup on Windows machine? |
FWIW - debugging cgo calls is very hard to do. I haven't tried in delve personally, but other tools have a really hard time discerning what's happening between go land and C land. On another note that may end up being related here - I'm in the middle of moving a bunch of the glib specific stuff into the glib bindings and pulling them out of here. Because of the way go modules works and my own laziness, it's producing a few tags in the process. Once I'm done making these changes and a few others I have planned I'll probably do a From the sound of it, you all aren't using much of the areas I'm messing around with. But if you do notice a recent tag breaks Windows compatibility again give me a shout. |
@tinyzimmer Indeed I am aware of the problem of debugging C calls. But all I am trying to do is get the debugger work for my own application logic. For some reason the delve debugger is unable to link the gst.go.h object file sucessfully so I get an "undefined reference" error for every function and variable in gst.go.h. Hence I was asking if he managed to get it working |
I am getting this error when running the example program on the Readme:
Any idea how to fix it? |
I'm guessing you are on Windows because I am not getting these errors on Linux. I think those first three messages are benign, but the last two confuse me a bit. Specifically because it is yelling at a constant that is declared in Gstreamer and not in the bindings themselves. I'll see if I can work around this somehow and ping here when there is a tag. |
Ok, so I finally set up my own Windows environment for testing these things (in case that was the platform you are on). What is weird is I wasn't able to reproduce this. I was able to compile the examples without issue, and I also didn't get the warnings. That being said, I've tried something different for the two fatals you got in |
Sorry, I forgot to add more details.
When I installed the runtime version as dowloaded package the path to gstreamer-1.0 was not found. Not sure whether this is the cause. Do I have to the the PKG_CONFIG_PATH on Mac as well? |
I'll check on my mac. I'm not sure to be honest. Homebrew should put the files in the right place. If the files are in a non-standard location, you would need to set it. But you'd have gotten different errors. |
So on my mac just now, I did get this warning:
Which I don't get on Linux or Windows, so I'll try to look into the source of that later. But beyond that, it did compile on the latest tag. Are you still having the same problem on EDIT: To add, I was able to reproduce the issue you did have on |
It works with v0.2.24. Thanks a lot :-) |
Finally, add C:\tools\msys64\mingw64\bin to your Windows environment variables (not in mingw64!). You should now be able to compile and run (without setting any additional environment variables). The compiled binaries are still dynamically linked, but you can manually copy the relevant dll files from C:\tools\msys64\mingw64 for distribution (for me I copied lib/gio, lib/gstreamer-1.0 , bin/*.dll, the full version is not small but reusable, enough for me). This method worked for me (Windows10 x64), but I can't make sure it works for everyone. The following links helped me, thanks a lot: https://github.com/pion/example-webrtc-applications/tree/master/gstreamer-send https://github.com/gotk3/gotk3/wiki/Installing-on-Windows |
I'm trying to run the launch example using Golang and go-gst library on Windows, but I keep getting an error. Steps I did:
PS C:\Users?\Desktop\gst windows> go build -v mainC:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 |
Hi, when I try to build the application, I get some error related to the CGO's C.free function. Any idea how i can resolve this?
I am new to CGO.
Thank you,
The text was updated successfully, but these errors were encountered: