actions / runner-images

GitHub Actions runner images
MIT License
10.12k stars 3.05k forks source link

Rust build on `windows-latest` host fails -> failed to run custom build command for openssl-sys v0.9.103 #10379

Closed dlozina-macrometa closed 1 month ago

dlozina-macrometa commented 2 months ago

Description

Hi all,

I am not able to build our Rust project on windows-latest host. The same project has been build on macos-latest and ubuntu-latest without an issue. I can't share the public link to a failed action since we are an enterprise customer, but I can share the workflow link. Exact workflow. Our issue is that our Rust dependency needs Pearl modules that are available on other runners by default. During the build we get this issue: Compiling openvino v0.5.0 error: failed to run custom build command for openssl-sys v0.9.103

Caused by: process didn't exit successfully: D:\a\photoniq-faas-cli\photoniq-faas-cli\target\release\build\openssl-sys-[368](https://github.com/Macrometacorp/photoniq-faas-cli/actions/runs/10186069283/job/28177039168#step:17:369)6cb497dc4e15c\build-script-main (exit code: 101) --- stdout cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO")) cargo:rustc-check-cfg=cfg(openssl)

More info on the issue: OPENSSL_CONFIG_DIR unset running "perl" "./Configure" "--prefix=D:/a/photoniq-faas-cli/photoniq-faas-cli/target/x86_64-pc-windows-msvc/release/build/openssl-sys-ea34f819041c5cff/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-capieng" "no-asm" "VC-WIN64A"

--- stderr Can't locate Locale/Maketext/Simple.pm in @INC (you may need to install the Locale::Maketext::Simple module)

I am trying to install Pear modules as it can be seen from the workflow: - name: Install Scoop and dependencies (Windows) if: matrix.settings.host == 'windows-latest' shell: powershell run: | iwr -useb get.scoop.sh | iex scoop install perl scoop install openssl But this does not work. I have tried multiple solutions found on the web for example: Issue 8344 but no luck 🥲 Can you please help me and share a workaround for this issue? Thanks! Dino

Platforms affected

Runner images affected

Image version and build link

Current runner version: '2.317.0' Operating System Microsoft Windows Server 2022 10.0.20348 Datacenter Runner Image Image: windows-2022 Version: 20240721.1.0 Included Software: https://github.com/actions/runner-images/blob/win22/20240721.1/images/windows/Windows2022-Readme.md Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20240721.1 Runner Image Provisioner 2.0.373.1

Is it regression?

No

Expected behavior

We should be able to build Rust project on windows-latest host.

Actual behavior

We can't build our Rust project.

Repro steps

  1. Step: Create a simple Rust project
  2. Step: Add openvino v0.5.0 dependency Openvino
  3. Step: Build Rust project with windows-latest host
vidyasagarnimmagaddi commented 2 months ago

Hi @dlozina-macrometa , We will be analysing and provide you a solution. Thanks

dlozina-macrometa commented 2 months ago

Thank you @vidyasagarnimmagaddi !

vidyasagarnimmagaddi commented 2 months ago

Hi @dlozina-macrometa , could you please try to include these steps after installing openssl and perl , try to install below mentioned, and provide the logs or workflow if error persists.


# Install Perl modules via CPAN
 perl -MCPAN -e "install Locale::Maketext::Simple"
 perl -MCPAN -e "install Module::Build" # Add other modules if needed
dlozina-macrometa commented 2 months ago

Hi @vidyasagarnimmagaddi, thank you for your fast response. We have changed the action step to: - name: Install Scoop and dependencies (Windows) if: matrix.settings.host == 'windows-latest' shell: powershell run: | iwr -useb get.scoop.sh | iex scoop install perl scoop install openssl perl -MCPAN -e "install Locale::Maketext::Simple" perl -MCPAN -e "install Module::Build"

But we still have an issue, now on the step above. In the attachment, you will find logs of the action. logs_26735443887.zip

vidyasagarnimmagaddi commented 2 months ago

Hi @dlozina-macrometa , we will provide the solution , after analysing . thanks

vidyasagarnimmagaddi commented 2 months ago

hi @dlozina-macrometa

kindly try this workaround


  build:
    runs-on: windows-latest
    strategy:
      matrix:
        settings:
          host: [windows-latest, macos-latest, ubuntu-latest]
    steps:
    - uses: actions/checkout@v2
    # Install Scoop (Windows Package Manager)
    - name: Install Scoop and dependencies (Windows)
      if: matrix.settings.host == 'windows-latest'
      shell: powershell
      run: |
        iwr -useb get.scoop.sh | iex
        scoop install perl
        scoop install openssl
    # Install cpanminus (cpanm) for easier module installation
    - name: Install cpanminus
      if: matrix.settings.host == 'windows-latest'
      shell: powershell
      run: |
        cpan App::cpanminus
    # Install required Perl modules using cpanminus
    - name: Install Perl Modules
      if: matrix.settings.host == 'windows-latest'
      shell: powershell
      run: |
        cpanm Locale::Maketext::Simple
        cpanm Module::Build
    # Build the Rust project
    - name: Build Project
      run: cargo build --release
      env:
        OPENSSL_DIR: D:\a\photoniq-faas-cli\photoniq-faas-cli\target\x86_64-pc-windows-msvc\release\build\openssl-sys-ea34f819041c5cff\out\openssl-build

    ---
    you can add steps to print out diagnostic information:
