aspect-injector icon indicating copy to clipboard operation
aspect-injector copied to clipboard

Lack of M1 support when rosetta isn't installed

Open omer-za opened this issue 2 years ago • 14 comments

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 avatar Feb 01 '23 13:02 omer-za

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

omer-za avatar Feb 01 '23 13:02 omer-za

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 avatar Feb 01 '23 14:02 pamidur

We produce osx-arm64 binary but I don't see any code that would detect running on M1 https://github.com/pamidur/aspect-injector/blob/fbd25b9dcf8104d1a87b31cb8179c73d66e8db59/nuget/AspectInjector.Package.csproj#L35

I need to figure a reliable way to tell M1

pamidur avatar Feb 01 '23 14:02 pamidur

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

pamidur avatar Feb 01 '23 15:02 pamidur

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 avatar Feb 01 '23 19:02 omer-za

Issue looks similar to here https://github.com/dotnet/runtime/issues/49091

omer-za avatar Feb 01 '23 19:02 omer-za

From further look seems that Apple Silicon binaries should be signed in order to be executed https://github.com/dotnet/runtime/issues/48387

omer-za avatar Feb 01 '23 19:02 omer-za

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

omer-za avatar Feb 01 '23 19:02 omer-za

Did you use just selfsigned certificate?

pamidur avatar Feb 06 '23 12:02 pamidur

yes, no special certificate provided

omer-za avatar Feb 07 '23 12:02 omer-za

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 avatar Jun 08 '23 04:06 pamidur

@pamidur issue still persists, even with 2.8.2-pre2

osherdp avatar May 12 '24 09:05 osherdp

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 https://github.com/pamidur/aspect-injector/issues/210#issuecomment-2106184634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7HZUCF4OBMOIWZGRVOVRTZB4ZR3AVCNFSM6AAAAAAUNX5VTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGE4DINRTGQ . You are receiving this because you were mentioned.Message ID: @.***>

pamidur avatar May 12 '24 11:05 pamidur

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

osherdp avatar May 12 '24 11:05 osherdp