It took me some time to actually make the jabber server working, few people seem to really care about cross-compiling their stuff, but I succeeded and here's the howto:
0. Errata
First of all, during the testing I found out I have to modify the environment settings - the static build of jabber did not work at all. I also added the location of newly compiled libs and headers so that they can be used by programs that depend on them. Some programs were in C++, so the CXX variable had to be set as well. Here's the final environment (P.S. in the end it seems some additions like CPPFLAGS would be needed for perfection, but I'm not in the mood of retrying):
$ cat environment TOOLCHAINS_HOME=/opt/toolchains/uclibc-crosstools export LIBS="-L${TOOLCHAINS_HOME}/lib/gcc/mips-linux/3.4.2 \ -L/var/usb/usb_1/lib \ " export INCLUDES="-I${TOOLCHAINS_HOME}/include/c++/3.4.2 \ -I${TOOLCHAINS_HOME}/mips-linux/sys-include \ -I/var/usb/usb_1/include \ -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include \ -I/var/usb/usb_1/include/ncurses \ " #export CFLAGS="${INCLUDES} ${LIBS} -static" #export LDFLAGS="-static" export CFLAGS="${INCLUDES} ${LIBS}" export LDFLAGS="" export CC="${TOOLCHAINS_HOME}/bin/mipsel-uclibc-gcc" export CXX="${TOOLCHAINS_HOME}/bin/mipsel-uclibc-g++" export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${TOOLCHAINS_HOME}/lib export PATH="${TOOLCHAINS_HOME}/bin:${PATH}"
Let's use it:
. environment
Also the symlinking of the uclibc toolchain needed to be further enhanced for some package to get built:
# cd /opt/toolchains/uclibc-crosstools/bin # for A in mips-linux-uclibc-* ; do > ln -s ${A} mipsel-linux-${A#mips-linux-uclibc-} > done
1a. jabberd
$ cd GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource $ wget http://download.jabberd.org/jabberd14/jabberd14-1.6.1.1.tar.gz $ tar xvf jabberd14-1.6.1.1.tar.gz $ cd jabberd14-1.6.1.1 $./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1
This ends badly:
... checking for libpopt... configure: error: no
Apparently the library for parsing command line parameters is needed. This was reported a year ago ...
2. popt
$ cd GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource $ wget http://freshmeat.net/redir/popt/72854/url_tgz/popt-1.14.tar.gz $ tar xvf popt-1.14.tar.gz $ cd popt-1.14 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for va_copy() function... configure: error: cannot run test program while cross compiling See `config.log' for more details.
WTF! There's bug 25 about it that the developers closed, saying "va_copy is no longer needed or used in popt-1.14.". Hell, when it's not needed, why did you keep the check ... :-(
I added a comment to the bug and sucessfully run:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ac_cv_va_copy=no $ make $ make install
1b. jabberd
Retry:
$ cd ../jabberd14-1.6.1.1 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for libpopt... configure: error: no
The previous step did not help much ... The configure script does not search for the popt.h in the provided directories - again something reported a year ago. It forced me to rise bug 93.
Retry:
$ CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for GNUTLS... no No package 'gnutls' found configure: error: Couldn't find required GnuTLS installation
Fine, let's get GnuTLS working first. Furthermore,
./configure --help
reveals that some more libraries are needed by jabberd:--with-libidn=DIR Where to find libidn (required) --with-libpth=DIR Where to find libpth (required) --with-expat=DIR Where to find libexpat (required)
In addition GnuTLS requires some other libraries, libtasn1 and libgcrypt, so let's get them all first.
3. GNU Portable Threads
$ cd .. $ wget ftp://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz $ tar xvf pth-2.0.7.tar.gz $ cd pth-2.0.7 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
4. Expat XML Parser
$ cd .. $ wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz?modtime=1181083143&big_mirror=0 $ tar xvf expat-2.0.1.tar.gz $ cd expat-2.0.1 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
5. GNU IDN Library - Libidn
$ cd .. $ wget ftp://alpha.gnu.org/pub/gnu/libidn/libidn-1.8.tar.gz $ tar xvf libidn-1.8.tar.gz $ cd libidn-1.8 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
6. Tiny ASN.1 library - Libtasn1
$ cd .. $ wget http://josefsson.org/gnutls/releases/libtasn1/libtasn1-1.4.tar.gz $ tar xvf libtasn1-1.4.tar.gz $ cd libtasn1-1.4 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
To save me from
checking for gpg-error-config... no checking for GPG Error - version >= 1.4... no configure: error: libgpg-error is needed. See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .
when configuring libgcrypt, libgpg-error has to be done in advance.
7. libgpg-error
$ cd .. $ wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.6.tar.bz2 $ tar xvf libgpg-error-1.6.tar.bz2 $ cd libgpg-error-1.6 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
8. libgcrypt
$ cd .. $ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.1.tar.gz $ tar xvf libgcrypt-1.4.1.tar.gz $ cd libgcrypt-1.4.1
The path to libggpg-error has to be specified explicitly:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-gpg-error-prefix=/var/usb/usb_1 --with-pth-prefix=/var/usb/usb_1
But it still does not help!:
$ make ... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -I/var/usb/usb_1/include -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -Wall -Wpointer-arith -o .libs/version version.o -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-linux/3.4.2 -L/var/usb/usb_1/lib ../src/.libs/libgcrypt.so -Wl,--rpath -Wl,/var/usb/usb_1/lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libgpg-error.so.0, needed by ../src/.libs/libgcrypt.so, not found (try using -rpath or -rpath-link) ../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_syserror' ../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_errno' ../src/.libs/libgcrypt.so: undefined reference to `gpg_strerror' ../src/.libs/libgcrypt.so: undefined reference to `gpg_strsource' collect2: ld returned 1 exit status make[2]: *** [version] Error 1 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/libgcrypt-1.4.1/tests' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/libgcrypt-1.4.1' make: *** [all] Error 2 $
I found out the guys at OpenWRT had the same problem and have a patch available.
I wanted to file a bug to the GnuPG bug tracker, but did not receive the confirmation mail when registering...
Actually this was told to the author two years ago and he does not care at all.
So here goes the needed modification:
$ diff -u tests/Makefile.in.old tests/Makefile.in --- tests/Makefile.in.old 2008-06-12 00:01:05.000000000 +0200 +++ tests/Makefile.in 2008-06-12 00:01:11.000000000 +0200 @@ -313,7 +313,7 @@ # a built header. AM_CPPFLAGS = -I../src -I$(top_srcdir)/src AM_CFLAGS = $(GPG_ERROR_CFLAGS) -LDADD = ../src/libgcrypt.la +LDADD = ../src/libgcrypt.la @LTLIBOBJS@ @GPG_ERROR_LIBS@ # pkbench uses mmap for no good reason. Needs to be fixed. Code for # this can be found in libksba/tests.
and try again:
$ make clean $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-gpg-error-prefix=/var/usb/usb_1 --with-pth-prefix=/var/usb/usb_1 $ make $ make install
9. The GNU Transport Layer Security Library
$ cd .. $ wget ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.2.5.tar.bz2 $ tar xvf gnutls-2.2.5.tar.bz2 $ cd gnutls-2.2.5
To prevent a configure error
checking for libgcrypt-config... no checking for LIBGCRYPT - version >= 1.2.4... no configure: error: *** *** libgcrypt was not found. You may want to get it from *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/ ***
the prefix to libgcrypt has to be specified (and libtasn1 too, to avoid using the built-in one):
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libgcrypt-prefix=/var/usb/usb_1 --with-libtasn1-prefix=/var/usb/usb_1
but it still does not work:
$ make ... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -std=gnu99 -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -D_REENTRANT -D_THREAD_SAFE -pipe -I/var/usb/usb_1/include -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -D_REENTRANT -D_THREAD_SAFE -o ex-cert-select ex-cert-select.o -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-linux/3.4.2 -L/var/usb/usb_1/lib ./.libs/libexamples.a ../../gl/.libs/libgnu.a /var/usb/usb_1/lib/libgcrypt.so /var/usb/usb_1/lib/libgpg-error.so ../../lib/.libs/libgnutls.so ../../libextra/.libs/libgnutls-extra.so -Wl,--rpath -Wl,/var/usb/usb_1/lib -Wl,--rpath -Wl,/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/lib/.libs -Wl,--rpath -Wl,/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/libextra/.libs -Wl,--rpath -Wl,/var/usb/usb_1/lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libtasn1.so.3, needed by ../../lib/.libs/libgnutls.so, not found (try using -rpath or -rpath-link) ../../lib/.libs/libgnutls.so: undefined reference to `asn1_write_value@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_delete_structure@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_get_length_der@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_get_tag_der@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_decoding_startEnd@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_decoding@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_create_element@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_copy_node@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_read_value@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_number_of_elements@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_array2tree@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_check_version@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_find_node@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_find_structure_from_oid@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_coding@LIBTASN1_0_3' collect2: ld returned 1 exit status make[4]: *** [ex-cert-select] Error 1 make[4]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc/examples' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5' make: *** [all] Error 2
After some experimentation (I told you I am no programmer) I found the following to work:
$ LIBS="-ltasn1 $LIBS" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libgcrypt-prefix=/var/usb/usb_1 --with-libtasn1-prefix=/var/usb/usb_1 $ make $ make install
Also I found that the two official mirrors have both different directory structure, so I was missing the devel branch of GnuTLS. The above works with http://www.gnu.org/software/gnutls/releases/gnutls-2.3.14.tar.bz2 (and breaks with 2.2.5).
1c. jabberd
Let's not try to find more bugs and specify the needed components to the
configure
script now:$ cd ../jabberd14-1.6.1.1 $ CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1
but still bad luck:
checking for GnuTLS... checking for mipsel-linux-pkg-config... no checking for pkg-config... /usr/bin/pkg-config configure: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org. checking pkg-config is at least version 0.9.0... yes checking for GNUTLS... no No package 'gnutls' found configure: error: Couldn't find required GnuTLS installation
And again, reported a year ago.
We can fix that, but the show is still not at the end:
$ PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1 ... checking for GnuTLS... checking for mipsel-linux-pkg-config... no checking for pkg-config... /usr/bin/pkg-config configure: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org. checking pkg-config is at least version 0.9.0... yes checking for GNUTLS... yes checking for TLS 1.2 support in GnuTLS... yes checking for GNUTLSEXTRA... yes checking idna.h usability... yes checking idna.h presence... yes checking for idna.h... yes checking for stringprep_check_version in -lidn... no configure: error: Couldn't find required libidn installation
Quick look into
config.log
reveals something familiar:/opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libtasn1.so.3, needed by /var/usb/usb_1/lib/libgnutls-extra.so, not found (try using -rpath or -rpath-link) /var/usb/usb_1/lib/libgnutls.so: undefined reference to `asn1_write_value@LIBTASN1_0_3' /var/usb/usb_1/lib/libgnutls.so: undefined reference to `gcry_sexp_release@GCRYPT_1.2' ...
Let's see if the GnuTLS fix works here as well:
LIBS="-ltasn1 $LIBS" PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1 ... checking for stringprep_check_version in -lidn... no
No, it doesn't :-(, but config.log reveals we got one step further:
... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-g++ -o conftest -g -O2 -I/va r/usb/usb_1/include -I/var/usb/usb_1/include -I/var/usb/usb_1/include -I/var/usb /usb_1/include conftest.cpp -L/var/usb/usb_1/lib /var/usb/usb_1/lib/libgnutls-e xtra.so /var/usb/usb_1/lib/libgnutls.so /var/usb/usb_1/lib/libidn.so -lresolv /v ar/usb/usb_1/lib/libtasn1.so -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-li nux/3.4.2 -ldl -Wl,--rpath -Wl,/var/usb/usb_1/lib -Wl,--rpath -Wl,/var/usb/usb_1 /lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips- linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libgcrypt.so.1 1, needed by /var/usb/usb_1/lib/libgnutls-extra.so, not found (try using -rpath or -rpath-link) ...
Finally, this works:
LIBS="-ltasn1 -lgpg-error -lgcrypt $LIBS" PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1
but make fails:
$ make ... /var/usb/usb_1/include/gnutls/openpgp.h: In function `void mio_tls_process_credentials(xmlnode_t*, const std::list<std::string, std::allocator<std::string> >&, const std::list<std::string, std::allocator<std::string> >&, gnutls_dh_params_int*, const std::list<std::string, std::allocator<std::string> >&, const std::list<std::string, std::allocator<std::string> >&)': /var/usb/usb_1/include/gnutls/openpgp.h:247: error: too few arguments to function `int gnutls_certificate_set_openpgp_key_file(gnutls_certificate_credentials_st*, const char*, const char*, gnutls_openpgp_crt_fmt_t)' mio_tls.cc:615: error: at this point in file /var/usb/usb_1/include/gnutls/openpgp.h:271: error: too few arguments to function `int gnutls_certificate_set_openpgp_keyring_file(gnutls_certificate_credentials_st*, const char*, gnutls_openpgp_crt_fmt_t)' mio_tls.cc:634: error: at this point in file mio_tls.cc:653: error: `gnutls_certificate_set_openpgp_trustdb' undeclared (first use this function) mio_tls.cc:653: error: (Each undeclared identifier is reported only once for each function it appears in.) make[3]: *** [mio_tls.lo] Error 1 make[3]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1/jabberd' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1/jabberd' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1' make: *** [all] Error 2
This turned out to be easy, the Gentoo folks found and patched it couple of months ago (and it looks it is in the jabberd cvs now) and after applying it, the journey ends:
$ make $ make install
Wow, congratulations!!
Let's get an editor so that we can modify the config files in place:
10a. vim
$ cd .. $ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2 $ tar xvf vim-7.1.tar.bz2 $ cd vim71 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking for strip... strip configure: error: cannot compile a simple program, check CC and CFLAGS (cross compiling doesn't work)
Would you expect an opensource app as big and widespread as Vim to be so broken? I would now. Fortunately the OpenWRT and FreeWRT people come to help again.
$ wget --no-check-certificate https://dev.openwrt.org/browser/packages/utils/vim/patches/001-cross_compile.patch?format=txt $ patch -p1 <001-cross_compile.patch\?format\=txt $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking --with-tlib argument... empty: automatic terminal library selection checking for tgetent in -lncurses... no checking for tgetent in -ltermlib... no checking for tgetent in -ltermcap... no checking for tgetent in -lcurses... no no terminal library found checking for tgetent()... configure: error: NOT FOUND! You need to install a terminal library; for example ncurses. Or specify the name of the library with --with-tlib.
Seems some terminal library is needed ...
11. The Ncurses (new curses) library
$ cd .. $ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz $ tar xvf ncurses-5.6.tar.gz $ cd ncurses-5.6 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
10b. vim
$ cd ../vim71 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking for tgetent in -lncurses... yes ncurses library is not usable checking for tgetent in -ltermlib... no checking for tgetent in -ltermcap... no checking for tgetent in -lcurses... no no terminal library found checking for tgetent()... configure: error: NOT FOUND! You need to install a terminal library; for example ncurses. Or specify the name of the library with --with-tlib.
seems we have to force it:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny --with-tlib=ncurses $ make ... Starting make in the src directory. If there are problems, cd to the src directory and run make there cd src && make first make[1]: Entering directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/vim71/src' CC="/opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -Iproto -DHAVE_CONFIG_H -I/var/usb/usb_1 " srcdir=. sh ./osdef.sh osdef0.c:10:44: termcap.h: No such file or directory ... In file included from term.c:33: /var/usb/usb_1/include/ncurses/termcap.h:64: error: conflicting types for 'tgoto' ...
hmm, I guess I really need to use the CPPFLAGS, shouldn't I modify the
environment
file? Perhaps, but now it's too late, it's finished:$ make distclean $ CPPFLAGS="-I/var/usb/usb_1/include/ncurses" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny --with-tlib=ncurses --disable-gui --disable-gtktest --disable-xim --without-x --disable-multibyte --disable-netbeans --disable-cscope --disable-gpm $ make $ make install ... strip /var/usb/usb_1/bin/vim strip: Unable to recognise the format of the input file `/var/usb/usb_1/bin/vim' make[1]: *** [installvimbin] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/vim71/src' make: *** [install] Error 2
No, it's not finished... Let's just hack it:
$ diff -u src/Makefile.old src/Makefile --- src/Makefile.old 2008-06-17 02:16:32.000000000 +0200 +++ src/Makefile 2008-06-17 02:16:47.000000000 +0200 @@ -999,7 +999,7 @@ INSTALL_DATA_R = cp -r ### Program to run on installed binary -#STRIP = strip +STRIP = echo ### Permissions for binaries {{{1 BINMOD = 755 $ make install
I was quite surprised with the size of some files. Performing
/opt/toolchains/uclibc-crosstools/bin/mipsel-linux-sstrip
on bin/
and lib/
helped a bit, but 1MB of vim
suggests there's still place for optimizations.Final creation and writing of the squashfs image:
# /home/hajma/Dokumenty/asus/squashfs2.0r2/squashfs-tools/mksquashfs /var/usb/usb_1 /tmp/new.sqsh -be -noI -noD -noF # dd if=/tmp/new.sqsh of=/dev/sda1
In the next part I'll try to correctly configure jabberd and make it start at router boot.
Customizing Asus AM200g - V. firmware modification
Customizing Asus AM200g - IV. jabberd configuration
Customizing Asus AM200g - II. Preparing the environment
Customizing Asus AM200g - I. PREPARATION
No comments:
Post a Comment