OpenWrt Forum Archive

Topic: Compiling package requiring perl support

The content of this topic has been archived on 30 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I've been pulling my hair since a few days on this one.

I got a Netgear WDNR3700 flashed with backfire 10.03.1-rc4 (ar71xx).
It got a 680MHz CPU, 64MB RAM, 8MB flash extended with a 4GB memory stick.
Due to the powerful nature of this router I was deeply disappointed to find out that there are currently no versions of irssi (popular console irc client) compiled with perl for scriptsupport. Since the lack of scripts makes irssi 50% less fun/useful I decided to try and crosscompile irssi with perl.

After a lot of googling I found out that at least two other persons were unsuccesful in this attempt:
https://forum.openwrt.org/viewtopic.php … 25#p119125
https://forum.openwrt.org/viewtopic.php?id=26600


These are the steps I have taken: http://wiki.openwrt.org/doc/howto/build

First off, I'm currently using Ubuntu 10.10 x86_64 so I got the following packages to start off

# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
  git libncurses5-dev libz-dev patch unzip zlib1g-dev ia32-libs \
  lib32gcc1 libc6-dev-i386
# apt-get install subversion

Next, I checked out the backfire sources

# mkdir OpenWrt/
# cd OpenWrt/
# svn co svn://svn.openwrt.org/openwrt/branches/backfire

