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

mobile: support compiling with go-mobile #64

Closed
backkem opened this issue Aug 3, 2018 · 15 comments
Closed

mobile: support compiling with go-mobile #64

backkem opened this issue Aug 3, 2018 · 15 comments

Comments

@backkem
Copy link
Member

backkem commented Aug 3, 2018

TBD if we want to try this before porting DTLS (#20).

cc @chrisprobst @gedw99

@backkem backkem changed the title mobiele: support compiling with go-mobile mobile: support compiling with go-mobile Aug 3, 2018
@backkem backkem mentioned this issue Aug 3, 2018
56 tasks
@chrisprobst
Copy link

How could one start working on this issue? I guess the openssl lib has to be cross compiled for ARM so that the C files link to correct library. Do you have a hint for how to start ? I'm on macOS and everything works beside the gomobile build process due to an missing import:

could not import github.com/pions/webrtc/internal/dtls (type-checking package "github.com/chunkedswarm/go-chunkedswarm/vendor/github.com/pions/webrtc/internal/dtls" failed (/Users/chrisprobst/dev/go/src/github.com/chunkedswarm/go-chunkedswarm/vendor/github.com/pions/webrtc/internal/dtls/dtls.go:66:15: undeclared name: _Ctype_struct_tlscfg)))))))

@ghost
Copy link

ghost commented Aug 6, 2018

The only option is to split the codebase and use a c lib and wrap it.
This woudl mean that you need to be able to swap out what DTLS lib you use depending if your on desktop versus mobile.

This is ALL of course until a pure golang DTLS lib is sturdy enough. But this is the world we live in for now.

SO a very brief search came up with:

https://github.com/sics-iot/tinydtls-standalone
I found tindtls via the COAP page ( which also needs dtls ) here: http://coap.technology/impls.html
So this becomes an architecture similar to what happened with sqlite or rocksdb.

@backkem
Copy link
Member Author

backkem commented Aug 6, 2018

We're going to focus on getting connections between two pions clients working for now. Afterwards we'll look into this. We intend to estimate the difference in effort between compiling the current version on ARM and porting DTLS to pure go. If the difference is minimal we'll likely pursue the latter since it is our goal to avoid the CGO dependency anyway.

@backkem backkem added this to the 1.2.0 (Quest for the Sigil) milestone Aug 6, 2018
@ghost
Copy link

ghost commented Aug 6, 2018 via email

@Sean-Der
Copy link
Member

Just to update anyone watching, great news in Slack today! Max was able to get pion-WebRTC working on Android (and will be doing iOS as well)

I am not involved in the work, but sounds very promising :)

@topfs2
Copy link

topfs2 commented Aug 22, 2018

How did he achieve it? did he port the C parts to pure golang?
Mostly asking since I wanted to use this and cross compile to arm (synology), but got into issues with ssl. I got it to work on raspberry pi with ubuntu mate (without cross compile) but could not move that to another arm os (since it was missing ssl-dev)

Anyways, awesome work, the project seems to be real nice and would love to see it in pure golang, then it would be the only webrtc implementation that seems to be easily portable :)

@backkem
Copy link
Member Author

backkem commented Aug 23, 2018

I think he cross compiled OpenSSL using a docker container. Hopefully we can get this added as an example at some point.

@ghost
Copy link

ghost commented Aug 27, 2018

That would be awesome
Interesting to see his code and makefile

@ghost
Copy link

ghost commented Sep 1, 2018

@backkem yes i am pretty sure this is what he did. On android you can build as a shared lib and on IOS as an archive and then use it

@chertov
Copy link

chertov commented Sep 11, 2018

Hi, i am Max
To build pions with go-mobile is very simple!
I have two scripts for this. https://github.com/chertov/pions_gomobile
I'm using prebuild openssl binary from here https://www.teskalabs.com/blog/openssl-binary-distribution-for-developers-static-library
but you can build openssl from source if you want!
I don't know how to build universal aar library for all android platforms.
I linked armeabi-v7a binary in my script, it works on my old samsung galaxy S4!

I hope to see pure golang dtls implementation in pions!
But we have no problem with native openssl on mobile platforms!)

@ghost
Copy link

ghost commented Sep 12, 2018

Hey Max . That's awesome. I will try it out with flutter for android and iOS and feedback my efforts

@Sean-Der
Copy link
Member

We now have a 100% Go (no OpenSSL dependency) version of pion-WebRTC

Me and @backkem just got our DTLS branch to the point it is ready to be tested. You can try it out here I would really appreciate of people could test it out.

I am going to close this issue since I am assuming since we are 100% Go we no longer need special instructions. Feel free to re-open if there is something that we still need for mobile users, thanks!

@chrisprobst
Copy link

A.w.e.s.o.m.e.

@vmwsree
Copy link

vmwsree commented Nov 24, 2022

<3

@shushenghong
Copy link

i tried the latest pion code and use gomobile bind to build android/ios library, it all failed, anyhelp?

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

No branches or pull requests

7 participants