go-webrtc icon indicating copy to clipboard operation
go-webrtc copied to clipboard

[WIP] Script to build-from-scratch from upstream webrtc

Open infinity0 opened this issue 8 years ago • 11 comments

See the first few lines of build-gnu-linux.sh for a broad description of what it does. (Forms part of a solution for #23).

We avoid depot_tools, to reduce the resource burden on whoever wants to build this project. Currently we pull in the latest upstream versions 49.xxx of both webrtc and chromium, and apply some patches specific to these versions. These will need to be maintained as the upstream repos are updated, but this shouldn't be too hard. The upstream build process by default currently builds vpx, boringssl, protobuf_lite, etc. Later I will play with trying to avoid that, and instead link against system libraries. (It already links against some, like jpeg and srtp.) Later also I will try to persuade upstream to expose a more finalised public API version of libjingle_peerconnection_internal.

The script takes about 20 minutes to run on my machine. It should be adaptable to FreeBSD-based systems such as a certain other popular OS, but I don't have a system to test that on.

I didn't update README yet, because I wanted to check that you're fine with the general approach here. There's some untidy bits like automatically patching the .pc files, better suggestions welcome.

infinity0 avatar Feb 02 '16 22:02 infinity0

This is awesome! Thanks for doing this.

Ran into a couple issues at first, but then made it work :+1: Also took about 20 minutes to build (archlinux).

  • The first time, after fetching & patching, it failed at setup_links.py because I forgot that these scripts require python 2.7. Using a virtualenv fixes this. It may be worth checking the python version earlier in the script, and stopping / notifying the user if their environment isn't set up correctly to save time.
  • Also need to make sure to export JAVA_HOME to wherever java-7-openjdk is.
  • Then I had to install libsrtp as a system library, because I hadn't done that yet.
  • Lastly when trying to run the chat demo, it couldn't find libboringssl. Fixed with export LD_LIBRARY_PATH=lib

Totally great that you've managed to skip the depot_tools shenanigans. Really like your approach so far!

keroserene avatar Feb 05 '16 00:02 keroserene

Also, we have two choices to get this to work with Travis CI...

  • Run your script during the travis build (an OSX version will also be needed) However, this will extend the travis build time from ~1-2 minutes to 20+ minutes.
  • Keep the pre-built archive & includes in the repo, if only for quicker testing on travis.

Having a cleaner repo is nice, though a very long test setup is less nice. Choices!

keroserene avatar Feb 05 '16 20:02 keroserene

Choices!

  • Have a second repo that builds the dependencies and have go-webrtc depend on that?

arlolra avatar Feb 05 '16 21:02 arlolra

Nice to hear it works on Arch! I wasn't aware you had to set JAVA_HOME - I don't have it set over here in Debian; what's the error if you don't set it? When I get some time I'll try to figure out the minimal list of dependencies, instead of just saying apt-get build-dep chromium.

I like @arlolra's idea with the second repo, if it's possible to configure travis like that. (I'm new to travis, and haven't seen the build config options.)

infinity0 avatar Feb 05 '16 21:02 infinity0

Error when JAVA_HOME isn't set

Updating projects from gyp files... Traceback (most recent call last): File "", line 1, in AssertionError: Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h! gyp: Call to 'python -c "import os; dir=os.getenv('JAVA_HOME', '/usr/lib/jvm/java-7-openjdk-amd64'); assert os.path.exists(os.path.join(dir, 'include/jni.h')), 'Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h!'; print dir"' returned exit status 1 while in talk/libjingle.gyp. Traceback (most recent call last): File "", line 1, in AssertionError: Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h! gyp: Call to 'python -c "import os; dir=os.getenv('JAVA_HOME', '/usr/lib/jvm/java-7-openjdk-amd64'); assert os.path.exists(os.path.join(dir, 'include/jni.h')), 'Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h!'; print dir"' returned exit status 1 while in webrtc/webrtc_examples.gyp. Traceback (most recent call last): File "", line 1, in AssertionError: Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h! gyp: Call to 'python -c "import os; dir=os.getenv('JAVA_HOME', '/usr/lib/jvm/java-7-openjdk-amd64'); assert os.path.exists(os.path.join(dir, 'include/jni.h')), 'Point $JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h!'; print dir"' returned exit status 1 while in talk/libjingle_tests.gyp.

amozoss avatar May 04 '16 22:05 amozoss

Here is a more specific list of dependencies. It should be fairly close. apt-get install libsrtp-dev libxslt-dev yasm libxml2-dev libffi-dev libglib2.0-dev libatk1.0-dev libgtk2.0-dev libxtst-dev libxss-dev libpci-dev libdbus-1-dev libgnome-keyring-dev libnss3-dev libpulse-dev libcups2-dev libexif-dev libjpeg-dev libasound2-dev libudev-dev ninja-build

amozoss avatar May 09 '16 19:05 amozoss

Hey, this is pretty neat. This does make me wonder, though: has the person that provided e.g. lib/libwebrtc-darwin-amd64-magic.a made their notes/scripts public? (I guess that's @arlolra and @keroserene, judging by the git history)

I'm tempted to write bindings for Haskell (but first, I'd like to package WebRTC for NixOS), and I'd like to avoid experiencing the pain of building WebRTC if at all possible :sweat_smile:.

cstrahan avatar Dec 28 '16 01:12 cstrahan

@cstrahan see #51

arlolra avatar Jan 03 '17 19:01 arlolra

I've just updated the pull request for #51 per code review and it appears to be working well. This is a different approach from #32 but hopefully useful.

https://github.com/keroserene/go-webrtc/pull/51

On Tue, Jan 3, 2017 at 11:39 AM, Arlo Breault [email protected] wrote:

@cstrahan https://github.com/cstrahan see #51 https://github.com/keroserene/go-webrtc/pull/51

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keroserene/go-webrtc/pull/32#issuecomment-270203806, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqyU_NZ5i8C-XA_QNAu8JkvY5S0IgGEks5rOqPcgaJpZM4HR9YZ .

cantstopthesignal avatar Jan 07 '17 23:01 cantstopthesignal

Since this stuff was fresh in my brain, I rebased this on top of my #90 pull request: https://github.com/eighthave/go-webrtc/tree/build-from-scratch

And threw it in a gitlab-ci job running in Debian/testing: https://gitlab.com/eighthave/go-webrtc/-/jobs/124653582

eighthave avatar Nov 23 '18 13:11 eighthave

This is perhaps more interesting, it is running only the go build on various Debian and Ubuntu versions: https://gitlab.com/eighthave/go-webrtc/pipelines/37678401

Seems the pkg-config libs also needs an update.

eighthave avatar Nov 23 '18 13:11 eighthave