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

Report error whild build gocv #21

Open
eyauwag opened this issue Sep 30, 2024 · 1 comment
Open

Report error whild build gocv #21

eyauwag opened this issue Sep 30, 2024 · 1 comment

Comments

@eyauwag
Copy link

eyauwag commented Sep 30, 2024

Hello. While I am building my image, it reports such error. is there some issue in the new release?

xxxxxx@WTCNLVSE244937L:/mnt/d/golang/gocv/gocv-alpine/example$ docker buildx build --platform linux/arm/v7 -t gocv:latest --load .
[+] Building 10.9s (9/10) docker-container:ecnbuilder
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 373B 0.0s
=> WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) 0.0s
=> [internal] load metadata for docker.io/denismakogon/gocv-alpine:4.0.1-runtime 5.0s
=> [internal] load metadata for docker.io/denismakogon/gocv-alpine:4.0.1-buildstage 5.1s
=> [auth] denismakogon/gocv-alpine:pull token for registry-1.docker.io 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [build-stage 1/3] FROM docker.io/denismakogon/gocv-alpine:4.0.1-buildstage@sha256:7192c447d48d157a9465bb10a45 0.0s
=> => resolve docker.io/denismakogon/gocv-alpine:4.0.1-buildstage@sha256:7192c447d48d157a9465bb10a45d00c2cbce902 0.0s
=> CACHED [stage-1 1/2] FROM docker.io/denismakogon/gocv-alpine:4.0.1-runtime@sha256:cd1a61eae8b3dafcba67339f989 0.0s
=> => resolve docker.io/denismakogon/gocv-alpine:4.0.1-runtime@sha256:cd1a61eae8b3dafcba67339f989a01c3797091555a 0.0s

[build-stage 3/3] RUN cd /go/src/gocv.io/x/gocv && go build -o /go/bin/gocv-version ./cmd/version/main.go:
5.771 # gocv.io/x/gocv
5.771 In file included from aruco.cpp:1:0:
5.771 aruco.h:12:13: error: 'aruco' in namespace 'cv' does not name a type
5.771 typedef cv::aruco::Dictionary* ArucoDictionary;
5.771 ^~~~~
5.771 aruco.h:13:13: error: 'aruco' in namespace 'cv' does not name a type
5.771 typedef cv::aruco::DetectorParameters* ArucoDetectorParameters;
5.771 ^~~~~
5.771 aruco.h:14:13: error: 'aruco' in namespace 'cv' does not name a type
5.771 typedef cv::aruco::ArucoDetector* ArucoDetector;
5.771 ^~~~~
5.771 aruco.h:21:1: error: 'ArucoDetectorParameters' does not name a type
5.771 ArucoDetectorParameters ArucoDetectorParameters_Create();
5.771 ^~~~~~~~~~~~~~~~~~~~~~~
5.771 aruco.h:22:58: error: variable or field 'ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin' declared void
5.771 void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin);
5.771 ^~~~~~~~~~~~~~~~~~~~~~~
5.771 aruco.h:22:58: error: 'ArucoDetectorParameters' was not declared in this scope
5.771 aruco.h:22:86: error: expected primary-expression before 'int'
5.771 void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin);
5.771 ^~~
5.771 aruco.h:23:57: error: 'ArucoDetectorParameters' was not declared in this scope
5.771 int ArucoDetectorParameters_GetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap);
5.771 ^~~~~~~~~~~~~~~~~~~~~~~
5.771 aruco.h:24:58: error: variable or field 'ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax' declared void
5.771 void ArucoDetectorParameters_SetAdaptiveThreshWinSizeMax(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMax);

@nishant2192
Copy link

nishant2192 commented Nov 13, 2024

I tries a lot of combinations on missing packages and ended up writing my own docker stage, hope this will help folks looking into this:

FROM gocv/opencv:4.10.0 AS build-stage

ENV GOPATH /go

ARG DOCKER_BUILDKIT=1
ARG GH_ACCESS_TOKEN

RUN apt-get update && apt-get install -y git ca-certificates

WORKDIR /build

COPY . ./

WORKDIR /build/demo-app
RUN  --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=1 GOOS=linux go build -tags appsec -o /build/dist

FROM gcr.io/distroless/base-debian12 AS release-stage

WORKDIR /app

# # OpenCV 4.10.0 shared objects from build-stage
COPY --from=build-stage /usr/local/lib /usr/local/lib
COPY --from=build-stage /usr/local/lib/pkgconfig /usr/local/lib/pkgconfig
COPY --from=build-stage /usr/local/include /usr/local/include
COPY --from=build-stage /usr/local/lib/pkgconfig/opencv4.pc /usr/local/lib/pkgconfig/opencv4.pc
COPY --from=build-stage /usr/local/include/opencv4 /usr/local/include/opencv4
COPY --from=build-stage /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
COPY --from=build-stage /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
COPY --from=build-stage /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

COPY --from=build-stage /build/dist ./demo-app

ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
ENV LD_LIBRARY_PATH /usr/local/lib
ENV CGO_CPPFLAGS -I/usr/local/include

EXPOSE 8080

CMD ["./demo-app", "run"]

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

2 participants