unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cross Compilation for armhf - libc (stdio.h) missing
@ 2016-11-07 10:12 Danny Milosavljevic
  2016-11-08 12:42 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Danny Milosavljevic @ 2016-11-07 10:12 UTC (permalink / raw)
  To: guix-devel

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

.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Cross Compilation for armhf - libc (stdio.h) missing
  2016-11-07 10:12 Cross Compilation for armhf - libc (stdio.h) missing Danny Milosavljevic
@ 2016-11-08 12:42 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2016-11-08 12:42 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> 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.

You need to make sure CROSS_C_INCLUDE_PATH points to the target libc.

That happens automatically when doing a “regular” cross build, like
‘guix build --target=arm-linux-gnueabihf’, but here you may need to set
CROSS_C_INCLUDE_PATH by hand.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-08 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07 10:12 Cross Compilation for armhf - libc (stdio.h) missing Danny Milosavljevic
2016-11-08 12:42 ` Ludovic Courtès

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).