emsearcy / srs-milter

C SRS Milter (Mail Filter)
3 stars 8 forks source link

Need help compiling srs-milter #1

Closed kampfflunder closed 11 years ago

kampfflunder commented 11 years ago

Hi,

first off, I need to say that I am by no means a C developer, so please take my apologies for every stupidity I may have done. Downloaded the latest version of srs-milter and tried to compile it. The compiler does not find srs2.h and spf2/spf.h. So I downloaded and installed both libsrs2 and libsps2. Patched srs-filter.c and edited the includes for srs2.h and spf2/spf.h to point them to the installed header files (Tried to use CPPFLAGS in Makefile, but this did not work out)

mailgate:/usr/local/src/srs-milter-master/src # diff -u srs-filter.c.org srs-filter.c
--- srs-filter.c.org    2013-08-27 18:01:44.798723713 +0200
+++ srs-filter.c        2013-08-27 20:57:01.451609985 +0200
@@ -18,8 +18,8 @@
 #include 
 #include 

-#include "srs2.h"
-#include "spf2/spf.h"
+#include "/usr/local/libsrs2/include/srs2.h"
+#include "/usr/local/libspf2/include/spf2/spf.h"
 #include "libmilter/mfapi.h"

mailgate:/usr/local/src/srs-milter-master/src #

But it won't compile:

mailgate:/usr/local/src/srs-milter-master/src # make
cc -Wall   -c srs-filter.c
srs-filter.c: In function 'xxfi_srs_milter_eom':
srs-filter.c:512:9: warning: implicit declaration of function 'smfi_chgfrom' [-Wimplicit-function-declaration]
srs-filter.c: At top level:
srs-filter.c:603:3: error: 'SMFIF_CHGFROM' undeclared here (not in a function)
srs-filter.c: In function 'main':
srs-filter.c:916:5: warning: implicit declaration of function 'smfi_version' [-Wimplicit-function-declaration]
make: *** [srs-filter.o] Error 1
mailgate:/usr/local/src/srs-milter-master/src #

What am I doing wrong?

Thanks in advance,

Rainer

emsearcy commented 11 years ago

Normally, installing libsrs2 and libspf2 should put the .h files into your system library paths. Probably, you can should ./configure those two different so that they install into /usr/local/include/ instead of /usr/local/[package]/include. You could also install them via a package manager, like with the RPMs from http://www.pramberger.at/peter/services/repository/ which should ensure they are in appropriate system paths for your distribution.

Your compile error is that SMFIF_CHGFROM is undeclared. This usually means your libmilter library is too old (libmilter may be part of the sendmail or sendmail-devel package on a Linux system). The ability to change the from (envelope sender) was added relatively recently in libmilter history and is needed for SRS.

kampfflunder commented 11 years ago

Thank you for your reply. I've installed libsrs2 and libspf2 in /usr/local/libsrs2 and /usr/local/libsrs2, respectivly. This is the normal way for me, because I do not want to mess up the regular directories (which are managed by the system's package manager). The same for sendmail: I built it from source (8.14.7, the latest one) and installed it in /usr/local/sendmail. Works fine for ages now :-) But: there is also libmilter.a in /usr/lib, which came from the system's sendmail (which I do not use) Until now, I thought that libmilter was a part of sendmail's source distribution, but I seem to be wrong and it it links statically the system's libmilter.a. If this is correct, I need to build libmilter first, then sendmail, then srs-milter? To point out: I already have spamass-milter and amavis-ilter running, so in principle, my sendmail uses libmilter.

kampfflunder commented 11 years ago

Just to let you know: You were correct. I had an old libmilter.a hanging around. After compiling/installing libmilter in the sendmail's source tree (I thought sendmail would compile it by itself, but I was wrong) and slightly editing both Makefile and srs-filter.c, it compiled eventually. Thank you for pointing me into the right direction!