opus icon indicating copy to clipboard operation
opus copied to clipboard

Build Issue

Open pgsnimble opened this issue 1 year ago • 6 comments

Hey!!

I am trying to use this library to encode the video and I can't find a way to make it work, everytime I try to build the app I am always getting the following error:

 => ERROR [builder-debug 2/2] RUN --mount=type=cache,target=/root/.cache/go-build     go build -gcflags="all=-N -l" -ldflags "-X main.BuildVersion=dev-debug" -o /tmp/gobuild/bin/jbl                            0.5s
------
 > [builder-debug 2/2] RUN --mount=type=cache,target=/root/.cache/go-build     go build -gcflags="all=-N -l" -ldflags "-X main.BuildVersion=dev-debug" -o /tmp/gobuild/bin/jbl:
#0 0.489 # github.com/hraban/opus
#0 0.489 /go/pkg/mod/github.com/hraban/[email protected]/streams_map.go:32:23: undefined: Stream
#0 0.489 /go/pkg/mod/github.com/hraban/[email protected]/streams_map.go:36:40: undefined: Stream
#0 0.489 /go/pkg/mod/github.com/hraban/[email protected]/streams_map.go:42:30: undefined: Stream
#0 0.489 /go/pkg/mod/github.com/hraban/[email protected]/streams_map.go:53:31: undefined: Stream
#0 0.489 /go/pkg/mod/github.com/hraban/[email protected]/streams_map.go:62:25: undefined: Stream

Do you mind to help me?

This is a piece of my docker file

ARG UBUNTU_IMAGE_VERSION=24.04
ARG YT_DLP=2024.08.06

FROM golang:1.21.3 AS base

ENV CGO_ENABLED=0
ENV GOPRIVATE=github.com/ppaulogustavo

RUN go install github.com/jstemmer/go-junit-report@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest

WORKDIR /tmp/gobuild
COPY ./go.mod ./go.sum ./
RUN go mod download -x
COPY . .

FROM base as builder-debug
ARG BUILD_VERSION='dev-debug'

RUN apt-get update && apt-get install -y pkg-config libopus-dev libopusfile-dev moreutils

RUN --mount=type=cache,target=/root/.cache/go-build \
    go build -gcflags="all=-N -l" -ldflags "-X main.BuildVersion=${BUILD_VERSION}" -o /tmp/gobuild/bin/jbl

This is triggering the error when the build command is executed

pgsnimble avatar Aug 21 '24 14:08 pgsnimble

Hi, weird, it looks like the stream.go file isn't available in that directory. Is the directory mounted from somewhere else, without that file? Try an ls and see if it exists before building.

hraban avatar Aug 22 '24 03:08 hraban

I'm having the same issue on Windows. @pgsnimble were you able to solve it?

ErikGoldman avatar Nov 27 '24 03:11 ErikGoldman

Yeah facing the same issue. but working if i build this in my mac without any args. If i build this specifically for linux. from my macbook this seems to throw this error. Every tried copying the files to the local and it still did't work

SujithThirumalaisamy avatar Jan 10 '25 18:01 SujithThirumalaisamy

Yeah facing the same issue. but working if i build this in my mac without any args. If i build this specifically for linux. from my macbook this seems to throw this error. Every tried copying the files to the local and it still did't work

Hi @SujithThirumalaisamy, maybe you need to set CGO_ENABLED=1 because by default it is disabled for cross compiling. For example

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o app ./main.go

farizap avatar Feb 10 '25 05:02 farizap

same error for me (CGO_ENABLED=0), hit this one after upgrading from 1.23 to 1.24. I will share more as I found out

tbarbugli avatar Feb 16 '25 16:02 tbarbugli