• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

CrcAppender on ARM Mac

Scheduled Pinned Locked Moved Solved
DSF Development
2
8
385
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Otso
    last edited by Otso 30 Oct 2023, 20:46

    I'm looking into building the firmware on an M2 Mac.

    https://github.com/Duet3D/RepRapFirmware/wiki/Building-RepRapFirmware says:

    Building RepRapFirmware lately requires a tool called crc32appender to be in the user's PATH as it will be called at the end of the compilating process. It can be found as Golang source code in Tools/crc32appender together with pre-compiled binaries for Windows, Linux and MacOS x86-64.

    Apparently this has been replaced with a dotnet version that is located here: https://github.com/Duet3D/CrcAppender so the documentation could be updated to indicate that newer firmwares use a different version and the location of the source code.

    I tried to run the Mac x86 version on my M2 Mac, and it executes using Rosetta, but I get the error:

    A fatal error occurred. The required library libhostfxr.dylib could not be found.
    If this is a self-contained application, that library should exist in [...RepRapFirmware/Tools/CrcAppender/macos-x86_64/].
    If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet].
    
    The .NET runtime can be found at:
      - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.14-x64&apphost_version=6.0.5
    

    Before I install dotnet, I just want to make sure, do I need to install it, or is the library libhostfxr.dylib available, or do I have some other problem?

    (A prebuilt native ARM binary would be nice, although Rosetta is fine, or then one can of course compile it oneself.)

    Edit: Reading https://github.com/Duet3D/CrcAppender, I see that it should be possible to make a standalone CrcAppender:

    dotnet publish -r osx-x64 -p:PublishSingleFile=true --self-contained false
    

    This will generate a standalone application without additional runtime files. See here for a full list of runtime identifiers.

    So is the binary in the 3.5-dev branch supposed to be standalone, but is not?

    Edit again:

    I know nothing about dotnet, but just reading about it I found this:

    Standalone Deployment:
    When you create a standalone deployment, your application relies on the presence of the .NET runtime on the target machine. It means the target machine must have the necessary version of the .NET runtime installed in order to run the application. This is similar to how traditional .NET Framework applications have functioned.

    Self-contained Deployment:
    In contrast, when you create a self-contained deployment, you package the .NET runtime and the libraries that your application needs along with your application. This allows your application to be deployed and run on machines that do not have the .NET runtime installed. Self-contained deployments are larger in size compared to standalone deployments, as they include the necessary components for the application to run independently.

    So apparently I need to install the .NET runtime. A self-contained binary would be really nice, but I'll go ahead install the x86 runtime for now. The requirement could be reflected in the building instructions.

    1 Reply Last reply Reply Quote 0
    • undefined Otso marked this topic as a question 30 Oct 2023, 20:47
    • undefined
      Otso
      last edited by 31 Oct 2023, 19:38

      This is not a problem for me personally anymore. I built an osx-arm64 CrcAppender for myself, and everything works now.

      1 Reply Last reply Reply Quote 0
      • undefined
        Otso
        last edited by Otso 30 Oct 2023, 21:54

        I should probably update the to the title to "Building on (Arm) Mac".

        Some additional minor documentation feedback https://github.com/Duet3D/RepRapFirmware/wiki/Building-RepRapFirmware for building on the Mac:

        • Step 5: When building newer firmwares one should also import CANlib and DuetWifiSocketServer to Eclipse
        • Step 6: To be fair, this step mentions with regards to the above:

        See the instructions for Windows (above), step 12, for the dependencies and configurations needed.

        but I believe the correct step is 11.

        undefined 1 Reply Last reply 31 Oct 2023, 00:25 Reply Quote 0
        • undefined
          droftarts administrators @Otso
          last edited by droftarts 31 Oct 2023, 00:25

          @Otso I updated the Mac instructions a little while ago, see https://forum.duet3d.com/post/317025
          I did have some problems with CrcAppender, but making it an executable and copying it to the system PATH fixed this. I didn't have to install .NET or compile it. From my post:

          I had problems getting Eclipse to recognise CrcAppender; Eclipse doesn’t use the system $PATH by default, and I couldn’t seem to add the path to it in Eclipse. I had to run Eclipse from the terminal for it to use the system path.

          I don't know if this was a bug in Eclipse, but this was the only way I could work around it, as outlined in steps 3 and 4 of the build instructions. Let me know if this solves your problem.

          I left CANlib and DuetWifiSocketServer out of step 5 as not all configurations need these, but it makes more sense to include them so I have updated that. Since I made changes last time, there have been edits that changed the number of steps in the Windows instructions. I have updated the text there, too.

          Thanks for pointing these out.

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          undefined 3 Replies Last reply 31 Oct 2023, 18:00 Reply Quote 0
          • undefined
            Otso @droftarts
            last edited by Otso 31 Oct 2023, 18:00

            @droftarts Thanks for your reply. I did step 3 and 4, and still get the same runtime error when building from Eclipse:

            19:52:46 **** Incremental Build of configuration Duet2 for project RepRapFirmware ****
            make -j9 all 
            Building target: Duet2CombinedFirmware.elf
            Invoking: Cross G++ Linker
            Finished building target: Duet2CombinedFirmware.elf
             
            Generating binary file
            arm-none-eabi-objcopy -O binary ".../RepRapFirmware/Duet2/Duet2CombinedFirmware.elf" ".../RepRapFirmware/Duet2/Duet2CombinedFirmware.bin" && CrcAppender ".../RepRapFirmware/Duet2/Duet2CombinedFirmware.bin"
            A fatal error occurred. The required library libhostfxr.dylib could not be found.
            If this is a self-contained application, that library should exist in [/usr/local/bin/].
            If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet].
            
            The .NET runtime can be found at:
              - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.14-x64&apphost_version=6.0.5
            make[1]: [post-build] Error 131 (ignored)
            

            Are you running on an Arm Mac? Are you sure you don't have the .NET framework installed (perhaps indirectly as a dependency from something else), or libhostfxr.dylib in your library path?

            Edit: The CrcAppender page says:

            In order to use the standalone files, the .NET Runtime must be installed.

            which seems to be true.

            undefined 1 Reply Last reply 1 Nov 2023, 01:24 Reply Quote 0
            • undefined
              Otso @droftarts
              last edited by 31 Oct 2023, 18:25

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • undefined
                Otso @droftarts
                last edited by 31 Oct 2023, 18:31

                @droftarts said in CrcAppender on ARM Mac:

                I don't know if this was a bug in Eclipse, but this was the only way I could work around it, as outlined in steps 3 and 4 of the build instructions. Let me know if this solves your problem.

                It's not a bug. /usr/local/bin is not in the PATH:
                Screenshot 2023-10-31 at 20.22.05.png
                If you add /usr/local/bin to the PATH here, then you don't have to start Eclipse from the terminal (to get the shell's PATH environment variable), and it will find CrcAppender.

                But, above when I got the error, I did exactly as instructed in step 3 and 4.

                1 Reply Last reply Reply Quote 0
                • undefined
                  Otso
                  last edited by 31 Oct 2023, 19:38

                  This is not a problem for me personally anymore. I built an osx-arm64 CrcAppender for myself, and everything works now.

                  1 Reply Last reply Reply Quote 0
                  • undefined Otso has marked this topic as solved 31 Oct 2023, 19:42
                  • undefined
                    droftarts administrators @Otso
                    last edited by droftarts 11 Jan 2023, 01:24 1 Nov 2023, 01:24

                    @Otso said in CrcAppender on ARM Mac:

                    Are you running on an Arm Mac? Are you sure you don't have the .NET framework installed (perhaps indirectly as a dependency from something else), or libhostfxr.dylib in your library path?

                    Yes, running on a 14" M2 MacBook Pro using MacOS Ventura. Though I did download the .NET Runtime, I didn't install it; if I run dotnet --list-sdks I get command not found: dotnet. I also got an error on libhostfxr.dylib, but I seem to have got around it another way. I didn't compile CrcAppender.

                    I'll check through the instructions when I get a chance, and see if I can work out why.

                    If you add /usr/local/bin to the PATH here, then you don't have to start Eclipse from the terminal (to get the shell's PATH environment variable), and it will find CrcAppender.

                    Thanks, I'll give that a go too.

                    Ian

                    Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                    1 Reply Last reply Reply Quote 0
                    2 out of 8
                    • First post
                      2/8
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA