OpenWrt Forum Archive

Topic: Need help to cross compile imapfilter 2.2

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

Hi,

I am trying to use imapfilter on a brmc2.4 platform.
Fortunately, a 2.0 packet is already provided, unfortunately this 2 year old
version has some bug (exspecalie with cert handling) which kill the daemon once a day
and let it hang at 100% CPU usage.
So talked to the developer of imapfilter who told me this with a lot of other stuff is
fixed in the 2.2 version. And now I, a total noob, somehow has to figure out how to cross compile the
source to a brcm2.4 combatible binary. I tried to follow some of the howtos (like the one with the SDK for whiterussian) but I really do not understand a single word.

Anyone out there who would lend me a hand?
with best regards

p90




PS: I am sorry for my bad english but I am really missing the practise here.

Hi.

1) Download the SDK at http://downloads.openwrt.org/kamikaze/8 … 86.tar.bz2
2) Unpack it and cd to the "OpenWrt-SDK-brcm-2.4-for-Linux-i686" directory
3) Checkout the imapfilter makefile: svn co svn://svn.openwrt.org/openwrt/packages/mail/imapfilter package/
4) Edit the Makefile in package/imapfilter/, change PKG_VERSION to 2.2 and md5sum to the one of the v2.2 tgz on the imapfilter download page
5) Run  make package/imapfilter/{clean,compile} V=99

Another thing, if 5) fails because it cannot apply the patch, just remove it from package/imapfilter/patches/ and repeat the "make" command

Hi,
Step 1-4 work fine, but step 5 doesn't work.
I tried removing the patches, but it still doesn't work.
It says:
grep: package/Makefile:$(eval: No such file or Directory)
grep: $(call: No such file or directory
grep: BuildPackage,imapfilter))/Makefile: No such file or directory
/home/username/OpenWRT-SDK-brcm-2.4-for-Linux-i686/tmp/info/.files-packageinfo.mk:1: *** target pattern contains no '%'. Stop
make[1]: *** [prepare-tmpinfo] Error 2
make: *** [package/imapfilter/clean] Fehler 2


So I guess, some files are missing? And due to that he does not know which platform he is supposed to cross compile to?

EDIT:
Tried to compile the package from svn without any alterations, but still fails with the same error.

(Last edited by p90 on 24 Feb 2010, 16:15)

Do you use some non standard shell? If yes, try run the make command in a bash session.

I prefer the build-system. The following works for me:

svn checkout svn://svn.openwrt.org/openwrt/trunk/ brcm-2.4/
cd brcm-2.4/
./scripts/feeds update packages luci
./scripts/feeds install -a -p luci
./scripts/feeds install -d m imapfilter
make defconfig
make

Updating the imapfilter package. Change the following lines in feeds/packages/mail/imapfilter/Makefile

Index: feeds/packages/mail/imapfilter/Makefile
===================================================================
--- feeds/packages/mail/imapfilter/Makefile     (revision 19842)
+++ feeds/packages/mail/imapfilter/Makefile     (working copy)
@@ -1,6 +1,6 @@
-# 
-# Copyright (C) 2006-2009 OpenWrt.org
 #
+# Copyright (C) 2006-2010 OpenWrt.org
+#
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=imapfilter
-PKG_VERSION:=2.0.11
+PKG_VERSION:=2.2.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://imapfilter.hellug.gr/source/
-PKG_MD5SUM:=752a895a17754666a490bd445577309d
+PKG_MD5SUM:=09c6ffb085a5a244dc9f3e798259f341

Download the new tarball and refresh the patch with

make package/imapfilter/{clean,download} V=99
make package/imapfilter/{clean,refresh} V=99

Build the new package and regenerate the package index

make package/imapfilter/{clean,compile} package/index
ll -h bin/brcm-2.4/packages/imapfilter_2.2.2-1_brcm-2.4.ipk 
-rw-r--r-- 1 user group 39K 2010-02-24 18:40 bin/brcm-2.4/packages/imapfilter_2.2.2-1_brcm-2.4.ipk
du -ah build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc/imapfilter/config.lua
8.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc/imapfilter
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/auxiliary.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/options.lua
16K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/set.lua
8.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/account.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/regex.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/message.lua
36K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/mailbox.lua
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/common.lua
92K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter
96K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share
92K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/bin/imapfilter
96K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/bin
196K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL/control
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL/conffiles
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL
224K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter
228K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/

And you have imapfilter updated to version 2.2.2.

Once you have tested your new package on the router you should create a diff and submit a ticket attached with it.

svn diff feeds/packages/mail/imapfilter/ > imapfilter.diff

imapfilter.diff

