Power Programming Languages

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power

 View Only

Cross and source build .NET 9 on Ubuntu for IBM Power

By Ashwini Kadam posted Fri August 08, 2025 08:24 AM

  

Co-author: Swapnali Pawar

.NET is a free, open source language. You can use multiple languages, libraries, APIs along with .NET to develop web applications, mobile applications, games, and so on. .NET 9 offers high-level features and enhancements and delivers better performance without compromising on speed or reliability for open source platform.

The .NET 9 installer generated by source code cannot be directly compiled on IBM Power to generate software development kit (SDK), as the compiler code itself is in C#. So, we must first cross build all the required repositories and generate the .NET SDK installer for Power on an x86 system. After that the generated installer can be installed on a virtual machine (VM) in IBM Power for development.

In our previous blog, Cross and source build .NET 8 on Ubuntu for IBM Power, we provided step-by-step guidance on cross building .NET 8 on x86 Ubuntu for IBM Power, followed by source building on the VM in IBM Power. Continuing with the same approach, this blog provides instructions for cross building .NET 9 on x86 Ubuntu for IBM Power.

Prerequisite

As a prerequisite to create ppc64le cross build SDK, make sure that you have the x86 RHEL or the Fedora VM.

Steps to create a cross build SDK

You need to perform the following steps to create a cross build SDK.

