strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.76k stars 304 forks source link

could not determine kind of name for C.heif_compression_EVC #824

Open cruvie opened 1 year ago

cruvie commented 1 year ago

Hi , when I run libheif-master/examples/heif-test.go I encounter this error

package libheif-master/examples: C source files not allowed when not using cgo or SWIG: test_c_api.c

I try to add import "C" and run again encounter this

# github.com/strukturag/libheif/go/heif
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:55:25: could not determine kind of name for C.heif_compression_EVC
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:53:25: could not determine kind of name for C.heif_compression_JPEG2000
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:54:25: could not determine kind of name for C.heif_compression_VVC
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:317:27: could not determine kind of name for C.heif_suberror_Encoder_cleanup
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:315:28: could not determine kind of name for C.heif_suberror_Encoder_encoding
/Users/xhkang/go/pkg/mod/github.com/strukturag/libheif@v1.15.2/go/heif/heif.go:313:34: could not determine kind of name for C.heif_suberror_Encoder_initialization

Can you help me , I have no idea about this and I'm not familiar with C, thank you!

simonfrey commented 1 year ago

I have the same problem when trying to build my program in docker

ERROR:

Step 7/12 : RUN go build -o /go/bin/scaler ./cmd/app/
 ---> Running in 5a65d127345a
# github.com/strukturag/libheif/go/heif
vendor/github.com/strukturag/libheif/go/heif/heif.go:55:25: could not determine kind of name for C.heif_compression_EVC
vendor/github.com/strukturag/libheif/go/heif/heif.go:53:25: could not determine kind of name for C.heif_compression_JPEG2000
vendor/github.com/strukturag/libheif/go/heif/heif.go:54:25: could not determine kind of name for C.heif_compression_VVC
vendor/github.com/strukturag/libheif/go/heif/heif.go:159:28: could not determine kind of name for C.heif_error_Plugin_loading_error
vendor/github.com/strukturag/libheif/go/heif/heif.go:234:38: could not determine kind of name for C.heif_suberror_Cannot_read_plugin_directory
vendor/github.com/strukturag/libheif/go/heif/heif.go:317:27: could not determine kind of name for C.heif_suberror_Encoder_cleanup
vendor/github.com/strukturag/libheif/go/heif/heif.go:315:28: could not determine kind of name for C.heif_suberror_Encoder_encoding
vendor/github.com/strukturag/libheif/go/heif/heif.go:313:34: could not determine kind of name for C.heif_suberror_Encoder_initialization
vendor/github.com/strukturag/libheif/go/heif/heif.go:228:30: could not determine kind of name for C.heif_suberror_Plugin_is_not_loaded
vendor/github.com/strukturag/libheif/go/heif/heif.go:230:31: could not determine kind of name for C.heif_suberror_Plugin_loading_error
vendor/github.com/strukturag/libheif/go/heif/heif.go:282:38: could not determine kind of name for C.heif_suberror_Unknown_NCLX_color_primaries
vendor/github.com/strukturag/libheif/go/heif/heif.go:286:42: could not determine kind of name for C.heif_suberror_Unknown_NCLX_matrix_coefficients
vendor/github.com/strukturag/libheif/go/heif/heif.go:284:47: could not determine kind of name for C.heif_suberror_Unknown_NCLX_transfer_characteristics
vendor/github.com/strukturag/libheif/go/heif/heif.go:303:47: could not determine kind of name for C.heif_suberror_Unsupported_header_compression_method

DOCKERFILE

FROM golang:1.19-alpine as builder
RUN apk update
RUN apk add build-base libavif libheif-dev pkgconfig
RUN pkg-config libheif --modversion
ADD . /scaler
WORKDIR /scaler
RUN go build -o /scaler ./cmd/app/

FROM alpine:latest
RUN apk-add libavif
COPY --from=builder /go/bin/scaler /usr/local/bin/scaler
CMD [ "/usr/local/bin/scaler" ]
EXPOSE 8080
farindk commented 1 year ago

I do not know much about go, but these are all new enums. Hence, my guess is that you have an old version of libheif installed in the system and those old headers are used instead of the new libheif version.