- name: Print Perl Version and Modules
  if: matrix.settings.host == 'windows-latest'
  shell: powershell
  run: |
    perl -v
    perl -Mlocal::lib
    perl -MCPAN -e "print CPAN::Config->dump"
    cpanm -v
    cpanm --info Locale::Maketext::Simple
    cpanm --info Module::Build

These steps will print the Perl version, local library paths, CPAN configuration, and detailed information about the installed modules
vidyasagarnimmagaddi commented 2 months ago

Hi @dlozina-macrometa , any updates on the above the workaround .thanks

dlozina-macrometa commented 2 months ago

Hi @vidyasagarnimmagaddi, thank you and the team for help. I have implemented all the necessary steps for a workaround. But we still have an issue. From the workflow logs we can see that modules are installed, everything that you have suggested looks good. Than again we still have:


error: failed to run custom build command for openssl-sys v0.9.103 Caused by: process didn't exit successfully: D:\a\photoniq-faas-cli\photoniq-faas-cli\target\release\build\openssl-sys-b6da55e0c9a0ca3b\build-script-main (exit code: 101) --- stdout cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO"))

running "perl" "./Configure" "--prefix=D:/a/photoniq-faas-cli/photoniq-faas-cli/target/x86_64-pc-windows-gnu/release/build/openssl-sys-3e8f17fc2713d7fd/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-capieng" "mingw64" "-O2" "-ffunction-sections" "-fdata-sections" "-m64" "-Wa,-mbig-obj" --- stderr Can't locate Locale/Maketext/Simple.pm in @INC (you may need to install the Locale::Maketext::Simple module) (@INC entries checked: /d/a/photoniq-faas-cli/photoniq-faas-cli/target/x86_64-pc-windows-gnu/release/build/openssl-sys-3e8f17fc2713d7fd/out/openssl-build/build/src/util/perl /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /d/a/photoniq-faas-cli/photoniq-faas-cli/target/x86_64-pc-windows-gnu/release/build/openssl-sys-3e8f17fc2713d7fd/out/openssl-build/build/src/external/perl/Text-Template-1.56/lib) at /usr/share/perl5/core_perl/Params/Check.pm line 6.


Maybe I did not understand the env variable part: env: OPENSSL_DIR: D:\a\photoniq-faas-cli\photoniq-faas-cli\target\x86_64-pc-windows-msvc\release\build\openssl-sys-ea34f819041c5cff\out\openssl-build Are we sure that this part ea34f819041c5cff of the path above does not change?

In the workflow I have attached the error reveals a different path created, so I have change the path of env accordingly to: OPENSSL_DIR: D:\a\photoniq-faas-cli\photoniq-faas-cli\target\x86_64-pc-windows-msvc\release\build\openssl-sys-3e8f17fc2713d7fd\out\openssl-build

I think we are close @vidyasagarnimmagadd, can you please take a look at the logs and see why we still have issue please?

logs_27484205216.zip

vidyasagarnimmagaddi commented 2 months ago

Hi @dlozina-macrometa
The issue seems to be related to the path of the OpenSSL build directory changing between different runs, causing the environment variable OPENSSL_DIR to point to an incorrect path. This can happen because the build script generates a new unique directory each time it runs. To address this, you can modify the workflow to dynamically set the OPENSSL_DIR environment variable to the correct path after it is created during the build process. :please check this workaround and add the provided logic in your workflow . revert if any issues.


name: Rust Build on Windows

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build-windows:
    runs-on: windows-latest

    steps:
      - name: Check out the code
        uses: actions/checkout@v4

      - name: Set up Rust
        uses: actions/setup-rust@v2
        with:
          rust-version: stable

      - name: Install Scoop and dependencies
        shell: powershell
        run: |
          iwr -useb get.scoop.sh | iex
          scoop install perl
          scoop install openssl

      - name: Install Perl CPAN modules
        shell: bash
        run: |
          cpanm Locale::Maketext::Simple

      - name: Build the Rust project (first attempt to capture OpenSSL path)
        id: build-attempt
        run: cargo build --release || true  # Allow failure to capture path

      - name: Set OPENSSL_DIR based on dynamic build path
        run: |
          OPENSSL_DIR=$(find target -type d -name 'openssl-sys-*' -print -quit)/out/openssl-build
          echo "OPENSSL_DIR=$OPENSSL_DIR" >> $GITHUB_ENV

      - name: Build the Rust project (final build with correct OPENSSL_DIR)
        run: cargo build --release

      - name: Run tests
        run: cargo test --release
dlozina-macrometa commented 2 months ago

Hi @vidyasagarnimmagaddi , can you please take a look at the logs attached? Can you please verify if we are capturing the right path? The second build still fails even though we are capturing OPENSSL_DIR. logs_27586523327.zip

vidyasagarnimmagaddi commented 2 months ago

The log shows OPENSSL_DIR is set to target/release/.fingerprint/openssl-sys-d6e493f55d3aad6e/out/openssl-build, error with the OpenSSL configuration during the build of openssl-sys v0.9.103.

vidyasagarnimmagaddi commented 1 month ago

hi @dlozina-macrometa ,kindly try the above, Hope the issue resolves. We will be closing this issue. Thanks