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

Cannot build project with AspectInjector on M1 mac inside docker. #190

Open
pvoshell opened this issue Jul 25, 2022 · 2 comments
Open

Cannot build project with AspectInjector on M1 mac inside docker. #190

pvoshell opened this issue Jul 25, 2022 · 2 comments

Comments

@pvoshell
Copy link
Contributor

pvoshell commented Jul 25, 2022

Environment (please complete the following information):

  • OS: MacOs 12.0.1 M1
  • Framework: [net6.0]
  • Type of application: aspnet
  • Version of AspectInjector: 2.7.4

Describe the bug
When building our project with AspectInjector it fails when building a docker image:

docker build .

#12 4.013 qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
#12 4.013 AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors. [/src/Core/Core.csproj]

It does work when I build it as an AMD64 image:

docker build . --platform=amd64

I don't know how AspectInjector works internally, but it looks like it is trying to run an x64 binary on an arm linux container.

It does not matter when using non alpine images, as I tried that as well.

To Reproduce
A steps to reproduce the bug. Or a description when it happens (in compile-time, in runtime).

It occurs during build time of the docker image on an m1 mac when dotnet publish -c Release -o out is executing.

Additional context

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
WORKDIR /src

# Copy everything
COPY src ./
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
WORKDIR /src
COPY --from=build /src/out .

# expose the application on port 8080
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "Api.dll"]
@pvoshell pvoshell added the bug label Jul 25, 2022
@pamidur
Copy link
Owner

pamidur commented Jul 25, 2022

Hi @pvoshell ,yes indeed, AspectInjector internally uses a set of binaries that are built for specific target platform. And there is no ARM variant yet. I'll consider this report as feature request

@pamidur pamidur added enhancement and removed bug labels Jul 25, 2022
@pvoshell
Copy link
Contributor Author

pvoshell commented Jul 25, 2022

Thanks @pamidur for your response. I think I can fix this myself. I will send you a pull request when I'm done.

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

No branches or pull requests

2 participants