Index: feeds/packages/mail/imapfilter/patches/010-pathnames.patch
===================================================================
--- feeds/packages/mail/imapfilter/patches/010-pathnames.patch  (revision 19842)
+++ feeds/packages/mail/imapfilter/patches/010-pathnames.patch  (working copy)
@@ -20,7 +20,7 @@
  #endif                                /* PATHNAMES_H */
 --- a/imapfilter.c
 +++ b/imapfilter.c
-@@ -50,7 +50,7 @@
+@@ -50,7 +50,7 @@ main(int argc, char *argv[])
        opts.config = NULL;
        opts.oneline = NULL;
  
Index: feeds/packages/mail/imapfilter/Makefile
===================================================================
--- feeds/packages/mail/imapfilter/Makefile     (revision 19842)
+++ feeds/packages/mail/imapfilter/Makefile     (working copy)
@@ -1,6 +1,6 @@
-# 
-# Copyright (C) 2006-2009 OpenWrt.org
 #
+# Copyright (C) 2006-2010 OpenWrt.org
+#
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=imapfilter
-PKG_VERSION:=2.0.11
+PKG_VERSION:=2.2.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://imapfilter.hellug.gr/source/
-PKG_MD5SUM:=752a895a17754666a490bd445577309d
+PKG_MD5SUM:=09c6ffb085a5a244dc9f3e798259f341
 
 include $(INCLUDE_DIR)/package.mk

(Last edited by Dogge on 24 Feb 2010, 19:03)

@jow
I am using ARCH Linux and its default shell.
Maybe this is the problem?

@Dogge
It seems to have worked.
I have now a ipk package but it contains only one single file (which contains for some reason my username and some over stuff.)
Is this only the binary and I have to fix the rest myself (that would not be a problem, but I do not get that is happening right now)?
And I also cant install the package with opkg,
opkg install ./imapfilter_2.2.2-1.brcm.2-4.ipk only returns imapfilter 2.0.10 is up to date

Below in this post you'll find the contents of my updated imapfilter package. Try with the build-system instead of the SDK.

ll -h bin/brcm-2.4/packages/imapfilter_2.2.2-1_brcm-2.4.ipk 
-rw-r--r-- 1 user group 39K 2010-02-24 18:40 bin/brcm-2.4/packages/imapfilter_2.2.2-1_brcm-2.4.ipk
du -ah build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc/imapfilter/config.lua
8.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc/imapfilter
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/etc
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/auxiliary.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/options.lua
16K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/set.lua
8.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/account.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/regex.lua
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/message.lua
36K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/mailbox.lua
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter/common.lua
92K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share/imapfilter
96K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/share
92K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/bin/imapfilter
96K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr/bin
196K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/usr
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL/control
4.0K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL/conffiles
12K     build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter/CONTROL
224K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/imapfilter
228K    build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/

(Last edited by Dogge on 24 Feb 2010, 22:24)

Hi,
as I said, my imapfilter_2.2.2-1_brcm-2.4.ipk only has one file.
if you open it with Notepad, you will see ./debian-binary and at some points my username.

If I execute du -ah build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/
I have the same list as you posted. The size of the ipk files is around 50kb, which would be the noraml size of this package. Maybe I am just to stupid to install the package from a local source? opkg always tries to get the imapfile from the openwrt database instead of my local imapfile

[EDIT]
Or maybe I just got the wrong location for the produced ipk?

(Last edited by p90 on 24 Feb 2010, 23:33)

p90 wrote:

If I execute du -ah build_dir/target-mipsel_uClibc-0.9.30.1/imapfilter-2.2.2/ipkg-brcm-2.4/
I have the same list as you posted. The size of the ipk files is around 50kb, which would be the noraml size of this package. Maybe I am just to stupid to install the package from a local source? opkg always tries to get the imapfile from the openwrt database instead of my local imapfile

Setup a local web or FTP server, put your package repo in there and point /etc/opkg.conf to it. Then it'll use your own local package repo.

okay, as I said, I am quiet a noob.
Which of my folders is my repo folder?
After looking into the packets.index file on the download.openwrt.org server I figured that it should be "feeds" but
my package.index in "feeds" has still the 2.0.10 version inside. Did I make something wrong or do I have the Wrong directory.

[EDIT]

Okay, found it (I guess). bin/package it is. (And it also has the 2.2.2 Version inside)
Copied it over to my ftp server, removed all other sources from opkg.conf, made an
opkg update
(checked my /var/opkg-lists/snapshots and it has only the stuff from my ftp inside)
opkg install imapfilter -> Package imapfilter (2.0.10-1) installed in root is up to date.
That am I doing wrong?

[EDIT2]

Got it to work!
The Problem was: On brcm-2.4, the "platform" is set to "mipsel" while the build system for brcm-2.4 the platform is set to "brcm-2.4". After I changed it to "mipsel" I could easyly install it and it works like a charm.
I will try to creat a diff and post it after some testing.
With best regards


p90

(Last edited by p90 on 25 Feb 2010, 18:35)

The discussion might have continued from here.