Step 1. Cross build .NET repositories to generate the .NET installer for Power

  1. Copy the following scripts to your x86 virtual machine (VM) from this GitHub repository (https://github.com/ppc64le/build-scripts/tree/master/d/dotnet9) It includes all the dependencies that are required to cross build. The script uses an Ubuntu container, so you need a container file that includes the required dependencies for the container image.
    The script uses the dotnet/dotnet repository to create a cross build SDK. This repository is a Virtual Monolithic Repository (VMR) which includes all the source code and infrastructure needed to build the .NET SDK.
  2. Run the following commands to create the installer.
    • chmod +x <filename>
      (change to executable permission of all above files copied in X86 VM)
    • bash <path/of/cross-build-with-container.sh > --containerfile <path/of/vmr.cross.Containerfile>  --cross-arch ppc64le --ref v9.0.0

    Note: Place the sources.list file at the same location where you have the above files.

    After your build is successful you can see the dotnet-sdk-9.0.100-linux-ppc64le.tar.gz file with runtime-specific packages in the output folder as follows:

    In the output directory (path: workdir/dotnet/artifacts/assets/Release) you can find the following folders and files:
    • Runtime
    • aspnetcore
    • Sdk
    • dotnet-sdk-9.0.100-linux-ppc64le.tar.gz
    • dotnet-symbols-all-9.0.100-rtm.24529.1-linux-ppc64le.tar.gz
    • dotnet-symbols-sdk-9.0.100-rtm.24529.1-linux-ppc64le.tar.gz
    • Private.SourceBuilt.Artifacts.9.0.100-rtm.24529.1.linux-ppc64le.tar.gz
  3. Copy the dotnet-sdk-9.0.100-linux-ppc64le.tar.gz file to the Power system where you want to install it.

Step 2. Install the .NET installer file on the Power VM with Ubuntu version 22.04

  1. On the PowerVM, navigate to the directory where you have copied the installer that you generated on the x86 system.
  2. Create a subfolder named .dotnet, set the DOTNET_ROOT environment variable, and extract the SDK installer into the DOTNET_ROOT folder.
    DOTNET_FILE=dotnet-sdk-9.0.100-linux-ppc64le.tar.gz
    mkdir -p.dotnet
    export DOTNET_ROOT=$(pwd)/.dotnet 
    tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"

  3. Add DOTNET_ROOT folder in PATH as shown below.
    export PATH=$PATH:$DOTNET_ROOT

  4. To verify if the dotnet is installed, run the following command:
    dotnet –info
    Your output should look as follows:  
    # dotnet --info
    
    .NET SDK:
     Version:           9.0.100 
     Commit:            a2bc464e40 
     Workload version:  9.0.100-manifests.6bf02610 
     MSBuild version:   17.12.7+a2bc464e4
    
    Runtime Environment: 
     OS Name:     ubuntu 
     OS Version:  22.04 
     OS Platform: Linux 
     RID:         linux-ppc64le 
     Base Path:   /home/ubuntu/.dotnet/sdk/9.0.100/
    
    .NET workloads installed: 
    There are no installed workloads to display. 
    Configured to use loose manifests when installing new manifests.
    
    Host: 
      Version:      9.0.0 
      Architecture: ppc64le 
      Commit:       a2bc464e40 
     
    .NET SDKs installed: 
      9.0.100 [/home/ubuntu/.dotnet/sdk]
    
    .NET runtimes installed: 
      Microsoft.AspNetCore.App 9.0.0 [/home/ubuntu/.dotnet/shared/Microsoft.AspNetCore.App] 
      Microsoft.NETCore.App 9.0.0 [/home/ubuntu/.dotnet/shared/Microsoft.NETCore.App] 
     
    Other architectures found: 
      None 
     
    Environment variables: 
      DOTNET_ROOT       [/home/ubuntu/.dotnet]
    
    global.json file:
      Not found 
     
    Learn more: 
      https://aka.ms/dotnet/info
     
    Download .NET: 
      https://aka.ms/dotnet/download

Step 3. Run the Hello World program on the PowerVM with Ubuntu version 22.04

  1. Create a Hello World console application using the dotnet new console command.
    mkdir HelloWorld 
    cd HelloWorld 
    dotnet new console
    Your output should look as below.
    Welcome to .NET 9.0! 
    --------------------- 
    SDK Version: 9.0.100 
     
    ---------------- 
    Installed an ASP.NET Core HTTPS development certificate. 
    To trust the certificate, run 'dotnet dev-certs https --trust' 
    Learn about HTTPS: https://aka.ms/dotnet-https 
     
    ---------------- 
    Write your first app: https://aka.ms/dotnet-hello-world 
    Find out what's new: https://aka.ms/dotnet-whats-new 
    Explore documentation: https://aka.ms/dotnet-docs 
    Report issues and find source on GitHub: https://github.com/dotnet/core 
    Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli 
    -------------------------------------------------------------------------------------- 
    The template "Console App" was created successfully. 
     
    Processing post-creation actions... 
    Restoring /home/ubuntu/HelloWorld/HelloWorld.csproj: 
    Restore succeeded.

  2. Build and run the Hello World app using the dotnet build and the dotnet run commands.
    dotnet build 
    dotnet run
    Your output should look as below.
    ~/HelloWorld$ dotnet build 
    Restore complete (1.5s) 
    HelloWorld succeeded (0.5s) → bin/Debug/net9.0/HelloWorld.dll 
    Build succeeded in 3.7s 
    ~/HelloWorld$ dotnet run 
    Hello, World!
    Note: For the purpose of this blog, we have tested these scripts on Ubuntu version 22.04. However, they should work as expected on Ubuntu version 20.04 as well.
     
    Now, let us see how to create the source build SDK using the cross-build SDK generated above.

Step 4. Source build the .NET repositories to generate SDK for Power on Ubuntu.

  1. Ensure that you have copied the generated SDK .tar file and the package file (Private.SourceBuilt.Artifacts.9.0.100-rtm.24529.1.linux-ppc64le.tar.gz) from the generated cross build SDK folder (Refer to the output folder on the x86 Ubuntu machine: workdir/dotnet/artifacts/assets/Release) to your Power virtual machine on Ubuntu.
  2. To create source build SDK, use the same dotnet/dotnet repository, a VMR that includes all the source code and infrastructure needed to build the .NET SDK. (https://github.com/dotnet/dotnet).
  3. Install the essential dependencies required for compiling .NET from its source code before you run the source build. Run the following script to install dependencies for the source build:
    apt-get install clang cmake findutils git libc-dev hostname krb5-multidev libicu-dev liblttng-ust-dev llvm make libssl-dev python3 zlib1g-dev libbrotli-dev  
    apt-get install -y locales 
    locale-gen en_US.UTF-8

  4. Clone the dotnet-dotnet repository using the following commands:
    git clone https://github.com/dotnet/dotnet.git 
    cd dotnet

  5. Check out the specific release branch using the following commands:

    Note: As we are creating .NET 9 builds, we need to check out the .NET 9 tag/release branch.
    git checkout release/9.0.1x 
    cd ..(out of dotnet folder)

  6. Apply a patch to disable the AppHost module for the ppc64le architecture, as .NET 6 is not supported on this platform.
    sed -i -E 's|</OutputType>|</OutputType><UseAppHost>false</UseAppHost>|' src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj 
     
    sed -i -E 's|</OutputType>|</OutputType><UseAppHost>false</UseAppHost>|' src/vstest/test/Intent/Intent.csproj

  7. Create new directories using the following command:
    mkdir new_packages new_tarball

  8. Extract the source build SDK archive and the artifacts archive into a folder within the 'packages' directory (you can name this folder as needed).
    tar -xf dotnet-sdk-9.0.100-linux-ppc64le.tar.gz -C tarball 
    tar -xf Private.SourceBuilt.Artifacts.9.0.100-rtm.24529.1.linux-ppc64le.tar.gz -C packages

  9. Navigate to the dotnet repository folder and run the following build command:
    ./build.sh --with-system-libs +brotli++zlib+ --with-sdk /root/tarball --with-packages /root/packages --source-only --use-mono-runtime
    Note: If you are building from a specific tag, utilize the cross-built installer from the previous tag. On the other hand, if you are working with a branch, use the most recent version available.

    The resulting SDK can be located at 
    artifacts/ppc64le/Release/dotnet-sdk-9.0.100-your-RID.tar.gz

Summary

With numerous features and improvements, .NET 9 offers a richer experience to develop applications. By installing the .NET 9 installer on a Power VM, developers can leverage .NET for their development needs. Do let us know if you found these instructions on cross building .NET 9 on x86 for IBM Power architecture helpful.


#OpenSourceLanguagesforPower
0 comments
15 views

Permalink