You are not logged in.

#1 2010-01-27 10:31:57

Tinuva
Member
From: South Africa/Cape Town
Registered: 2008-05-29
Posts: 37
Website

[Solved]Getting different results with PKGBUILD and compiling manually

Hi,

When I compile this one package manually and install it, it works 100% however when I try it in a PKGBUILD the compile fails.

Here is the PKGBUILD I have so far (still working on it)

pkgname=smtp-gated
pkgver=1.4.16.2
pkgrel=1
pkgdesc="This software block SMTP sessions used by e-mail worms and viruses on the NA(P)T router. It acts like proxy, intercepting outgoing SMTP connections and scanning session data on-the-fly. When messages is infected, the SMTP session is terminated. It's to be used (mostly) by ISPs, so they can eliminate infected hosts from their network, and (preferably) educate their users."
url="http://smtp-proxy.klolik.org/"
license="GNU"
arch=('i686' 'x86_64')
#depends=('')
#install=smtp-gated.install
source=("$url/files/$pkgname-$pkgver.tar.gz")
md5sums=('3857d03c847efd89b052acaeffaa453b')

build() {
    cd $startdir/src/$pkgname-$pkgver || return 1
    msg CONFIGURE
    #./configure --prefix=/usr || return 1
    ./configure || return 1
    msg MAKE
    make || return 1
    msg INSTALL
    make install INSTALL_ROOT=$startdir/pkg/ || return 1
}

And the compile error when I run "makepkg"

==> MAKE
make  all-recursive
make[1]: Entering directory `/root/ABS_snmp-gated/src/smtp-gated-1.4.16.2'
Making all in src
make[2]: Entering directory `/root/ABS_snmp-gated/src/smtp-gated-1.4.16.2/src'
if gcc -DHAVE_CONFIG_H -I. -I. -I..    -DMD5_TEST -march=x86-64 -mtune=generic -O2 -pipe -Wall -MT md5_test-md5.o -MD -MP -MF ".deps/md5_test-md5.Tpo" -c -o md5_test-md5.o `test -f 'md5.c' || echo './'`md5.c; \
    then mv -f ".deps/md5_test-md5.Tpo" ".deps/md5_test-md5.Po"; else rm -f ".deps/md5_test-md5.Tpo"; exit 1; fi
gcc  -march=x86-64 -mtune=generic -O2 -pipe -Wall  -Wl,--hash-style=gnu -Wl,--as-needed -o md5-test  md5_test-md5.o  
if gcc -DHAVE_CONFIG_H -I. -I. -I..     -march=x86-64 -mtune=generic -O2 -pipe -Wall -MT regex-test.o -MD -MP -MF ".deps/regex-test.Tpo" -c -o regex-test.o regex-test.c; \
    then mv -f ".deps/regex-test.Tpo" ".deps/regex-test.Po"; else rm -f ".deps/regex-test.Tpo"; exit 1; fi
gcc  -march=x86-64 -mtune=generic -O2 -pipe -Wall  -Wl,--hash-style=gnu -Wl,--as-needed -o regex-test -lpcre regex-test.o  
regex-test.o: In function `main':
regex-test.c:(.text+0xc): undefined reference to `pcre_version'
regex-test.c:(.text+0x3c): undefined reference to `pcre_compile'
regex-test.c:(.text+0x71): undefined reference to `pcre_exec'
regex-test.c:(.text+0x88): undefined reference to `pcre_free'
collect2: ld returned 1 exit status
make[2]: *** [regex-test] Error 1
make[2]: Leaving directory `/root/ABS_snmp-gated/src/smtp-gated-1.4.16.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/ABS_snmp-gated/src/smtp-gated-1.4.16.2'
make: *** [all] Error 2

Any pointers or help would be greatly appreciated.

Last edited by Tinuva (2010-01-27 11:55:41)

Offline

#2 2010-01-27 10:48:11

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: [Solved]Getting different results with PKGBUILD and compiling manually

because of LDFLAGS. add before configure, unset LDFLAGS. to more specific we have in /etc/makepkg.conf:
LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"

and the --as-needed is the reason of failing. the problem is upstream.


Give what you have. To someone, it may be better than you dare to think.

Offline

#3 2010-01-27 10:59:06

Tinuva
Member
From: South Africa/Cape Town
Registered: 2008-05-29
Posts: 37
Website

Re: [Solved]Getting different results with PKGBUILD and compiling manually

wonder wrote:

because of LDFLAGS. add before configure, unset LDFLAGS. to more specific we have in /etc/makepkg.conf:
LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"

and the --as-needed is the reason of failing. the problem is upstream.

Ah great thank you that helped smile

Offline

#4 2010-01-27 11:53:49

Tinuva
Member
From: South Africa/Cape Town
Registered: 2008-05-29
Posts: 37
Website

Re: [Solved]Getting different results with PKGBUILD and compiling manually

Alright not sure if this is up to standard to go into AUR but this is what I have for now:

PKGBUILD:

pkgname=smtp-gated
pkgver=1.4.16.2
pkgrel=1
pkgdesc="This software block SMTP sessions used by e-mail worms and viruses on the NA(P)T router. It acts like proxy, intercepting outgoing SMTP connections and scanning session data on-the-fly. When messages is infected, the SMTP session is terminated. It's to be used (mostly) by ISPs, so they can eliminate infected hosts from their network, and (preferably) educate their users."
url="http://smtp-proxy.klolik.org/"
license="GNU"
arch=('i686' 'x86_64')
#depends=('')
install=smtp-gated.install
source=("$url/files/$pkgname-$pkgver.tar.gz")
md5sums=('3857d03c847efd89b052acaeffaa453b')

build() {
    cd $startdir/src/$pkgname-$pkgver || return 1
    msg CONFIGURE
    export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
    ./configure --prefix=/usr || return 1
    msg MAKE
    make || return 1
    msg INSTALL
    make install INSTALL_ROOT=$startdir/pkg/ || return 1

    install -D -m755 ../../smtp-gated ${startdir}/pkg/etc/rc.d/smtp-gated || return 1
    install -D -m644 ../../smtp-gated.conf ${startdir}/pkg/etc/smtp-gated.conf || return 1
}

smtp-gated.install

# arg 1:  the new package version
post_install() {
  mkdir /var/run/smtp-gated
  mkdir /var/spool/smtp-gated
  mkdir /var/spool/smtp-gated/msg

  chown mail.mail /var/run/smtp-gated
  chown mail.mail /var/spool/smtp-gated -R

  echo "
SMTP-GATED Instructions:

After installing SMTP-GATED you need to edit smtp-gated.ini

Good luck!
"
  /bin/true
}

op=$1
shift
$op $*

smtp-gated that goes into /etc/rc.d/

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

# source application-specific settings
[ -f /etc/conf.d/$NAME ] && . /etc/conf.d/$NAME

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="SMTP Proxy"
NAME=smtp-gated
DAEMON=/usr/sbin/$NAME
CONFIG=/etc/$NAME.conf
DAEMON_ARGS="$CONFIG"
PID=/var/run/$NAME/$NAME.pid
SCRIPTNAME=/etc/rc.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -f /etc/conf.d/$NAME ] && . /etc/conf.d/$NAME

case "$1" in
  start)
        stat_busy "Starting $NAME"
        #[ -z "$PID" ] && $DAEMON $DAEMON_ARGS
    $DAEMON $DAEMON_ARGS &>/dev/null
        if [ $? -gt 0 ]; then
                stat_fail
        else
                add_daemon $NAME
                stat_done
        fi
    ;;
  stop)
    stat_busy "Stopping $NAME"
       #[ -n "$PID" ] && kill $PID &> /dev/null
    smtp-gated -K &> /dev/null
        if [ $? -gt 0 ]; then
           stat_fail
        else
           rm_daemon $NAME
           stat_done
        fi
    ;;
  restart)
    $0 stop
    # will not start if not fully stopped, so sleep
    sleep 2
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac

:

smtp-gated.conf that goes into /etc

# Virus scanning: yes
# SPAM scanning: yes
#proxy_name            smtp-proxy.mydomain.com
port                9199
; bind_address        192.168.1.254
; source_addr        0.0.0.0

mode                netfilter

; action_script        /etc/smtp-gated-action.sh
lock_duration        1800
lock_path            /var/spool/smtp-gated/lock
spool_path            /var/spool/smtp-gated/msg
spool_perm            0660
pidfile                /var/run/smtp-gated/smtp-gated.pid
;dumpfile            /var/run/smtp-gated/smtp-state-dump
set_user            mail
priority            5

lock_on                virus,spam,maxhost
max_connections        64
max_per_host        10
;max_per_ident        6
;max_load            3.0

ignore_errors        yes
spool_leave_on        error,spam

nat_header_type        ip-only
; abuse            abuse@mydomain.com
log_helo        yes
log_mail_from        accepted,rejected
log_rcpt_to        accepted,rejected
; locale        pl_PL

;scan_max_size        1048576
;spam_max_size        0
spam_max_size        131072
;spam_max_load        0.5
spam_threshold        5.0

; scanner_path
antivirus_type        clamd
antivirus_path        /var/lib/clamav/clamd.sock
antispam_type        spamassassin
antispam_path        /var/run/spamd.sock

Last edited by Tinuva (2010-01-27 12:13:03)

Offline

#5 2010-01-27 11:57:55

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [Solved]Getting different results with PKGBUILD and compiling manually

Instead of

unset LDFLAGS

try using

export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"

. That way you keep the rest of the LDFLAGS and just remove the one which is causing the problem.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#6 2010-01-27 12:13:51

Tinuva
Member
From: South Africa/Cape Town
Registered: 2008-05-29
Posts: 37
Website

Re: [Solved]Getting different results with PKGBUILD and compiling manually

Ah great, that works as well and looks a bit better.

Updated my post with all the code in.

Offline

Board footer

Powered by FluxBB