fbv's build system could best be described as "not-quite Autotools", one area where it isn't "quite" is when cross compiling. ./configure assumes the compiler is called "cc" and uses that to detect whether libpng, libjpeg and libgif are present. End result is that when the build host lacks these libraries, the test fails. The configure script then omits -lpng, -ljpeg...etc, and the link fails due to missing symbols. In my case, target is Freescale i.MX27 (using a Gentoo/Embedded based distribution). To reproduce: # crossdev -t ${ANY_LINUX_CHOST:=arm-926ejs-linux-gnueabi} # emerge-wrapper --init # USE="png jpeg gif" ${ANY_LINUX_CHOST}-emerge fbv I got a build failure: >>> Emerging (1 of 1) media-gfx/fbv-1.0b for /usr/arm-926ejs-linux-gnueabi/ * fbv-1.0b.tar.gz RMD160 SHA1 SHA256 size ;-) ... [ ok ] * Package: media-gfx/fbv-1.0b * Repository: gentoo * Maintainer: dragonheart@gentoo.org * USE: elibc_glibc gif jpeg kernel_linux png userland_GNU >>> Unpacking source... >>> Unpacking fbv-1.0b.tar.gz to /usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/work * Applying oob-segfault-fbv-1.0b.diff ... [ ok ] >>> Source unpacked in /usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/work >>> Compiling source in /usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/work/fbv-1.0b ... checking for libungif presence... no checking for libjpeg presence... no checking for libpng presence... no building with bmp support... disabled checking for DEFAULT_FRAMEBUFFER... /dev/fb0 installation dir: /usr/bin manuals dir: /usr/share/man make -j1 CC=arm-926ejs-linux-gnueabi-gcc 'CFLAGS=-Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/' arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o main.o main.c arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o jpeg.o jpeg.c jpeg.c: In function ‘fh_jpeg_id’: jpeg.c:43:9: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o gif.o gif.c gif.c: In function ‘fh_gif_id’: gif.c:45:9: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o png.o png.c png.c: In function ‘fh_png_load’: png.c:72:5: warning: ‘jmpbuf’ is deprecated (declared at /usr/arm-926ejs-linux-gnueabi/usr/include/png.h:1098) png.c: In function ‘fh_png_getsize’: png.c:164:5: warning: ‘jmpbuf’ is deprecated (declared at /usr/arm-926ejs-linux-gnueabi/usr/include/png.h:1098) png.c: In function ‘fh_png_id’: png.c:41:9: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o bmp.o bmp.c arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o fb_display.o fb_display.c arm-926ejs-linux-gnueabi-gcc -Os -pipe -fomit-frame-pointer -I/usr/arm-926ejs-linux-gnueabi/usr/include/ -I/usr/arm-926ejs-linux-gnueabi/include/ -c -o transforms.o transforms.c arm-926ejs-linux-gnueabi-gcc -L/usr/arm-926ejs-linux-gnueabi/lib -L/usr/arm-926ejs-linux-gnueabi/usr/lib -L/usr/lib/gcc/arm-926ejs-linux-gnueabi/4.5.1 -o fbv main.o jpeg.o gif.o png.o bmp.o fb_display.o transforms.o jpeg.o: In function `fh_jpeg_load': jpeg.c:(.text+0xe8): undefined reference to `jpeg_std_error' jpeg.c:(.text+0x10c): undefined reference to `jpeg_destroy_decompress' jpeg.c:(.text+0x130): undefined reference to `jpeg_CreateDecompress' jpeg.c:(.text+0x13c): undefined reference to `jpeg_stdio_src' jpeg.c:(.text+0x148): undefined reference to `jpeg_read_header' jpeg.c:(.text+0x158): undefined reference to `jpeg_start_decompress' jpeg.c:(.text+0x1b0): undefined reference to `jpeg_read_scanlines' jpeg.c:(.text+0x1e0): undefined reference to `jpeg_finish_decompress' jpeg.c:(.text+0x1e8): undefined reference to `jpeg_destroy_decompress' jpeg.o: In function `fh_jpeg_getsize': jpeg.c:(.text+0x240): undefined reference to `jpeg_std_error' jpeg.c:(.text+0x264): undefined reference to `jpeg_destroy_decompress' jpeg.c:(.text+0x288): undefined reference to `jpeg_CreateDecompress' jpeg.c:(.text+0x294): undefined reference to `jpeg_stdio_src' jpeg.c:(.text+0x2a0): undefined reference to `jpeg_read_header' jpeg.c:(.text+0x2b0): undefined reference to `jpeg_start_decompress' jpeg.c:(.text+0x2d0): undefined reference to `jpeg_destroy_decompress' gif.o: In function `fh_gif_load': gif.c:(.text+0xec): undefined reference to `DGifOpenFileName' gif.c:(.text+0x114): undefined reference to `DGifGetRecordType' gif.c:(.text+0x13c): undefined reference to `DGifGetImageDesc' gif.c:(.text+0x14c): undefined reference to `DGifCloseFile' gif.c:(.text+0x208): undefined reference to `DGifGetLine' gif.c:(.text+0x22c): undefined reference to `DGifCloseFile' gif.c:(.text+0x2f4): undefined reference to `DGifGetLine' gif.c:(.text+0x3e4): undefined reference to `DGifGetExtension' gif.c:(.text+0x418): undefined reference to `DGifGetExtensionNext' gif.c:(.text+0x440): undefined reference to `DGifCloseFile' gif.o: In function `fh_gif_getsize': gif.c:(.text+0x468): undefined reference to `DGifOpenFileName' gif.c:(.text+0x48c): undefined reference to `DGifGetRecordType' gif.c:(.text+0x4b4): undefined reference to `DGifGetImageDesc' gif.c:(.text+0x4c4): undefined reference to `DGifCloseFile' gif.c:(.text+0x4e4): undefined reference to `DGifCloseFile' gif.c:(.text+0x4fc): undefined reference to `DGifGetExtension' gif.c:(.text+0x50c): undefined reference to `DGifGetExtensionNext' gif.c:(.text+0x534): undefined reference to `DGifCloseFile' png.o: In function `fh_png_load': png.c:(.text+0x9c): undefined reference to `png_create_read_struct' png.c:(.text+0xac): undefined reference to `png_create_info_struct' png.c:(.text+0xe4): undefined reference to `png_destroy_read_struct' png.c:(.text+0xfc): undefined reference to `png_init_io' png.c:(.text+0x108): undefined reference to `png_read_info' png.c:(.text+0x13c): undefined reference to `png_get_IHDR' png.c:(.text+0x14c): undefined reference to `png_set_expand' png.c:(.text+0x15c): undefined reference to `png_set_packing' png.c:(.text+0x170): undefined reference to `png_set_gray_to_rgb' png.c:(.text+0x180): undefined reference to `png_get_valid' png.c:(.text+0x190): undefined reference to `png_set_tRNS_to_alpha' png.c:(.text+0x1a4): undefined reference to `png_set_strip_16' png.c:(.text+0x1ac): undefined reference to `png_set_interlace_handling' png.c:(.text+0x1bc): undefined reference to `png_read_update_info' png.c:(.text+0x23c): undefined reference to `png_read_rows' png.c:(.text+0x2cc): undefined reference to `png_read_rows' png.c:(.text+0x30c): undefined reference to `png_read_end' png.c:(.text+0x31c): undefined reference to `png_destroy_read_struct' png.o: In function `fh_png_getsize': png.c:(.text+0x380): undefined reference to `png_create_read_struct' png.c:(.text+0x390): undefined reference to `png_create_info_struct' png.c:(.text+0x3c8): undefined reference to `png_destroy_read_struct' png.c:(.text+0x3e0): undefined reference to `png_init_io' png.c:(.text+0x3ec): undefined reference to `png_read_info' png.c:(.text+0x420): undefined reference to `png_get_IHDR' png.c:(.text+0x430): undefined reference to `png_destroy_read_struct' collect2: ld returned 1 exit status make: *** [fbv] Error 1 emake failed * ERROR: media-gfx/fbv-1.0b failed: * emake failed * * Call stack: * ebuild.sh, line 56: Called src_compile * environment, line 2343: Called die * The specific snippet of code: * emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed" * * If you need support, post the output of 'emerge --info =media-gfx/fbv-1.0b', * the complete build log and the output of 'emerge -pqv =media-gfx/fbv-1.0b'. * The complete build log is located at '/usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/temp/build.log'. * The ebuild environment file is located at '/usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/temp/environment'. * S: '/usr/arm-926ejs-linux-gnueabi/tmp/portage/media-gfx/fbv-1.0b/work/fbv-1.0b' The fix: Tell ./configure to use ${CHOST}-gcc not cc when doing its tests. Attached is a patch against the sources, and an updated ebuild that enables this to happen. I saw the note in maintainers.xml, if you like I'll slip this in directly.
Created attachment 257580 [details, diff] fbv-1.0b-cc.patch Source: http://www.t2-project.org/packages/fbv.html Add --cc option to ./configure to override the name of the compiler used to build fbv. By default, 'cc' is used.
Created attachment 257581 [details, diff] fbv-1.0b.ebuild.diff Patch against the ebuild. I also pass in LDFLAGS to ensure the path to the native libraries is past in when doing configure checks. (crossdev wrappers add -L/usr/${CHOST}/usr/lib...etc. to the list.)
Feel free to commit it (and also patch from bug #236489) if you have time ;)
+ 04 Mar 2012; Pacho Ramos <pacho@gentoo.org> +files/fbv-1.0b-cc.patch, + fbv-1.0b.ebuild: + Fix crosscompilation, bug #349128 by Stuart Longland. +