Gentoo Archives: gentoo-embedded

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