unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: guix-devel@gnu.org
Subject: Cross Compilation for armhf - libc (stdio.h) missing
Date: Mon, 7 Nov 2016 11:12:33 +0100	[thread overview]
Message-ID: <20161107111233.6e2b6503@scratchpost.org> (raw)

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	other threads:[~2016-11-07 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 10:12 Danny Milosavljevic [this message]
2016-11-08 12:42 ` Cross Compilation for armhf - libc (stdio.h) missing Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161107111233.6e2b6503@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).