jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.7k stars 3.39k forks source link

Can you please create a native build for Windows ARM64? #10095

Open ArcticEnigma opened 3 months ago

ArcticEnigma commented 3 months ago

Describe your proposed improvement and the problem it solves.

Please add a distribution for Windows ARM64. With the massive change in the Surface product lineup as well as others from Samsung, HP, Lenovo, and Dell switching to the Snapdragon ARM CPUs and, in some cases, completely dumping Intel, it makes sense to add native support for the application for that fast-growing use base.

Can you please create a native build?

Describe alternatives you've considered.

It is a tribute to Qualcomm that a pretty efficient X86 emulator is available on ARM devices, but that comes at a cost in terms of memory, performance, and possible defects mainly due to broken dependencies, like drivers.

jgm commented 3 months ago

We create our binary builds on GitHub actions and cirrus-ci. I looked at whether a Windows arm64 build could be done on these platforms, and was a bit confused. I believe it isn't possible on GH actions at this point without paying for an enterprise account. Not sure about cirrus-ci. At the moment I don't have time to figure this out. If someone wants to do that and test a workflow for me, I'd consider adding windows-arm64.

ArcticEnigma commented 3 months ago

I asked ChatGPT how to do this and provided this result. Hope this can help make it easier.

To build binaries for Windows ARM64 using Cirrus CI in the pandoc GitHub project, you'll need to set up a CI configuration file that specifies the build environment and steps necessary to produce Windows ARM64 binaries. Here's how you can do it:

1. Setup Cirrus CI Configuration File (.cirrus.yml)

You will need to define a job in your .cirrus.yml configuration file that targets Windows ARM64. Cirrus CI provides support for building on Windows, and you can use a Windows ARM64 environment by specifying the appropriate os and cpu fields.

2. Example .cirrus.yml Configuration:

task:
  name: Build Windows ARM64 Binary
  os: windows
  cpu: arm64
  shell_script:
    - Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
    - ./build_script.ps1

3. PowerShell Script (build_script.ps1):

You will need to create a PowerShell script (build_script.ps1) that will handle the actual build process. The script might look like this:

# Install dependencies (if needed)
# e.g., choco install -y <dependencies>

# Set up the build environment
# (e.g., set environment variables, configure paths, etc.)

# Run the build command
# For example, if using a Makefile:
# make TARGET=windows-arm64

# Alternatively, you can invoke the compiler directly
# e.g., gcc -o pandoc.exe pandoc.c -marm64

# Copy or move the binary to an output directory
# e.g., Move-Item -Path "pandoc.exe" -Destination "output\pandoc-arm64.exe"

4. Handling Dependencies:

If your build process involves dependencies, make sure they are compatible with Windows ARM64. You might need to cross-compile some libraries or ensure they are available in the ARM64 architecture.

5. Testing:

After setting up the configuration, commit and push your .cirrus.yml and build_script.ps1 to your GitHub repository. Cirrus CI will pick up the configuration and start building the binaries for Windows ARM64.

6. Artifacts:

Ensure that the built binaries are stored as artifacts for later use or deployment. You can do this by adding the appropriate artifact storage commands to your .cirrus.yml or build_script.ps1.

7. Continuous Integration and Deployment:

If you want to include the Windows ARM64 build in your continuous integration workflow, ensure it is part of your regular CI process, so it gets built and tested with every commit.

By following these steps, you can leverage Cirrus CI to build Windows ARM64 binaries for the pandoc project.

jgm commented 2 months ago

This doesn't work (unsurprisingly).

Some experiments in the windows-arm64 branch.

ArcticEnigma commented 2 months ago

I have contacted Cirrus support for guidance on this issue. The commit provided shows the error message.

Cirrus CI / Build Parsing Results .cirrus.yml#L78 task has no instance or container attached, consult the documentation to find all possible execution environment types

I have spent some time reviewing the documentation, particularly on identifying the correct container. I truly appreciate your ongoing efforts and the support you have provided so far. Your assistance means a lot to me. I will continue to search for more information.

jgm commented 2 months ago

That was just the first try. I added a container and then the problem was something different. (The build succeeded without an error message, but did nothing.) See subsequent runs.