Skip to content

Running build.sh on the Raspberry Pi fails with "wrong ELF class: ELFCLASS64" #805

Closed

Description

@pgrawehr

Describe the bug
Running "./build.sh" from the working copy root on the Pi4 (Raspbian 32 Bit) fails with a bunch of errors of the form

/home/pi/.nuget/packages/microsoft.net.compilers.toolset/3.1.0-beta1-19127-06/tasks/netcoreapp2.1/Microsoft.CSharp.Core.targets(58,5): error : An error occurred while loading required library libhostpolicy.so from [/home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App/2.1.11] [/home/pi/projects/iot/src/System.Device.Gpio/System.Device.Gpio.csproj]
/home/pi/.nuget/packages/microsoft.net.compilers.toolset/3.1.0-beta1-19127-06/tasks/netcoreapp2.1/Microsoft.CSharp.Core.targets(58,5): error : Failed to load ��(, error: /home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App/2.1.11/libhostpolicy.so: wrong ELF class: ELFCLASS64 [/home/pi/projects/iot/src/devices/Units/Units.csproj]

The linux distribution installed on the Pi is 32 bit ARM, so this seems to use a wrong library.
Note: Running cd src/System.Device.Gpio && dotnet build System.Device.Gpio.sln works as expected.

Steps to reproduce
See above. Type

./build.sh

in the project root folder.

Expected behavior

Build finishes without errors.

Actual behavior

Build fails with exit code 1

Versions used

Built against these versions (but doesn't really seem to matter):

.NET Core SDKs installed:
  3.0.100 [/home/pi/projects/iot/.dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/home/pi/projects/iot/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.11 [/home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [/home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App]

Activity

  1. added
    bug
    on Oct 16, 2019
  2. pgrawehr commented on Oct 16, 2019

    @pgrawehr
    ContributorAuthor

    Here's the full build log:

    buildPi4.log

  3. added a commit that references this issue on Oct 16, 2019
  4. pgrawehr commented on Oct 16, 2019

    @pgrawehr
    ContributorAuthor

    Note: The unprintable characters are also unprintable here.

  5. krwq commented on Oct 16, 2019

    @krwq
    Member

    @pgrawehr can you print full output of <your IOT path>/.dotnet/dotnet --info? I'm specifically curious about Runtime Environment section.

  6. Frankenslag commented on Oct 17, 2019

    @Frankenslag
    Contributor

    I have seen the windows build do the same thing i.e. from build.cmd download the 64 bit toolset instead of the 32 and vice-versa. This causes a similar message about hostpolicy.

  7. pgrawehr commented on Oct 17, 2019

    @pgrawehr
    ContributorAuthor

    Here's the full printout:

    pi@raspberrypi:~/projects/iot $ .dotnet/dotnet --info
    .NET Core SDK (gemäß "global.json"):
     Version:   3.0.100
     Commit:    04339c3a26
    
    Laufzeitumgebung:
     OS Name:     raspbian
     OS Version:  10
     OS Platform: Linux
     RID:         linux-arm
     Base Path:   /home/pi/projects/iot/.dotnet/sdk/3.0.100/
    
    Host (useful for support):
      Version: 3.0.0
      Commit:  7d57652f33
    
    .NET Core SDKs installed:
      3.0.100 [/home/pi/projects/iot/.dotnet/sdk]
    
    .NET Core runtimes installed:
      Microsoft.AspNetCore.App 3.0.0 [/home/pi/projects/iot/.dotnet/shared/Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 2.1.11 [/home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App]
      Microsoft.NETCore.App 3.0.0 [/home/pi/projects/iot/.dotnet/shared/Microsoft.NETCore.App]
    
    To install additional .NET Core runtimes or SDKs:
      https://aka.ms/dotnet-download
    pi@raspberrypi:~/projects/iot $ 
    
    

    The runtime section doesn't mention ARM32 or ARM64, so maybe that's part of the problem?

  8. added this to the milestone on Oct 24, 2019
  9. Ellerbach commented on Dec 22, 2020

    @Ellerbach
    Member

    @pgrawehr is this fix now?

  10. pgrawehr commented on Dec 22, 2020

    @pgrawehr
    ContributorAuthor

    I need to test again. Last time I tried it failed with another error, IIRC.

  11. pgrawehr commented on Dec 26, 2020

    @pgrawehr
    ContributorAuthor

    Just tested again: The build works fine, it just has a small glitch: Running (some?) test cases fails, because the dotnet SDK 2.1 is not automatically installed into the build folder. After

    pi@raspberrypi:~/Downloads $ tar xzf dotnet-sdk-2.1.811-linux-arm.tar.gz -C ~/projects/iot4/.dotnet
    

    everything was green.

    So I'm closing this as fixed with a minor issue left.

  12. ghost locked as resolved and limited conversation to collaborators on Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-infrastructurebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions