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

Error relocating grpc-gateway.so: unsupported relocation type 7 #831

Open
Kozaky opened this issue Dec 17, 2023 · 1 comment
Open

Error relocating grpc-gateway.so: unsupported relocation type 7 #831

Kozaky opened this issue Dec 17, 2023 · 1 comment
Labels

Comments

@Kozaky
Copy link

Kozaky commented Dec 17, 2023

Hi,

I am basically following the example from this blog to create a grpc plugin: https://www.krakend.io/blog/krakend-grpc-gateway-plugin/

The issue is that ones I try to run it on my mac I get the following error:

2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.838 ▶ DEBUG [SERVICE: telemetry/logging] Improved logging started.
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.838 ▶ INFO Starting KrakenD v2.5.0
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.839 ▶ INFO Working directory is /etc/krakend
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.839 ▶ DEBUG [SERVICE: Plugin Loader] Starting loading process
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.842 ▶ DEBUG [SERVICE: Executor Plugin] plugin #0 (plugins/grpc-gateway.so): plugin.Open("plugins/grpc-gateway.so"): Error relocating /etc/krakend/plugins/grpc-gateway.so: unsupported relocation type 7
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [SERVICE: Handler Plugin] plugin #0 (plugins/grpc-gateway.so): plugin.Open("plugins/grpc-gateway.so"): Error relocating /etc/krakend/plugins/grpc-gateway.so: unsupported relocation type 7
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [SERVICE: Modifier Plugin] plugin #0 (plugins/grpc-gateway.so): plugin.Open("plugins/grpc-gateway.so"): Error relocating /etc/krakend/plugins/grpc-gateway.so: unsupported relocation type 7
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [SERVICE: Plugin Loader] Loading process completed
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ INFO Starting the KrakenD instance
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [ENDPOINT: /user-manager/user/create] Building the proxy pipe
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [BACKEND: /user-manager/user/create] Building the backend pipe
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [BACKEND: /user-manager/user/create] No plugins registered for the module
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [ENDPOINT: /user-manager/user/create] Building the http handler
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ DEBUG [ENDPOINT: /user-manager/user/create][JWTSigner] Signer disabled
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ INFO [ENDPOINT: /user-manager/user/create][JWTValidator] Validator disabled for this endpoint
2023-12-18 00:16:26 [KRAKEND] 2023/12/17 - 23:16:26.843 ▶ INFO [SERVICE: Gin] Listening on port: 8000
2023-12-18 00:16:31 [KRAKEND] 2023/12/17 - 23:16:31.840 ▶ DEBUG [SERVICE: Telemetry] Registering usage stats for Cluster ID 2Tg5FBe+Uw2LHg0LnQEXdMI8LJ/ccadxsFzGBL7NAxg=
2023-12-18 00:16:26 Parsing configuration file: /etc/krakend/krakend.json

This is the dockerfile that I am using:

FROM krakend/builder:2.5 as builder

WORKDIR /src
ADD go.mod /go.mod
ADD go.sum /go.sum
COPY ./gateway/ /gateway
COPY ./generated/ /generated
COPY ./plugins/ /plugins
RUN export CGO_ENABLED=1
RUN export CC=aarch64-linux-musl-gcc
RUN export GOARCH=arm64
RUN export GOHOSTARCH=amd64
RUN export EXTRA_LDFLAGS='-extldflags=-fuse-ld=bfd -extld=aarch64-linux-musl-gcc'
RUN go build -ldflags="${EXTRA_LDFLAGS}" -buildmode=plugin -o /plugins/grpc-gateway.so /plugins/grpc-gateway.go

FROM devopsfaith/krakend:2.5

COPY --from=builder /plugins/grpc-gateway.so /etc/krakend/plugins/

COPY krakend.json /etc/krakend/krakend.json

I think the issue is related to the architecture problems you mention on your site for ARM64: https://www.krakend.io/docs/extending/injecting-plugins/, but adding the flags you mentioned there doesn't seem to solve the issue.

Do you know how I can solve it? Thanks in advance :)

@taik0
Copy link
Member

taik0 commented Feb 19, 2024

Hi @Kozaky
You should add the environment variables with the ENV Dockerfile directive, the RUN export will not work.
Try running this manually or inside a script to check if it works for you.

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

No branches or pull requests

2 participants