guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cross Compilation for armhf - libc (stdio.h) missing


From: Danny Milosavljevic
Subject: Cross Compilation for armhf - libc (stdio.h) missing
Date: Mon, 7 Nov 2016 11:12:33 +0100

Hello,

I'm trying to build the part of sunxi-tools that is target-specific for the 
target (2 tools).

However, I cannot get it to pick up armhf glibc.

What could be the cause?

I get:

arm-linux-gnueabihf-gcc -g -O0 -Wall -Wextra -std=c99 -Iinclude/ -static 
-D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -D__ARM_PCS_VFP -o 
sunxi-meminfo meminfo.c
meminfo.c:19:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
make: *** [Makefile:176: sunxi-meminfo] Error 1

And the patch in order to reproduce it is:

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 77432c4..9c24360 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -43,6 +43,7 @@
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
@@ -1862,45 +1863,54 @@ Kerberos and Heimdal and FAST is supported with recent 
MIT Kerberos.")
 
 ;;http://archives.eyrie.org/software/kerberos/pam-krb5-4.7.tar.xz
 
+;; FIXME 
https://github.com/linux-sunxi/sunxi-tools/commit/6cd51fe5474ad4e87ac1fcbadcf17487ef57bbaa
 (define-public sunxi-tools
-  (package
-    (name "sunxi-tools")
-    (version "1.4.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/linux-sunxi/";
-                           "sunxi-tools/archive/v" version ".tar.gz"))
-       (sha256
-        (base32 "06qd2b4dlzbmzfy4q9n8v5rkkbmgcfdbv4nkkcp4nysi10k7cpfs"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Remove binaries contained in the tarball which are only for the
-        ;; target and can be regenerated anyway.
-        '(delete-file-recursively "bin"))
-       (file-name (string-append name "-" version ".tar.gz"))))
-    (native-inputs
-     `(("pkg-config" ,pkg-config)))
-    (inputs
-     `(("libusb" ,libusb)))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:tests? #f ; no tests exist
-       #:make-flags (list (string-append "PREFIX="
-                                         (assoc-ref %outputs "out"))
-                          "CROSS_COMPILE="
-                          "CC=gcc"
-                          "all")
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (replace 'install
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (zero? (apply system* "make" "install-all" "install-misc"
-                           make-flags)))))))
-    (home-page "https://github.com/linux-sunxi/sunxi-tools";)
-    (synopsis "Hardware management tools for Allwinner computers")
-    (description "This package contains tools for Allwinner devices:
+  (let ((triplet "arm-linux-gnueabihf"))
+    (package
+      (name "sunxi-tools")
+      (version "1.4.1")
+      (source
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/linux-sunxi/";
+                             "sunxi-tools/archive/v" version ".tar.gz"))
+         (sha256
+          (base32 "06qd2b4dlzbmzfy4q9n8v5rkkbmgcfdbv4nkkcp4nysi10k7cpfs"))
+         (modules '((guix build utils)))
+         (snippet
+          ;; Remove binaries contained in the tarball which are only for the
+          ;; target and can be regenerated anyway.
+          '(delete-file-recursively "bin"))
+         (file-name (string-append name "-" version ".tar.gz"))))
+      (native-inputs
+       `(("pkg-config" ,pkg-config)
+         ("cross-gcc" ,(cross-gcc triplet
+                         (cross-binutils triplet)
+                         (cross-libc triplet)))
+         ;("cross-libc" ,(cross-libc triplet))
+))
+      (inputs
+       `(("libusb" ,libusb)))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ; no tests exist
+         #:make-flags (list (string-append "PREFIX="
+                                           (assoc-ref %outputs "out"))
+                            (string-append "CROSS_COMPILE="
+                                           ,triplet "-")
+                            (string-append "TARGET_CFLAGS=-g -O0 -Wall -Wextra 
-std=c99 -Iinclude/ -static -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE 
-D_DEFAULT_SOURCE")
+                            "CC=gcc"
+                            "all")
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'install
+             (lambda* (#:key make-flags #:allow-other-keys)
+               (zero? (apply system* "make" "install-all" "install-misc"
+                                     make-flags)))))))
+      (home-page "https://github.com/linux-sunxi/sunxi-tools";)
+      (synopsis "Hardware management tools for Allwinner computers")
+      (description "This package contains tools for Allwinner devices:
 @enumerate
 @item @command{sunxi-fexc}, @command{bin2fex}, @command{fex2bin}: Compile
 a textual description of a board (.fex) to a binary representation (.bin).
@@ -1915,4 +1925,4 @@ in order to be able to find it.
 @item @command{sunxi-meminfo}: Prints memory bus settings.
 @item @command{sunxi-nand-image-builder}: Prepares raw NAND images.
 @end enumerate")
-    (license license:gpl2+)))
+      (license license:gpl2+))))

Then just do 

$ guix build sunxi-tools

.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]