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

Lack of M1 support when rosetta isn't installed #210

Open
omer-za opened this issue Feb 1, 2023 · 14 comments
Open

Lack of M1 support when rosetta isn't installed #210

omer-za opened this issue Feb 1, 2023 · 14 comments

Comments

@omer-za
Copy link

omer-za commented Feb 1, 2023

Environment

  • OS: macos
  • Framework: net6.0
  • Type of application console
  • Version of AspectInjector: 2.8.1

Describe the bug
Build fails on M1 without Rosetta

/Users/user/.nuget/packages/aspectinjector/2.8.1/buildTransitive/netstandard2.0/../../build/_bin/osx-x64/AspectInjector: Bad CPU type in executable
AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors. 
 Build FAILED.
0 Warning(s)
 1 Error(s)

To Reproduce
Just try to build a project with aspectinjector as a package reference on a M1 machine without Rosetta

@omer-za omer-za added the bug label Feb 1, 2023
@omer-za
Copy link
Author

omer-za commented Feb 1, 2023

@pamidur @kondr1 please let me know what can I do to make it resolved ASAP 🙏

@pamidur
Copy link
Owner

pamidur commented Feb 1, 2023

As a quick test you can set AspectInjector_Location in your csproj file to (folder_where_aspctInjector_files_are_located)/build/_bin/osx-arm64/AspectInjector
e.g.
/Users/user/.nuget/packages/aspectinjector/2.8.1/build/_bin/osx-arm64/AspectInjector

@pamidur
Copy link
Owner

pamidur commented Feb 1, 2023

We produce osx-arm64 binary but I don't see any code that would detect running on M1

<PublishForRuntimes>win-x64;win-arm64;linux-x64;linux-musl-x64;linux-arm64;linux-musl-arm64;osx-x64;osx-arm64</PublishForRuntimes>

I need to figure a reliable way to tell M1

@pamidur
Copy link
Owner

pamidur commented Feb 1, 2023

Please try https://www.nuget.org/packages/AspectInjector/2.8.2-pre1 once it is available

@omer-za
Copy link
Author

omer-za commented Feb 1, 2023

With 2.8.2-pre1 I get a different error now. it's now choosing osx-arm64 but seems like it crashes :(

/var/folders/0n/s94fzz_95vs9pf6g24m6s8ph0000gn/T/tmpc2d2ee754f1944c1b86c2cd7eb08d38a.exec.cmd: line 2:
2910 Killed: 9               "/Users/user/.nuget/packages/aspectinjector/2.8.2-pre1/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf 
"/Users/user/work/jenkins/workspace/automation-browser-ci-mac/ZA.Automation.Allure/obj/Debug/net6.0/ZA.Automation.Allure.dll._asi_refs" 
AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors.

@omer-za
Copy link
Author

omer-za commented Feb 1, 2023

Issue looks similar to here
dotnet/runtime#49091

@omer-za
Copy link
Author

omer-za commented Feb 1, 2023

From further look seems that Apple Silicon binaries should be signed in order to be executed
dotnet/runtime#48387

@omer-za
Copy link
Author

omer-za commented Feb 1, 2023

Confirmed, I executed
codesign -s - /Users/user/.nuget/packages/aspectinjector/2.8.2-pre1/buildTransitive/netstandard2.0/../../user/_bin/osx-arm64/AspectInjector and now it works.
It should be done as part of publishing using enableMacOSCodeSign

See
https://github.com/dotnet/runtime/pull/53913/files#diff-6c584433992a50f29902c96eace64f3fea5b04445aa3cb800d1e993c8b2f884cR41

@pamidur
Copy link
Owner

pamidur commented Feb 6, 2023

Did you use just selfsigned certificate?

@omer-za
Copy link
Author

omer-za commented Feb 7, 2023

yes, no special certificate provided

@pamidur
Copy link
Owner

pamidur commented Jun 8, 2023

Hi @omer-za ,
I'm sorry it took quite some time. Could you please see if 2.8.2-pre2 fixes the issue?
Thank you!

@pamidur pamidur added enhancement and removed bug labels Jun 8, 2023
@osherdp
Copy link

osherdp commented May 12, 2024

@pamidur issue still persists, even with 2.8.2-pre2

@pamidur
Copy link
Owner

pamidur commented May 12, 2024 via email

@osherdp
Copy link

osherdp commented May 12, 2024

Hi, I have figured the fix already, but wasn't able to implement it yet. Plus I'll need someone willing to test as I don't have a Mac.

On Sun, 12 May 2024, 21:34 Osher De Paz, @.> wrote: @pamidur https://github.com/pamidur issue still persists, even with 2.8.2-pre2 — Reply to this email directly, view it on GitHub <#210 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7HZUCF4OBMOIWZGRVOVRTZB4ZR3AVCNFSM6AAAAAAUNX5VTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGE4DINRTGQ . You are receiving this because you were mentioned.Message ID: @.>

I can help testing it, should be easy enough

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

3 participants