[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problems cross building arm debian packages



Hi,

I'm currently trying to setup an ARM cross toolchain which would be able to generate armel deb packages from an x86 machine.
I want to be able to build packages for lenny armel.
I also have another requirement : My cross gcc needs to be 4.4 because gcc4.4 has some atomic builtins which I need to compile my code which are not available in previous versions. Debian lenny doesn't have gcc4.4. The best it has is gcc3.3. So I can't build my cross toolchain the debian way, I need to do it manually :

So my dev computer is running a debian lenny, and I have debootstrapped an ARM debian lenny rootfs in my working tree (which I --second-stage thanks to qemu)

I downloaded binutils and gcc sources from gnu.org and I built them specifying this ARM rootfs as the "sysroot" (so that the cross-gcc and binutils that I build can link towards the debian lenny ARM libc)

This works and I now have a arm-linux-gnueabi- toolchain which works. I have tried to compile a basic hello world program with it and it runs in my qemu ARM lenny platform (links dynamically with the libc and so on) which looks good.

Now I'd like to be able to generate debian packages using that toolchain.

So I have installed dpkg-cross, configured it to point to my toolchain (/etc/dpkg-cross/cross-compile) and I have done "apt-get source hello" to start with something simple.

In the hello source folder, I run : dpkg-buildpackage -aarmel -rfakeroot -us -uc
After that, I get a file ../hello_2.2-2_armel.deb

So it looks good. But actually, if I look at what's inside this package, I can see that the hello binary is actually an x86 ELF binary file :(

Looking closer to the package build process, I can see that the ./configure is not run with any cross-compile options. There's also a warning from dpkg-architecture which I don't really understand. Following is the output of dpkg-buildpackage. It's a bit verbose and I apologise but I prefer not to strip anything there cause I might remove something important. Can anybody help me on this. The tutorials I could find on the internet regarding dpkg-cross and cross dpkg-buildpackage didn't mention such a problem, and I'm now out of ideas. I'm also not sure this is the right place to ask about that. I don't think this belongs to Emdebian but I might be wrong.

Anyway, I would appreciate if someone can help me to do the things right.
Best regards,

penda:~/cross/hello-2.2# dpkg-buildpackage -aarmel -us -uc -rfakeroot
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: set CFLAGS to default value: -g -O2
dpkg-buildpackage: set CPPFLAGS to default value:
dpkg-buildpackage: set LDFLAGS to default value:
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: source package hello
dpkg-buildpackage: source version 2.2-2
dpkg-buildpackage: source changed by Santiago Vila <sanvila@debian.org>
dpkg-architecture: warning: Specified GNU system type arm-linux-gnueabi does not match gcc system type i486-linux-gnu.
dpkg-buildpackage: host architecture armel
 fakeroot debian/rules clean
rm -f build
/usr/bin/make -i distclean
make[1]: Entering directory `/root/cross/hello-2.2'
Making distclean in tests
make[2]: Entering directory `/root/cross/hello-2.2/tests'
test -z "" || rm -f
rm -f Makefile
make[2]: Leaving directory `/root/cross/hello-2.2/tests'
Making distclean in man
make[2]: Entering directory `/root/cross/hello-2.2/man'
test -z "" || rm -f
rm -f Makefile
make[2]: Leaving directory `/root/cross/hello-2.2/man'
Making distclean in src
make[2]: Entering directory `/root/cross/hello-2.2/src'
test -z "hello" || rm -f hello
rm -f *.o
rm -f *.tab.c
test -z "" || rm -f
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -rf ./.deps
rm -f Makefile
make[2]: Leaving directory `/root/cross/hello-2.2/src'
Making distclean in po
make[2]: Entering directory `/root/cross/hello-2.2/po'
rm -f *.insert-header
rm -f remove-potcdate.sed
rm -f stamp-poT
rm -f core core.* hello.po hello.1po hello.2po *.new.po
rm -fr *.o
rm -f Makefile Makefile.in POTFILES *.mo
make[2]: Leaving directory `/root/cross/hello-2.2/po'
Making distclean in gnulib/lib
make[2]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
test -z "" || rm -f
test -z "libgnu.a" || rm -f libgnu.a
rm -f *.o
test -z "core *.stackdump getopt.h getopt.h-t stdbool.h stdbool.h-t unistd.h" || rm -f core *.stackdump getopt.h getopt.h-t stdbool.h stdbool.h-t unistd.h
rm -f *.tab.c
test -z "" || rm -f
test -z "" || rm -f
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -rf ./.deps
rm -f Makefile
make[2]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
Making distclean in contrib
make[2]: Entering directory `/root/cross/hello-2.2/contrib'
test -z "" || rm -f
rm -f Makefile
make[2]: Leaving directory `/root/cross/hello-2.2/contrib'
Making distclean in .
make[2]: Entering directory `/root/cross/hello-2.2'
test -z "" || rm -f
rm -f config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
make[2]: Leaving directory `/root/cross/hello-2.2'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile
make[1]: Leaving directory `/root/cross/hello-2.2'
rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars
 dpkg-source -b hello-2.2
dpkg-source: info: using source format `1.0'
dpkg-source: info: building hello using existing hello_2.2.orig.tar.gz
dpkg-source: info: building hello in hello_2.2-2.diff.gz
dpkg-source: info: building hello in hello_2.2-2.dsc
 debian/rules build
./configure --prefix=/usr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking stdio_ext.h usability... yes
checking stdio_ext.h presence... yes
checking for stdio_ext.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for getopt_long_only... yes
checking whether optreset is declared... no
checking for working GNU getopt function... yes
checking whether getenv is declared... yes
checking for inline... inline
checking for iswprint... yes
checking for mbsinit... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for error_at_line... yes
checking for __fpending... yes
checking whether __fpending is declared... yes
checking whether the compiler generally respects inline... yes
checking for mbstate_t... yes
checking whether mbrtowc and mbstate_t are properly declared... yes
checking for unistd.h... (cached) yes
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
configure: creating ./config.status
config.status: creating Makefile
config.status: creating contrib/Makefile
config.status: creating gnulib/lib/Makefile
config.status: creating man/Makefile
config.status: creating po/Makefile.in
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
/usr/bin/make CC="gcc" CFLAGS="-g -Wall -O2"
make[1]: Entering directory `/root/cross/hello-2.2'
/usr/bin/make  all-recursive
make[2]: Entering directory `/root/cross/hello-2.2'
Making all in contrib
make[3]: Entering directory `/root/cross/hello-2.2/contrib'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/root/cross/hello-2.2/contrib'
Making all in gnulib/lib
make[3]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
/usr/bin/make  all-am
make[4]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT xalloc-die.o -MD -MP -MF .deps/xalloc-die.Tpo -c -o xalloc-die.o xalloc-die.c
mv -f .deps/xalloc-die.Tpo .deps/xalloc-die.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT close-stream.o -MD -MP -MF .deps/close-stream.Tpo -c -o close-stream.o close-stream.c
mv -f .deps/close-stream.Tpo .deps/close-stream.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT closeout.o -MD -MP -MF .deps/closeout.Tpo -c -o closeout.o closeout.c
mv -f .deps/closeout.Tpo .deps/closeout.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT exitfail.o -MD -MP -MF .deps/exitfail.Tpo -c -o exitfail.o exitfail.c
mv -f .deps/exitfail.Tpo .deps/exitfail.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT quotearg.o -MD -MP -MF .deps/quotearg.Tpo -c -o quotearg.o quotearg.c
mv -f .deps/quotearg.Tpo .deps/quotearg.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../intl -g -Wall -O2 -MT xmalloc.o -MD -MP -MF .deps/xmalloc.Tpo -c -o xmalloc.o xmalloc.c
mv -f .deps/xmalloc.Tpo .deps/xmalloc.Po
rm -f libgnu.a
ar cru libgnu.a xalloc-die.o close-stream.o closeout.o exitfail.o quotearg.o xmalloc.o
ranlib libgnu.a
make[4]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
make[3]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
Making all in po
make[3]: Entering directory `/root/cross/hello-2.2/po'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/root/cross/hello-2.2/po'
Making all in src
make[3]: Entering directory `/root/cross/hello-2.2/src'
gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -g -Wall -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc  -g -Wall -O2   -o hello hello.o ../gnulib/lib/libgnu.a
make[3]: Leaving directory `/root/cross/hello-2.2/src'
Making all in man
make[3]: Entering directory `/root/cross/hello-2.2/man'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/root/cross/hello-2.2/man'
Making all in tests
make[3]: Entering directory `/root/cross/hello-2.2/tests'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/root/cross/hello-2.2/tests'
make[3]: Entering directory `/root/cross/hello-2.2'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/root/cross/hello-2.2'
make[2]: Leaving directory `/root/cross/hello-2.2'
make[1]: Leaving directory `/root/cross/hello-2.2'
touch build
 fakeroot debian/rules binary
rm -rf debian/tmp
install -d debian/tmp/DEBIAN debian/tmp/usr/share/doc/hello
/usr/bin/make INSTALL_PROGRAM="install -s" \
        prefix=$(pwd)/debian/tmp/usr install
make[1]: Entering directory `/root/cross/hello-2.2'
Making install in contrib
make[2]: Entering directory `/root/cross/hello-2.2/contrib'
make[3]: Entering directory `/root/cross/hello-2.2/contrib'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/root/cross/hello-2.2/contrib'
make[2]: Leaving directory `/root/cross/hello-2.2/contrib'
Making install in gnulib/lib
make[2]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
/usr/bin/make  install-am
make[3]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
make[4]: Entering directory `/root/cross/hello-2.2/gnulib/lib'
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
make[3]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
make[2]: Leaving directory `/root/cross/hello-2.2/gnulib/lib'
Making install in po
make[2]: Entering directory `/root/cross/hello-2.2/po'
/bin/mkdir -p /root/cross/hello-2.2/debian/tmp/usr/share
installing bg.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/bg/LC_MESSAGES/hello.mo installing ca.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ca/LC_MESSAGES/hello.mo installing da.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/da/LC_MESSAGES/hello.mo installing de.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/de/LC_MESSAGES/hello.mo installing de_DE.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/de_DE/LC_MESSAGES/hello.mo installing el.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/el/LC_MESSAGES/hello.mo installing eo.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/eo/LC_MESSAGES/hello.mo installing es.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/es/LC_MESSAGES/hello.mo installing es_AR.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/es_AR/LC_MESSAGES/hello.mo installing et.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/et/LC_MESSAGES/hello.mo installing eu.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/eu/LC_MESSAGES/hello.mo installing fa.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/fa/LC_MESSAGES/hello.mo installing fi.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/fi/LC_MESSAGES/hello.mo installing fr.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/fr/LC_MESSAGES/hello.mo installing ga.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ga/LC_MESSAGES/hello.mo installing gl.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/gl/LC_MESSAGES/hello.mo installing he.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/he/LC_MESSAGES/hello.mo installing hr.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/hr/LC_MESSAGES/hello.mo installing hu.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/hu/LC_MESSAGES/hello.mo installing id.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/id/LC_MESSAGES/hello.mo installing it.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/it/LC_MESSAGES/hello.mo installing ja.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ja/LC_MESSAGES/hello.mo installing ka.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ka/LC_MESSAGES/hello.mo installing ko.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ko/LC_MESSAGES/hello.mo installing lv.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/lv/LC_MESSAGES/hello.mo installing nb.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/nb/LC_MESSAGES/hello.mo installing nl.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/nl/LC_MESSAGES/hello.mo installing nn.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/nn/LC_MESSAGES/hello.mo installing pl.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/pl/LC_MESSAGES/hello.mo installing pt.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/pt/LC_MESSAGES/hello.mo installing pt_BR.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/pt_BR/LC_MESSAGES/hello.mo installing ro.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ro/LC_MESSAGES/hello.mo installing ru.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/ru/LC_MESSAGES/hello.mo installing sk.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/sk/LC_MESSAGES/hello.mo installing sl.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/sl/LC_MESSAGES/hello.mo installing sr.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/sr/LC_MESSAGES/hello.mo installing sv.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/sv/LC_MESSAGES/hello.mo installing tr.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/tr/LC_MESSAGES/hello.mo installing uk.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/uk/LC_MESSAGES/hello.mo installing vi.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/vi/LC_MESSAGES/hello.mo installing zh_CN.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/zh_CN/LC_MESSAGES/hello.mo installing zh_TW.gmo as /root/cross/hello-2.2/debian/tmp/usr/share/locale/zh_TW/LC_MESSAGES/hello.mo
if test "hello" = "gettext-tools"; then \
/bin/mkdir -p /root/cross/hello-2.2/debian/tmp/usr/share/gettext/po; \ for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot Makevars.template; do \
        /usr/bin/install -c -m 644 ./$file \
/root/cross/hello-2.2/debian/tmp/usr/share/gettext/po/$file; \
      done; \
      for file in Makevars; do \
rm -f /root/cross/hello-2.2/debian/tmp/usr/share/gettext/po/$file; \
      done; \
    else \
      : ; \
    fi
make[2]: Leaving directory `/root/cross/hello-2.2/po'
Making install in src
make[2]: Entering directory `/root/cross/hello-2.2/src'
make[3]: Entering directory `/root/cross/hello-2.2/src'
test -z "/root/cross/hello-2.2/debian/tmp/usr/bin" || /bin/mkdir -p "/root/cross/hello-2.2/debian/tmp/usr/bin"
  install -s 'hello' '/root/cross/hello-2.2/debian/tmp/usr/bin/hello'
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/root/cross/hello-2.2/src'
make[2]: Leaving directory `/root/cross/hello-2.2/src'
Making install in man
make[2]: Entering directory `/root/cross/hello-2.2/man'
make[3]: Entering directory `/root/cross/hello-2.2/man'
make[3]: Nothing to be done for `install-exec-am'.
test -z "/root/cross/hello-2.2/debian/tmp/usr/share/man/man1" || /bin/mkdir -p "/root/cross/hello-2.2/debian/tmp/usr/share/man/man1" /usr/bin/install -c -m 644 './hello.1' '/root/cross/hello-2.2/debian/tmp/usr/share/man/man1/hello.1'
make[3]: Leaving directory `/root/cross/hello-2.2/man'
make[2]: Leaving directory `/root/cross/hello-2.2/man'
Making install in tests
make[2]: Entering directory `/root/cross/hello-2.2/tests'
make[3]: Entering directory `/root/cross/hello-2.2/tests'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/root/cross/hello-2.2/tests'
make[2]: Leaving directory `/root/cross/hello-2.2/tests'
make[2]: Entering directory `/root/cross/hello-2.2'
make[3]: Entering directory `/root/cross/hello-2.2'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/root/cross/hello-2.2'
make[2]: Leaving directory `/root/cross/hello-2.2'
make[1]: Leaving directory `/root/cross/hello-2.2'
cp -a NEWS debian/copyright debian/tmp/usr/share/doc/hello
cp -a debian/changelog debian/tmp/usr/share/doc/hello/changelog.Debian
cp -a ChangeLog debian/tmp/usr/share/doc/hello/changelog
cd debian/tmp/usr/share/doc/hello && gzip -9 changelog changelog.Debian
gzip -r9 debian/tmp/usr/share/man
dpkg-shlibdeps debian/tmp/usr/bin/hello
dpkg-gencontrol -isp
chown -R root:root debian/tmp
chmod -R u+w,go=rX debian/tmp
dpkg --build debian/tmp ..
dpkg-deb: building package `hello' in `../hello_2.2-2_armel.deb'.
 dpkg-genchanges >../hello_2.2-2_armel.changes
dpkg-genchanges: not including original source code in upload
dpkg-buildpackage: binary and diff upload (original source NOT included)
penda:~/cross/hello-2.2# file debian/tmp/usr/bin/hello
debian/tmp/usr/bin/hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped


--
Francois Goudal
EPITA


Reply to: