Gentoo Archives: gentoo-embedded

From: Ryan Baldwin <ryan.baldwin@××××××××××.com>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] Problem cross compiling modular X
Date: Thu, 06 Jul 2006 11:08:58
Message-Id: 000101c6a0ec$0ca2f510$1a06a8c0@LXP0004
1 Hi,
2
3 I have been trying to develop an embedded system using gentoo that can be
4 cross compiled. I have succeeded in building a busybox/uclibc based system
5 and PXE booting. I am now trying to emerge xorg-server but get the following
6 error:
7
8 ./include/X11/Xauth.h:48:31: X11/Xfuncproto.h: No such file or
9 directory
10 ./include/X11/Xauth.h:49:27: X11/Xfuncs.h: No such file or directory
11 In file included from AuDispose.c:33:
12 ./include/X11/Xauth.h:62: error: syntax error before "char"
13 ./include/X11/Xauth.h:69: error: syntax error before "char"
14 ./include/X11/Xauth.h:73: warning: function declaration isn't a
15 prototype
16 ./include/X11/Xauth.h:76: error: syntax error before "char"
17 ./include/X11/Xauth.h:77: warning: function declaration isn't a
18 prototype
19 ./include/X11/Xauth.h:85: error: syntax error before "char"
20 ./include/X11/Xauth.h:86: warning: function declaration isn't a
21 prototype
22 ./include/X11/Xauth.h:96: error: syntax error before "_Xconst"
23 ./include/X11/Xauth.h:109: warning: function declaration isn't a
24 prototype
25 ./include/X11/Xauth.h:119: error: syntax error before "_Xconst"
26 ./include/X11/Xauth.h:129: warning: function declaration isn't a
27 prototype
28 In file included from AuDispose.c:34:
29 /usr/i686-pc-linux-uclibc/usr/include/stdlib.h:97: error: syntax error
30 before "typedef"
31 AuDispose.c: In function `XauDisposeAuth':
32 AuDispose.c:45: warning: implicit declaration of function `bzero'
33 AuDispose.c:45: warning: nested extern declaration of `bzero'
34 make[1]: *** [AuDispose.lo] Error 1
35 make[1]: Leaving directory
36 `/var/tmp/portage/libXau-1.0.1/work/libXau-1.0.1'
37 make: *** [all] Error 2
38
39 !!! ERROR: x11-libs/libXau-1.0.1 failed.
40 Call stack:
41 ebuild.sh, line 1539: Called dyn_compile
42 ebuild.sh, line 939: Called src_compile
43 ebuild.sh, line 1248: Called x-modular_src_compile
44 x-modular.eclass, line 327: Called x-modular_src_make
45 x-modular.eclass, line 322: Called die
46
47
48
49 Prior to this it has just successfully emerged xproto which has installed
50 the header file that this package is not picking up. Also I can emerge
51 xorg-server in the host environment with problems.
52
53 During its configure it spits out
54
55
56
57 ./configure --prefix=/usr --host=i686-pc-linux-uclibc
58 --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
59 --sysconfdir=/etc --localstatedir=/var/lib --prefix=/usr
60 --datadir=/usr/share --build=i686-pc-linux-gnu
61 checking for a BSD-compatible install... /bin/install -c
62 checking whether build environment is sane... yes
63 checking for gawk... gawk
64 checking whether make sets $(MAKE)... yes
65 checking for i686-pc-linux-uclibc-strip... i686-pc-linux-uclibc-strip
66 checking whether to enable maintainer-specific portions of
67 Makefiles... no
68 checking for i686-pc-linux-uclibc-gcc... i686-pc-linux-uclibc-gcc
69 checking for C compiler default output file name... a.out
70 checking whether the C compiler works... yes
71 checking whether we are cross compiling... yes
72
73
74
75
76 Here I am trying to compile on a host i686-pc-linux-gnu for a target
77 i686-pc-linux-uclibc. Is this right - from my understanding(not the best)
78 should have --host=i686-pc-linux-glibs -target= target i686-pc-linux-uclibc.
79 Anyhow to continue.
80
81 My procedure for building this system involves first setting up a chroot env
82 with a fresh portage and then using crossdev to build a toolchain and then
83 emerge to build. This is the script I use to build the chroot environment:
84
85
86
87
88
89 RBCONFDIR=${RBTHEROOT}/conf/${1}
90 RBMEDIADIR=${RBTHEROOT}/media
91 RBBUILDROOT=${RBTHEROOT}/${1}_chroot
92
93 . ${RBCONFDIR}/conf
94
95 echo "Config Dir: ${RBCONFDIR}"
96
97 echo "Making build root: ${RBBUILDROOT}"
98
99 mkdir ${RBBUILDROOT}
100 cd ${RBBUILDROOT}
101
102 echo "Extracting files to build root."
103
104 tar xjpf ${RBMEDIADIR}/stage3-i686-2006.0.tar.bz2
105 tar xjf ${RBMEDIADIR}/portage-20060703.tar.bz2 -C ${RBBUILDROOT}/usr
106
107 echo "Copying distfiles"
108 cp ${RBMEDIADIR}/distfiles/* ${RBBUILDROOT}/usr/portage/distfiles/
109
110 echo "Putting in place host make.conf"
111 cp ${RBTHEROOT}/conf/make.conf ${RBBUILDROOT}/etc/
112
113 echo "Copying DNS info"
114 cp -L /etc/resolv.conf ${RBBUILDROOT}/etc/resolv.conf
115
116 echo "Mounting proc filesystem"
117 mount -t proc none ${RBBUILDROOT}/proc
118 echo "Mounting dev filesystem"
119 mount -o bind /dev ${RBBUILDROOT}/dev
120
121 echo "Copying phase 2 build files"
122 mkdir ${RBBUILDROOT}/p2build
123 cp -r ${RBCONFDIR} ${RBBUILDROOT}/p2build/conf
124 cp -r ${RBTHEROOT}/build_target/* ${RBBUILDROOT}/p2build/
125
126
127 echo "Entering chroot"
128 chroot ${RBBUILDROOT} bash /p2build/build-target
129
130
131
132
133 The preeceeding script source this . ${RBCONFDIR}/conf:
134
135
136
137
138 MY_TARGET_ARCH=x86
139 MY_TARGET_KERNEL_ARCH=i386
140 MY_TARGET_CHOST=i686-pc-linux-uclibc
141 MY_TARGET_CFLAGS="-Os -march=pentium4 -pipe -fomit-frame-pointer"
142 MY_TARGET_USE="-* x86 mmx ssl theora threads tiff doc usb vcd vorbis
143 wifi win32codecs wmf xml2 xpm xv xvid bzlib ncurses pam zlib avi crypt
144 divx4linux ftp gd gif gmp gphoto2 gtk gtk2 imlib avi live matroska mpeg
145 oggvorbis real theora xanim jpeg libwww mpeg msn opengl pdflib
146 png quicktime dri firebird flac gstreamer java kdeenablefinal libedit mikmod
147 mmap mng mp3 ogg sdl pdflib bash-completion bitmap-font truetype-fonts
148 spell tiff truetype usb xmms X a52 aac qt kde dvd dvdr dlloader alsa cdr
149 nvidia nptl nptlonly pic"
150 MY_TARGET_INPUT_DEVICES="keyboard mouse"
151 MY_TARGET_VIDEO_CARDS="nvidia"
152
153
154
155
156 This all works OK. The last line enters the chroot env and executes the
157 following script:
158
159
160
161
162 echo "Syncing source tree"
163 #emerge --sync
164
165 emerge xorg-server # This works so it builds ok in the host.
166
167
168 echo "Merging cross dev"
169 emerge -v crossdev
170
171 echo "Fixing overlay"
172 echo "PORTDIR_OVERLAY=\"/usr/local/portage\"" >> /etc/make.conf
173 mkdir /usr/local/portage
174
175 . /p2build/conf/conf
176
177 echo "Creating cross toolchain: ${MY_TARGET_CHOST}"
178 crossdev --binutils 2.16.1-r2 --gcc 3.4.5-r1 --libc 0.9.29 --kernel
179 2.6.17 -t $MY_TARGET_CHOST
180
181 mkdir -p /tmp/target
182
183 echo "sys-apps/baselayout-lite -*" >> /etc/portage/package.keywords
184
185 PRET=
186
187 echo "Creating kernel"
188
189 mkdir /tmp/kernel
190
191 echo "sys-kernel/vanilla-sources ~x86" >>
192 /etc/portage/package.keywords
193
194 ROOT="/tmp/kernel" \
195 ARCH="$MY_TARGET_ARCH" \
196 CHOST="$MY_TARGET_CHOST" \
197 CBUILD="i686-pc-linux-gnu" \
198 CFLAGS="$MY_TARGET_CFLAGS" \
199 CXXFLAGS="$MY_TARGET_CFLAGS" \
200 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
201 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
202 USE="${MY_TARGET_USE}" \
203 CONFIG_PROTECT="-* ${ROOT}/etc" \
204 emerge $PRET -v --nodeps vanilla-sources
205
206 cp -f /p2build/conf/.config /tmp/kernel/usr/src/linux/
207
208 cd /tmp/kernel/usr/src/linux/
209
210 ROOT="/tmp/kernel" \
211 CROSS_COMPILE="${MY_TARGET_CHOST}-" \
212 ARCH="$MY_TARGET_KERNEL_ARCH" \
213 CHOST="$MY_TARGET_CHOST" \
214 CBUILD="i686-pc-linux-gnu" \
215 CFLAGS="$MY_TARGET_CFLAGS" \
216 CXXFLAGS="$MY_TARGET_CFLAGS" \
217 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
218 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
219 USE="${MY_TARGET_USE}" \
220 CONFIG_PROTECT="-* ${ROOT}/etc" \
221 make bzImage
222
223 cd /
224
225
226 echo "Creating rootfs"
227
228
229 ROOT="/tmp/target" \
230 ARCH="$MY_TARGET_ARCH" \
231 CHOST="$MY_TARGET_CHOST" \
232 CBUILD="i686-pc-linux-gnu" \
233 CFLAGS="$MY_TARGET_CFLAGS" \
234 CXXFLAGS="$MY_TARGET_CFLAGS" \
235 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
236 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
237 USE="${MY_TARGET_USE} make-symlinks" \
238 CONFIG_PROTECT="-* ${ROOT}/etc" \
239 emerge $PRET -v busybox
240
241 ROOT="/tmp/target" \
242 ARCH="$MY_TARGET_ARCH" \
243 CHOST="$MY_TARGET_CHOST" \
244 CBUILD="i686-pc-linux-gnu" \
245 CFLAGS="$MY_TARGET_CFLAGS" \
246 CXXFLAGS="$MY_TARGET_CFLAGS" \
247 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
248 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
249 USE="${MY_TARGET_USE}" \
250 CONFIG_PROTECT="-* ${ROOT}/etc" \
251 emerge $PRET -v baselayout-lite
252
253 ROOT="/tmp/target" \
254 ARCH="$MY_TARGET_ARCH" \
255 CHOST="$MY_TARGET_CHOST" \
256 CBUILD="i686-pc-linux-gnu" \
257 CFLAGS="$MY_TARGET_CFLAGS" \
258 CXXFLAGS="$MY_TARGET_CFLAGS" \
259 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
260 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
261 USE="${MY_TARGET_USE}" \
262 CONFIG_PROTECT="-* ${ROOT}/etc" \
263 emerge $PRET -v cross-${MY_TARGET_CHOST}/uclibc
264
265 cp /tmp/target/bin/busybox /bin/busybox
266
267 ROOT="/tmp/target" \
268 ARCH="$MY_TARGET_ARCH" \
269 CHOST="$MY_TARGET_CHOST" \
270 CBUILD="i686-pc-linux-gnu" \
271 CFLAGS="$MY_TARGET_CFLAGS" \
272 CXXFLAGS="$MY_TARGET_CFLAGS" \
273 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
274 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
275 USE="${MY_TARGET_USE} make-symlinks" \
276 CONFIG_PROTECT="-* ${ROOT}/etc" \
277 emerge $PRET -v busybox
278
279 ROOT="/tmp/target" \
280 ARCH="$MY_TARGET_ARCH" \
281 CHOST="$MY_TARGET_CHOST" \
282 CBUILD="i686-pc-linux-gnu" \
283 CFLAGS="$MY_TARGET_CFLAGS" \
284 CXXFLAGS="$MY_TARGET_CFLAGS" \
285 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
286 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
287 USE="${MY_TARGET_USE} make-symlinks" \
288 CONFIG_PROTECT="-* ${ROOT}/etc" \
289 emerge $PRET -v busybox
290
291
292
293 And this all works ok too. I can then use the built kernel and rootfs and
294 PXE boot it. The problem then comes when trying to emerge xorg-server. I do
295 the following:
296
297
298
299 ROOT="/tmp/target" \
300 ARCH="$MY_TARGET_ARCH" \
301 CHOST="$MY_TARGET_CHOST" \
302 CBUILD="i686-pc-linux-gnu" \
303 CFLAGS="$MY_TARGET_CFLAGS" \
304 CXXFLAGS="$MY_TARGET_CFLAGS" \
305 INPUT_DEVICES="$MY_TARGET_INPUT_DEVICES" \
306 VIDEO_CARDS="$MY_TARGET_VIDEO_CARDS" \
307 USE="${MY_TARGET_USE} cross -doc" \
308 CONFIG_PROTECT="-* ${ROOT}/etc" \
309 emerge $PRET -v xorg-server
310
311 and after emerging a few packages I get the error. Any help would be greatly
312 appreciates.
313
314 Thanks
315 Ryan

Replies

Subject Author
RE: [gentoo-embedded] Problem cross compiling modular X Ryan Baldwin <ryan.baldwin@××××××××××.com>
Re: [gentoo-embedded] Problem cross compiling modular X "Peter S. Mazinger" <ps.m@×××.net>
Re: [gentoo-embedded] Problem cross compiling modular X Chuck Robey <chuckr@××××××.org>