Re: Debugging missing architecture support
Hi Ludo, > This shows an attempt to compile libwebp natively for aarch64-linux, > which fails on your machine. > > To cross compile, you would run: > > guix build python-jupyterlab --target=aarch64-linux-gnu That's already what I did, by giving the same option to "guix pack". I had someone check on a real ARM machine, and there libwebp compiles just fine. There seems to be some cross-compilation issues, for whatever reasons - this isn't my priority for now. I ended up tracking down all the issues with the container I was trying to produce, and in the end it's always ghc that prevents builds for aarch64-linux. Most frequently by having pandoc as a dependency. I'll have to take a closer look at Efraim's diff (thanks Efraim!), but I fear it's above my paygrade. Cheers, Konrad.
Re: Debugging missing architecture support
Hi Konrad, Konrad Hinsen skribis: > The problem in that case seems to be cross-compilation. The dependency > of python-jupyterlab that fails to build is libwebp, whose build log > says: > >@ unsupported-platform > /gnu/store/7fj9ckgxw27r196vkisc9cm3n8v9072x-libwebp-1.3.2.drv aarch64-linux >while setting up the build environment: a `aarch64-linux' is required to >build `/gnu/store/7fj9ckgxw27r196vkisc9cm3n8v9072x-libwebp-1.3.2.drv', This shows an attempt to compile libwebp natively for aarch64-linux, which fails on your machine. To cross compile, you would run: guix build python-jupyterlab --target=aarch64-linux-gnu … but I doubt this would succeed because that’s a huge pile of packages. Ludo’.
Re: Debugging missing architecture support
On Thu, Feb 15, 2024 at 11:29:55AM +0100, Konrad Hinsen wrote: > Hi Saku, > > > Maybe someone else can give more general or Guix specific advice on > > finding out the cause of such problems, but I believe that in this case > > the fix would just be packaging GHC for aarch64-linux. It should[1] be > > possible but it will require some work. > > > > [1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms > > Thanks for the pointer! It looks indeed like GHC already support > aarch64, so it's just a matter of integrating that support into Guix. > I'll see if I can find someone motivated and competent to do that. I've been carrying around this diff for a while but I don't think I'm currently ready to finish it off. It adds aarch64 and armhf bootstrap binaries for GHC and gets started on the path to building ghc-8.6 with them. -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index 62815efbb1..92ba976189 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -57,6 +57,7 @@ (define-module (gnu packages haskell) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) #:use-module (gnu packages lisp) + #:use-module (gnu packages llvm) #:use-module (gnu packages m4) #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) @@ -699,6 +852,24 @@ (define ghc-bootstrap-i686-7.8.4 (base32 "0wj5s435j0zgww70bj1d3f6wvnnpzlxwvwcyh2qv4qjq5z8j64kg" +(define ghc-bootstrap-armhf-8.2.2 + (origin +(method url-fetch) +(uri + "https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-armv7-deb8-linux.tar.xz;) +(sha256 + (base32 + "1jmv8qmnh5bn324fivbwdcaj55kvw7cb2zq9pafmlmv3qwwx7s46" + +(define ghc-bootstrap-aarch64-8.2.2 + (origin +(method url-fetch) +(uri + "https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-aarch64-deb8-linux.tar.xz;) +(sha256 + (base32 + "1k2amylcp1ad67c75h1pqf7czf9m0zj1i7hdc45ghjklnfq9hrk7" + ;; 43 tests out of 3965 fail. ;; ;; Most of them do not appear to be serious: @@ -1057,10 +1228,115 @@ (define-public ghc-8.4 (file-pattern ".*\\.conf\\.d$") (file-type 'directory)) +(define ghc-8.4-bootstrap + (package +(inherit ghc-8.4) +(name "ghc") +(version "8.4.4") +(supported-systems '("aarch64-linux" "armhf-linux")) +(native-inputs + `(;("clang" ,clang) + ("gcc:lib" ,gcc "lib") + ("ghc-bootstrap" ,(if (target-aarch64?) + ghc-bootstrap-aarch64-8.2.2 + ghc-bootstrap-armhf-8.2.2)) + ("llvm" ,llvm-9) + ("patchelf" ,patchelf) + ;("ld-wrapper" ,(@ (gnu packages commencement) ld-gold-wrapper)) ; for arm + ,@(filter (match-lambda + (("ghc-bootstrap" . _) #f) + (_ #t)) + (package-native-inputs ghc-8.4 +(arguments + (substitute-keyword-arguments (package-arguments ghc-8.4) + ((#:modules _ #~%gnu-build-system-modules) +'((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26) + (srfi srfi-1))) + ((#:phases phases) +#~(let* ((ghc-bootstrap-path + (string-append (getcwd) "/" #$name "-" #$version "/ghc-bin")) + (ghc-bootstrap-prefix + (string-append ghc-bootstrap-path "/usr"))) +(modify-phases #$phases + (add-after 'unpack 'unpack-bin +(lambda* (#:key inputs #:allow-other-keys) + (mkdir-p ghc-bootstrap-prefix) + (with-directory-excursion ghc-bootstrap-path +(invoke "tar" "xvf" (assoc-ref inputs "ghc-bootstrap") + (add-before 'configure 'install-bin +(lambda _ + (with-directory-excursion +(string-append ghc-bootstrap-path "/ghc-8.2.2") +(invoke "make" "install" + (add-before 'install-bin 'configure-bin +(lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((binaries + (list "ghc/stage2/build/tmp/ghc-stage2" + "iserv/stage2/build/tmp/ghc-iserv" + "iserv/stage2_dyn/build/tmp/ghc-iserv-dyn" + "iserv/stage2_p/build/tmp/ghc-iserv-prof" + "utils/ghc-cabal/dist-install/build/tmp/ghc-cabal" + "utils/ghc-pkg/dist-install/build/tmp/ghc-pkg" + ;"utils/haddock/dist/build/tmp/haddock" ; not on arm + "utils/hp2ps/dist/build/tmp/hp2ps" +
Re: Debugging missing architecture support
Hi Saku, > Maybe someone else can give more general or Guix specific advice on > finding out the cause of such problems, but I believe that in this case > the fix would just be packaging GHC for aarch64-linux. It should[1] be > possible but it will require some work. > > [1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms Thanks for the pointer! It looks indeed like GHC already support aarch64, so it's just a matter of integrating that support into Guix. I'll see if I can find someone motivated and competent to do that. Cheers, Konrad
Re: Debugging missing architecture support
Ricardo Wurmus writes: > You can try this in guix repl: > > --8<---cut here---start->8--- > (import (srfi srfi-1) > (guix packages) > (gnu packages)) > > (define p (specification->package "git-annex")) > (define deps (package-development-inputs p)) > (find (lambda (pkg) > (not (member "aarch64-linux" (package-supported-systems pkg > (map cadr deps)) > --8<---cut here---end--->8--- Thanks, that's very useful! I changed the last command to --8<---cut here---start->8--- (find (lambda (pkg) (and (package? pkg) (not (member "aarch64-linux" (package-supported-systems pkg) (map cadr deps)) --8<---cut here---end--->8--- because some packages have local files among the development inputs. This search doesn't work for all cases though. For "python-jupyterlab" (from the guix-science channel) it returns no problematic dependencies, and yet I cannot build the package for aarch64-linux. The problem in that case seems to be cross-compilation. The dependency of python-jupyterlab that fails to build is libwebp, whose build log says: @ unsupported-platform /gnu/store/7fj9ckgxw27r196vkisc9cm3n8v9072x-libwebp-1.3.2.drv aarch64-linux while setting up the build environment: a `aarch64-linux' is required to build `/gnu/store/7fj9ckgxw27r196vkisc9cm3n8v9072x-libwebp-1.3.2.drv', but I am a `x86_64-linux' Maybe this would build on an actual ARM64 machine. Cheers, Konrad.
Re: Debugging missing architecture support
Efraim Flashner writes: > As far as tracking back from git-annex to ghc to see that it's not > supported on aarch64, I'm not sure how you would find that information. You can try this in guix repl: --8<---cut here---start->8--- (import (srfi srfi-1) (guix packages) (gnu packages)) (define p (specification->package "git-annex")) (define deps (package-development-inputs p)) (find (lambda (pkg) (not (member "aarch64-linux" (package-supported-systems pkg (map cadr deps)) --8<---cut here---end--->8--- -- Ricardo
Re: Debugging missing architecture support
> in trying to build a Docker image for ARM64 (aarch64-linux), I am > hitting errors of the kind > > "package git-annex@10.20230926 does not support aarch64-linux" > > There doesn't seem to be anything specifically in the package > definitions that precludes building for aarch64-linux, so I suspect it's > either a dependency or the build system that lacks the required support. Git-annex uses the haskell-build-system which requires GHC, the only modern haskell compiler. Unfortunately GHC is only packaged for i686-linux and x86_64-linux in Guix. > How would I go about debugging such issues? Maybe the causes are simple > and I can fix them. But I don't even know where to start. Maybe someone else can give more general or Guix specific advice on finding out the cause of such problems, but I believe that in this case the fix would just be packaging GHC for aarch64-linux. It should[1] be possible but it will require some work. [1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms - Saku signature.asc Description: PGP signature
Re: Debugging missing architecture support
On Wed, Feb 14, 2024 at 02:26:46PM +0100, Konrad Hinsen wrote: > Hi Guix experts, > > in trying to build a Docker image for ARM64 (aarch64-linux), I am > hitting errors of the kind > > "package git-annex@10.20230926 does not support aarch64-linux" > > There doesn't seem to be anything specifically in the package > definitions that precludes building for aarch64-linux, so I suspect it's > either a dependency or the build system that lacks the required support. > > How would I go about debugging such issues? Maybe the causes are simple > and I can fix them. But I don't even know where to start. Currently GHC is only supported on i686 and x86_64. (use-modules (gnu packages)(guix packages)) (supported-package? (specification->package "git-annex")) $1 = ("x86_64-linux" "i686-linux") As far as tracking back from git-annex to ghc to see that it's not supported on aarch64, I'm not sure how you would find that information. -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted signature.asc Description: PGP signature
Debugging missing architecture support
Hi Guix experts, in trying to build a Docker image for ARM64 (aarch64-linux), I am hitting errors of the kind "package git-annex@10.20230926 does not support aarch64-linux" There doesn't seem to be anything specifically in the package definitions that precludes building for aarch64-linux, so I suspect it's either a dependency or the build system that lacks the required support. How would I go about debugging such issues? Maybe the causes are simple and I can fix them. But I don't even know where to start. Cheers, Konrad.