Next I added feeds (only src-svn packages svn://svn.openwrt.org/openwrt/packages)

# cat feeds.conf.default
src-svn packages svn://svn.openwrt.org/openwrt/packages
# ./scripts/feeds update -a
# ./scripts/feeds install -a

Next, I made the default config and a menuconfig

# make defconfig
# make menuconfig

I selected my target and selected irssi and everything under Languages -> Perl (except for microperl) as a module.
My .config: http://dl.dropbox.com/u/4480569/config

Afterwards I just executed a

# make

Afterwards I edited the Makefile of irssi: feeds/packages/net/irssi/Makefile
and changed the with-perl flag

CONFIGURE_ARGS += \
        --with-perl=yes \
        --with-glib-prefix="$(STAGING_DIR)/usr" \
        --with-textui \
        --without-terminfo \
        --without-bot \
        --disable-proxy

The Makefile: http://dl.dropbox.com/u/4480569/Makefile

I then tried to recompile irssi:

# make package/irssi/clean V=99
# make package/irssi/compile V=99 > BUILDLOG 2>&1
# grep perl BUILDLOG
checking for perl... /usr/bin/perl
checking for working Perl support... error linking with perl libraries, building without Perl
config.status: creating src/perl/Makefile
config.status: creating src/perl/common/Makefile.PL
config.status: creating src/perl/irc/Makefile.PL
config.status: creating src/perl/ui/Makefile.PL
config.status: creating src/perl/textui/Makefile.PL
- Error linking with perl libraries: -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.10/CORE -lperl -ldl -lm -lpthread -lcrypt: conftest.c:1: warning: -fstack-protector not supported for this target
conftest.c:1: warning: implicit declaration of function 'perl_alloc'
/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lperl

The build log: http://dl.dropbox.com/u/4480569/BUILDLOG

I did however compile every perl package available to me, but I guess that got no effect here.

$ ls -l bin/ar71xx/packages/ | grep perl | wc -l
147

Can someone please, please help me?
Except for those two persons I mentioned, there is also someone on IRC how would love an irssi+perl package and because the hardware of routers gets improved all the time such a package will grow in popularity.

Thanks
necreo

I just added +perl to the DEPENDS line of the irssi Makefile (updated Makefile in first post).

DEPENDS:=+glib2 +libncurses +libpthread +perl

I updated the packages, remade the image, and tried again with (updated BUILDLOG in first post)

$ make package/irssi/clean V=99
$ make package/irssi/compile V=99 > BUILDLOG 2>&1

It compiled again, but again without perl support..

$ grep perl BUILDLOG
make[2]: Entering directory `/media/ExHDD_Linux/OpenWrt/backfire/feeds/packages/lang/perl'
make[2]: Leaving directory `/media/ExHDD_Linux/OpenWrt/backfire/feeds/packages/lang/perl'
(cd /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/./; if [ -x ./configure ]; then /usr/bin/find /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/ -name config.guess | xargs -r chmod u+w; /usr/bin/find /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/ -name config.guess | xargs -r -n1 cp /media/ExHDD_Linux/OpenWrt/backfire/scripts/config.guess; /usr/bin/find /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/ -name config.sub | xargs -r chmod u+w; /usr/bin/find /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/ -name config.sub | xargs -r -n1 cp /media/ExHDD_Linux/OpenWrt/backfire/scripts/config.sub; AR=mips-openwrt-linux-uclibc-ar AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time -fhonour-copts -msoft-float -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include" LD=mips-openwrt-linux-uclibc-ld NM=mips-openwrt-linux-uclibc-nm CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB=mips-openwrt-linux-uclibc-ranlib STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CFLAGS="-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time -fhonour-copts -msoft-float -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include" CXXFLAGS="-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time -fhonour-copts -msoft-float -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include" CPPFLAGS="-I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/include -I/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/include " LDFLAGS="-L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib -L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/lib -L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib -L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib -L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libiconv-stub/lib -L/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libintl-stub/lib -lncurses"   ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls   --with-perl=yes --with-glib-prefix="/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr" --with-textui --without-terminfo --without-bot --disable-proxy --with-ssl="/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr" ; fi; )
checking for perl... /usr/bin/perl
checking for working Perl support... error linking with perl libraries, building without Perl
config.status: creating src/perl/Makefile
config.status: creating src/perl/common/Makefile.PL
config.status: creating src/perl/irc/Makefile.PL
config.status: creating src/perl/ui/Makefile.PL
config.status: creating src/perl/textui/Makefile.PL
- Error linking with perl libraries: -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.10/CORE -lperl -ldl -lm -lpthread -lcrypt: conftest.c:1: warning: -fstack-protector not supported for this target
conftest.c:1: warning: implicit declaration of function 'perl_alloc'
/media/ExHDD_Linux/OpenWrt/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lperl
( DEPENDS=''; for depend in glib2 libncurses libpthread perl libopenssl; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; echo "Depends: $DEPENDS"; echo "Provides: "; echo "Source: feeds/packages/net/irssi"; echo "Section: net"; echo "Status: unknown ok not-installed"; echo "Essential: no"; echo "Priority: optional"; echo "Maintainer: Peter Wagner <tripolar@gmx.at>"; echo "Architecture: ar71xx"; echo "Installed-Size: 0"; echo -n "Description: "; getvar V_Package_irssi_description | sed -e 's,^[[:space:]]*, ,g'; ) >> /media/ExHDD_Linux/OpenWrt/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/irssi-ssl/irssi-0.8.15/ipkg-ar71xx/irssi/CONTROL/control

Help??

(Last edited by necreo on 23 Mar 2011, 21:33)

Did you ever have any success?

Nope. I'm doubting it can be done. I've read nowhere someone was able to do this, so..

I don't see why it would be impossible. It might need some cross-compiling patches to avoid some tests that can't be run though or some adaptation for mips.

"conftest.c:1: warning: -fstack-protector not supported for this target" Seems to be a bug in gcc/autoconf affecting only MIPS. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=358644

Isn't /usr/bin/perl a local path in the line below? Don't we need to force it to look at a MIPS version of the lib and binary?
"checking for perl... /usr/bin/perl"

Yes, you can't compile against local perl. You need to make sure irssi finds the perl from staging dir and uses it, either by passing configure options or patching the Makefile.

arokh wrote:

Yes, you can't compile against local perl. You need to make sure irssi finds the perl from staging dir and uses it, either by passing configure options or patching the Makefile.

Yes, I guessed it might've tried to do that.

After getting a tip about checking the optware sources where they have sucessfully built it with perl support I ported one of their patches to the Makefile to the newer version used in OpenWRT. The result is the file below. I was hoping that those added variables were previously defined and understood by configure but there must have been something I missed because it didn't find anything so there is probably some missing logic. Not too surprising.

http://pastebin.com/SL2F7Vgi

The result is the Makefile below:

http://pastebin.com/qRkwfUZM

I checked the directories it adds, mainly /usr/lib/perl/5.10/CORE and it contains headers for it but they seem to be for x86_64 in my case as expected.

Where in the staging_dir do I find the perl source and lib? It seems that directory gets cleaned out or something after a sucessful build because it's almost empty. In build_dir I find the source for irssi and most other stuff. No perl though and I'm pretty sure I selected it in the menuconfig.

Where should I find the one I can link to? Do I have to separately cross-compile perl to get something I can link to?

How do I get automake to search for perl in the build_dir before determining that the x86 ones are the correct ones? It seems to correctly find the correct GCC, sed etc. without issues.

How can I build only some packages separately internally? It seems I have to run clean for it to generate a new BUILDLOG.

Could someone at least give an example of another package that links with perl that I can compare to? That would give me something more to work with. smile

I'm still interested in this but I don't know how to either change the Perl package to be linkable or how to get autoconf irssi uses to actually find the correct perl libs. If someone could point me to some relevant info that might helpful it would be greatly appreciated.

Is there anyone who can help with this?

The discussion might have continued from here.