Gentoo Archives: gentoo-embedded

From: "Сергей Миронов" <ierton@×××××.com>
To: gentoo-embedded@l.g.o
Cc: jlpoole@×××.net
Subject: Re: [gentoo-embedded] Clarification of 5.e Embedded Handbook
Date: Sun, 07 Jun 2009 19:12:30
Message-Id: aa09d86e0906071212u6c839660s450a54ce11aa9db8@mail.gmail.com
In Reply to: [gentoo-embedded] Clarification of 5.e Embedded Handbook by John Poole
1 2009/6/7 John Poole <jlpoole@×××.net>:
2 > I'm trying to install a cross compiler on my AMD64 for arm (SheevaPlug) and
3 > have been following your Gentoo Embedded Handbook at
4 > http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml
5 >
6 > I do not fully understand Chapter 5 "Cross-Compiling with Portage",
7 > specifically the section 5.e on "Helper: pkg-config".
8 >
9 > The instructions state:
10 >
11 > vvvvvvvvvvvv
12 >
13 > Many packages are moving to installing pkg-config files (*.pc) and using
14 > those to discover needed libraries and includes. To ease the build process,
15 > you should install a pkg-config wrapper for your target which will tell
16 > pkg-config to only search your cross-compiler paths rather than your host
17 > paths.
18 >
19 > You should install this into your PATH so that configure scripts will detect
20 > it properly. Name it with a CTARGET prefix and the script will do the rest.
21 > In other words, if your CTARGET is set to arm-linux-uclibc, the canonical
22 > name is arm-linux-uclibc-pkg-config. Older configure scripts would only
23 > search for pkg-config, so in those cases you will need to export the
24 > PKG_CONFIG variable to the wrapper script.
25 > ^^^^^^^^^^^^^^
26 >
27 > So, I created a file arm-softfloat-linux-gnueabi-pkg-config and placed same
28 > under my directory "/usr/arm-softfloat-linux-gnueabi/etc".  The contents of
29 > the file were copied form the web page, to wit:
30 >
31 > vvvvvvvvvvvvvvv
32 >
33 > #!/bin/sh
34 > CTARGET=${0%-pkg-config}
35 > SYSROOT="/usr/${CTARGET}"
36 > export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig"
37 > unset PKG_CONFIG_PATH PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
38 > PKG_CONFIG_ALLOW_SYSTEM_LIBS
39 > exec pkg-config "$@"
40 >
41 >
42 > ^^^^^^^^^^^^^^^
43 > What I am not understanding is the instruction "install this into your
44 > PATH".  My current PATH is:
45 >
46 > hermes etc # echo $PATH
47 > /sbin:/bin:/usr/sbin:/usr/bin
48 > hermes etc #
49 >
50 >  For the time that I would be cross-compiling and/or setting up this tool
51 > chain, should I add the directory where this file is to my path as in:
52 >
53 >  hermes etc # export PATH=$PATH:/usr/arm-softfloat-linux-gnueabi/etc
54 >
55 > or include the file directory in my path (as in a Java Jar)
56 >
57 >  hermes etc # export
58 > PATH=$PATH:/usr/arm-softfloat-linux-gnueabi/etc/arm-softfloat-linux-gnueabi-pkg-config
59 >
60 > What brings me to you is that the emerge of sys-apps/coreutils-7.1 failed,
61 > and it looks like a directory/location issue; here is the error message:
62 >
63 > vvvvvvvvvvvvv
64 > * The specific snippet of code:
65 > *           mv ${fhs} ../../bin/ || die "could not move fhs bins";
66 > *  The die message:
67 > *   could not move fhs bins
68 > ^^^^^^^^^^^
69 > The ebuild section the die statement comes from is:
70 >
71 > vvvvvvvvvvvvvvvvvv
72 > src_install() {
73 >      emake install DESTDIR="${D}" || die
74 >      dodoc AUTHORS ChangeLog* NEWS README* THANKS TODO
75 >
76 >      insinto /etc
77 >      newins src/dircolors.hin DIR_COLORS || die
78 >
79 >      if [[ ${USERLAND} == "GNU" ]] ; then
80 >              cd "${D}"/usr/bin
81 >              dodir /bin
82 >              # move critical binaries into /bin (required by FHS)
83 >              local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
84 >                         mkdir mknod mv pwd rm rmdir stty sync true uname"
85 >              mv ${fhs} ../../bin/ || die "could not move fhs bins"
86 >              # move critical binaries into /bin (common scripts)
87 >              local com="basename chroot cut dir dirname du env expr head
88 > mkfifo
89 >                         mktemp readlink seq sleep sort tail touch tr tty
90 > vdir wc yes"
91 >              mv ${com} ../../bin/ || die "could not move common bins"
92 >              # create a symlink for uname in /usr/bin/ since autotools
93 > require it
94 >              local x
95 >              for x in ${com} uname ; do
96 >                      dosym /bin/${x} /usr/bin/${x} || die
97 >              done
98 >      else
99 >              # For now, drop the man pages, collides with the ones of the
100 > system.
101 >              rm -rf "${D}"/usr/share/man
102 >      fi
103 > }
104 >
105 > ^^^^^^^^^^^^^^^^^^
106 >
107 > I'm guessing I do not have my environment set correctly and I have not
108 > harnessed the functionality of the helping pkg-config script.
109 >
110 > Note, the word "PATH", as capitalized, appears for the first time in section
111 > 5.e, so I'm guessing it has a special meaning or is referencing the
112 > environmental variable "PATH"?
113 >
114 > I also made a copy of arm-softfloat-linux-gnueabi-pkg-config under the
115 > SYSROOT directory of "/usr/arm-softfloat-linux-gnueabi", that didn't change
116 > the die outcome of a sysapps/coreutils-7.1 emerge.
117 >
118 > Where do I place the file arm-softfloat-linux-gnueabi-pkg-config and how
119 > should an addition to my PATH variable read?
120 >
121 > Thank you for your time.
122 >
123 > John Poole
124 >
125 >
126
127 Hmm, i used to save this script into my host system's
128 /usr/local/bin/arm-softfloat-linux-gnueabi, BUT
129
130 It seems, that Gentoo Embedded habdbook is quite old, and now there is
131 now need to write xmerge and friends by hand.
132 There is nasty libtool bug during crosscompiling and handbook says
133 nothing about it.
134 Use emerge crossdev-wrappers.
135
136 All steps are described here quite well:
137 http://gentoo.mindzoo.de/index.cgi/wiki/cross-compiling
138
139 --
140 Thanks
141 Sergey.