jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.13k stars 3.35k forks source link

Add RISC-V 64-bit release assets #10205

Open benz0li opened 1 week ago

benz0li commented 1 week ago

Describe your proposed improvement and the problem it solves.

Build releases for Linux/riscv64.

Describe alternatives you've considered.

- (There is none)

Related to:

benz0li commented 1 week ago

Building on a Apple M2 Max (i.e. with Docker Desktop on AArch64 under emulation with QEMU[^1]) using 8 cores takes about 4 hours:

[^1]: I have built within a Debian Linux/AArch64 VM using Docker CE

# Install emulator (Docker CE)
#docker run --privileged --rm tonistiigi/binfmt:master --install riscv64

# Install emulator (Docker Desktop)
docker run --privileged --rm tonistiigi/binfmt:desktop-master --install riscv64

# Set variables
export DOCKERIMAGE=quay.io/benz0li/ghc-musl:9.10.1-linux-riscv64
export GHCOPTS="-j8 +RTS -A256m -RTS -split-sections -optc-Os -optl=-pthread"
export CABALOPTS="-f-export-dynamic -fembed_data_files -fserver -flua --enable-executable-static -j8"
export REVISION=1

# Create linux package
docker run --rm --platform linux/riscv64 -v $PWD:/mnt -v $PWD/linux/artifacts:/artifacts -e REVISION -e CABALOPTS -e GHCOPTS -w /mnt --userns host --memory=0 $DOCKERIMAGE bash /mnt/linux/make_artifacts.sh 2>&1 > linux-riscv64.log

linux-riscv64.log


Warnings for different modules when building with GHC 9.10.1:

...
src/Text/Pandoc/Writers/HTML.hs:38:70: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘foldl'’ from module ‘Data.List’ is redundant
   |
38 | import Data.List (intercalate, intersperse, partition, delete, (\\), foldl')
   |                                                                      ^^^^^^

src/Text/Pandoc/Readers/HTML/Table.hs:23:1: warning: [GHC-66111] [-Wunused-imports]
    The import of ‘Data.List’ is redundant
      except perhaps to import instances from ‘Data.List’
    To import instances alone, use: import Data.List()
   |
23 | import Data.List (foldl')
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
...
benz0li commented 1 week ago

Unofficial and untested RISC-V 64-bit release assets for pandoc 3.4:

benz0li commented 1 week ago

@jgm As soon as there is a new release of GHC 9.10, I will add the linux/riscv64 image to the quay.io/benz0li/ghc-musl:9.10.1 GHC musl docker manifest.

ℹ️ pandoc builds just fine with both GHC v9.8.2 and GHC v9.10.1.

benz0li commented 1 week ago

The linux/riscv64 GHC musl image is built the same way as for the other os/archs.
❗ Please consider this image experimental. This architecture is not (yet) officially supported.

linux/riscv64 images are currently built only once. Therefore, vulnerabilities for this os/arch will not be fixed.

ℹ️ linux/riscv64 images will be added to the manifest, as soon as a new version of GHC is released – i.e. the image for the old version is frozen.

jgm commented 1 week ago

Can you say a bit about what RISC-V is and where and how much it is used?

benz0li commented 1 week ago

RISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles.

https://en.wikipedia.org/wiki/RISC-V

benz0li commented 1 week ago

From a data scientist’s perspective: RISC-V makes it possible to run open-source software on «open hardware».

My goal is to offer linux/riscv64 container images for all of b-data’s/my docker stacks: https://github.com/b-data

OS (Debian/Ubuntu) and programming languages (Python, R) are ready. The latest versions of tools like Git, Git LFS, etc. can be built on Linux/riscv64.

benz0li commented 1 week ago

IMHO RISC-V (64-bit) is the future, because it is an open and royalty free ISA: Open-source software ideally runs on «open hardware».

x86 (Intel, AMD) and Arm64 (Arm) ISA are neither open nor royalty free: https://en.wikipedia.org/wiki/Comparison_of_instruction_set_architectures

benz0li commented 1 week ago

It is not necessary that RISC-V 64-bit release assets be available immediately.

I just want this to be kept in mind.

jgm commented 1 week ago

OK, sure. I think it makes sense to wait until there is a real demand for these assets; at that point we could add them easily. But doing it prematurely just creates more work in a release.

benz0li commented 1 week ago

ℹ️ I may start building and releasing unofficial and untested RISC-V 64-bit release assets at https://gitlab.b-data.ch/jgm/pandoc/-/releases until official RISC-V 64-bit release assets are available.

jgm commented 1 week ago

That sounds great.