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

Can not compile packages with v2 #4

Closed
bondar-pavel opened this issue Dec 5, 2019 · 3 comments
Closed

Can not compile packages with v2 #4

bondar-pavel opened this issue Dec 5, 2019 · 3 comments

Comments

@bondar-pavel
Copy link

bondar-pavel commented Dec 5, 2019

When I try to export libraries which has version 2 in the package path I get endless loop on checkout.

Example goup.yaml

# The name is used to setup a custom workspace and tools.
# You should not invoke parallel builds for the same project
name: WebRTC

# set custom environment variables, which are always applied into the executing environment, just
# like they have been defined before invoking GoUp
variables:
  TEST: "HELLO WORLD"
  TEST2: "HELLO WORLD"

# before_script is executing the following commands before the actual build starts. You can use it, to e.g. work around
# authentication problems with go get and git
#before_script:
#  - git config --global url."https://user:[email protected]/".insteadOf "https://gitlab.mycompany.com/"


# The build section defines what and how goup should work
build:
  # We want a gomobile build, e.g. for ios or android
  gomobile:

    # the toolchain section is required to setup a stable gomobile building experience
    toolchain:
      # which go version?
      go: 1.12.4
      # which android ndk version?
      ndk: r19c
      # which android sdk version?
      sdk: 4333796
      # which java version?
      jdk: 8u212b03
      # which gomobile version?
      gomobile: wdy-v0.0.1

    # The ios section defines how our iOS library is build. This only works on MacOS with XCode installed
    #ios:
      # The gomobile -prefix flag
      #prefix: MyLib

      # The gomobile -o flag, this will be a folder
      #out: ./appIOS/MyLib.framework

      # The gomobile -bundleid flag sets the bundle ID to use with the app.
      #bundleid:

      # The gomobile -ldflags flag
      #ldflags:


    # The android section defines how our android build is executed
    android:
      # The gomobile -javapkg flag prefixes the generated packages
      javapkg: com.github.pion.webrtc

      # The gomobile -o flag, this will be an android archive file. You should only ever use
      # a single go library in your app. Otherwise there may be some technical issues and
      # it also wastes a lot of storage and memory resources in your app.
      out: ./webrtcLib.aar

      # The gomobile -ldflags flag
      ldflags:


    # The modules section defines a list of all local or remote go modules, which should be included in the build.
    # You can have more than one, but probably you only need a single one and want to use
    # real go mod dependencies instead.
    modules:
      - ./webrtc

    # The export section defines all exported packages which are passed to gobind by gomobile.
    # Gomobile does not generate transitives exports, so you need to declare all
    # packages containing types and methods which you want to have bindings for.
    # Be careful with name conflicts, because the last part of the package will be used
    # to scope the types.
    export:
      # contains handsome wrappers to allow passing unsupported types (interfaces, maps, slices)
      # through gomobile. In our case pkgb wants to export those types.
      - github.com/worldiety/std
      # our actual local packages
      - github.com/pion/webrtc
    modules:
      - ./webrtc

Modules points to checked out version of webrtc (git clone github.com/pion/webrtc).

I get next errors when I try to run goup:

zsh 10222 [255]  (git)-[master]-% goup .
2019-12-05 16:00:53.584 [ERROR] - : ,
read /home/pavel/git/webrtc/webrtc: is a directory
2019-12-05 16:00:53.824 [ERROR] - : bin/gomobile: package "github.com/pion/webrtc": cannot find package "github.com/pion/webrtc" in any of:,
2019-12-05 16:00:53.824 [ERROR] - :     /home/pavel/.goup/toolchains/go-1.12.4/src/github.com/pion/webrtc (from $GOROOT),
2019-12-05 16:00:53.824 [ERROR] - :     /home/pavel/.goup/WebRTC/go/src/github.com/pion/webrtc (from $GOPATH),
2019-12-05 16:00:53.824 [ERROR] - : ,
2019-12-05 16:00:53.824 [ERROR] - err: exit status 1,

I run a quick hack to make sure repo in $GOPATH is linked to real repo

ln -s ~/git/webrtc /home/pavel/.goup/WebRTC/go/src/github.com/pion/webrtc

But it does not help a lot, as a result goup tries to checkout v2 in loop and fails because of filename is too long or all free space in consumed on the drive:

/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2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2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2
/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2
/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2
/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2/v2: file name too long
read /home/pavel/git/webrtc/webrtc: is a directory
2019-12-05 15:22:52.268 [ERROR] - : bin/gomobile: package "github.com/pion/webrtc": cannot find package "github.com/pion/webrtc" in any of:,
2019-12-05 15:22:52.268 [ERROR] - :     /home/pavel/.goup/toolchains/go-1.12.4/src/github.com/pion/webrtc (from $GOROOT),
2019-12-05 15:22:52.268 [ERROR] - :     /home/pavel/.goup/WebRTC/go/src/github.com/pion/webrtc (from $GOPATH),
2019-12-05 15:22:52.268 [ERROR] - : ,
2019-12-05 15:22:52.268 [ERROR] - err: exit status 1,

Splitted /v2/v2: file name too long into multiple lines because it was not shown correctly.

Is there any plans to support export for packages which has v2 in path?
Is there any known workaround that could be used to export pion/webrtc as a library?

@torbenschinke
Copy link
Member

torbenschinke commented Dec 6, 2019

At first, besides the v2 problem, some project setup hints:

  • you should always create a custom module (e.g. named fatlib), because you can only have
    a single go library per process. Therefore it is always recommended to start with a custom library, which includes all your dependencies. Afterwards you will build this library and only export selected packages (also from external dependencies, like your webrtc).
  • in your case you should exclude github.com/worldiety/std from export, because you even don't have that dependency, which would bail out sooner or later.
  • you should never change things in the hidden .goup workspace by hand, because it will screw everything up (which you already noticed).

Now to the v2 problem: Sorry, but as far as I can see, you are out of luck, because the webrtc project has a wrong go.mod declaration. E.g. if you look at the go.mod file from the tagged 2.1.16 release, the module name has a v2 in it's path, which does not match the import path and is not allowed. You can prove it like this:

mkdir fatlib
cd fatlib
go mod init fatlib
go get github.com/pion/webrtc latest

Results in fatlib/go.mod:5: require github.com/pion/webrtc: version "v2.1.16" invalid: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2.

A related bug, which explains the background is e.g. golang/go#35732 or golang/go#33879

@torbenschinke
Copy link
Member

Just another explanation, about how to declare a major (1+) version properly: https://research.swtch.com/vgo-principles#compatibility

@winwisely99
Copy link

winwisely99 commented Dec 13, 2019

Hey @bondar-pavel

We also working on embedding pion webrtc on our project

Ions is a nice packaging of it
https://github.com/pion/ion/tree/master/pkg/rtc

As far as using goup goes i cant really comment. I used it for a bit and its really good, but i ended up going with a docker solution. It might be useful for you too.

There is a docker that can build for mac and android that we use here:
https://github.com/go-flutter-desktop/golang-cross

It can build IOS and OSX apps.

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

No branches or pull requests

3 participants