You are not logged in.

#1 2005-04-10 23:04:36

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Problem compiling ipsec-tools [SOLVED (kind of..)]

I've tried a few times to compile ipsec-tools, with the eventual aim of creating a package for it. Every time, I got the following error:

pfkey.c: In function 'pfkey_recv':
pfkey.c:1752: error: 'EINTR' undeclared (first use in this function)
pfkey.c:1752: error: (Each undeclared identifier is reported only once
pfkey.c:1752: error: for each function it appears in.)

I got some suggestions from i3839 here, but they didn't work. So I got on to the ipsec-tools mailing list, and a very helpful guy called Aidas had a look at it, and said:

Anyway, I've got an impression that culprit is /usr/include/asm/errno.h
file, which do not include /usr/include/asm-generic/errno.h, which then
should include asm-generic/errno-base.h, which already has definition
for EINTR. Please check that it is not corrupted. Mine reads:

#ifndef _I386_ERRNO_H
#define _I386_ERRNO_H

#include <asm-generic/errno.h>

#endif

If your distribution people "enhanced" it -- complain to them.

Under Arch, /usr/include/asm/errno.h reads:

#ifndef _I386_ERRNO_H
#define _I386_ERRNO_H

#ifndef _LINUX_ERRNO_H
 #include <linux/errno.h>
#endif

#endif

However, /usr/src/linux-<uname>/include/asm/errno.h is the same as Aidas' version. I tried

./configure --with-kernel-headers=/usr/src/linux-<uname>/include

but the error was still there. Aidas' final suggestion was

consult an expert of your
version of linux how to compile daemons which havily depend on kernel
includes. He may find that your includes are set up inproperly.

So, if any Arch experts out there have the time and interest, I'd be grateful if you could expend a few brain cells on this. I'm currently using ipsec-tools binaries copied over from the Debian partition on my laptop, which I hate doing, but it's the only way I can get my VPN going.

TIA.

Offline

#2 2005-04-10 23:45:06

puntmuts
Member
Registered: 2005-02-22
Posts: 138

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

First: I'm not an expert, I'm an experienced Linux user and recognize these problems when I was using Slackware and compiling apps using kernel includes (kdemultimedia comes to mind) .

So I downloaded the source tarball (v0.5.1) and did a quick ./configure && make . Same error you had.  But I have a custom build kernel and a full vanilla 2.6.11.7 source on my disk , so I tried to use that instead of the AL headers.

- I renamed the /usr/include/asm to asm-arch, same applies for /usr/include/linux
- I linked the /usr/include/asm and linux to the kernel source (/usr/src/linux-2.6.11-7/include/asm and linux)
- I created a link /usr/include/asm-generic which pointed to the kernel source dir as well ...../include/asm-generic ) 

After that the software compiled beautifully smile
But it could be it will not work 100% but I didn't notice this when doing this in Slackware.

After installing the software delete the links and rename the asm-arch and linux-arch back to their original names again.

It is dirty but most of the times it worked for me big_smile


Out / Gone
Mirgrating all my machines off ArchLinux . No longer part of the ArchLinux community / users .
Done. Goodbye.

Offline

#3 2005-04-11 09:22:49

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Thanks puntmuts - that works alright, and I'll use it to get rid of those Debian files. However, and I hope you don't think I'm being fussy here, Id really like to do it the "right" way (whatever that is) - and I'm also thinking if you have to do this to get the thing to compile, does that mean there's something wrong with /usr/include on Arch, as suggested by Aidas?

If I find anything else on this, I'll post it, and of course, I'd be very grateful for any other suggestions.

Offline

#4 2005-04-11 20:37:02

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

/usr/include/asm/errno.h is part of glibc, so can try to blame Arch, but IMHO it's ipsec's fault for not compiling with the default glibc headers. So if it doesn't work with the --with-kernel-headers option then it ends...

Offline

#5 2005-04-11 20:51:33

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

try

./configure --with-kernel-headers=/usr/src/linux-<uname>/include/asm

if they're just doing a "#include <errno.h> then that will work... also, you need to make sure that those include files end up *before* the rest of the crap...

try doing a [grep "errno.h" *] on the entire source tree and posting the results here...

I'm with i3839 on this one though - it's the ipsec people's issue, they should have used glibc's errno

Offline

#6 2005-04-11 23:40:06

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

phrakture wrote:

try

./configure --with-kernel-headers=/usr/src/linux-<uname>/include/asm

No joy, I'm afraid - thanks for the suggestion, though.

phrakture wrote:

try doing a [grep "errno.h" *] on the entire source tree and posting the results here...

Like this?

ipsec-tools-0.5.1/src/libipsec# grep "errno.h" *
pfkey.c:#include <errno.h>
policy_parse.y:#include <errno.h>
policy_token.l:#include <errno.h>
test-policy.c:#include <errno.h>

ipsec-tools-0.5.1/src/racoon# grep "errno.h" *
admin.c:#include <errno.h>
cfparse.y:#include <errno.h>
cftoken.l:#include <errno.h>
evt.c:#include <errno.h>
getcertsbyname.c:#include <errno.h>
grabmyaddr.c:#include <errno.h>
gssapi.c:#include <errno.h>
handler.c:#include <errno.h>
ipsec_doi.c:#include <errno.h>
isakmp.c:#include <errno.h>
isakmp_agg.c:#include <errno.h>
isakmp_base.c:#include <errno.h>
isakmp_cfg.c:#include <errno.h>
isakmp_frag.c:#include <errno.h>
isakmp_ident.c:#include <errno.h>
isakmp_inf.c:#include <errno.h>
isakmp_newg.c:#include <errno.h>
isakmp_quick.c:#include <errno.h>
isakmp_unity.c:#include <errno.h>
isakmp_xauth.c:#include <errno.h>
kmpstat.c:#include <errno.h>
localconf.c:#include <errno.h>
logger.c:#include <errno.h>
main.c:#include <errno.h>
misc.c:#include <errno.h>
nattraversal.c:#include <errno.h>
oakley.c:#include <errno.h>
pfkey.c:#include <errno.h>
plainrsa-gen.c:#include <errno.h>
plog.c:#include <errno.h>
policy.c:#include <errno.h>
proposal.c:#include <errno.h>
prsa_par.y:#include <errno.h>
remoteconf.c:#include <errno.h>
sainfo.c:#include <errno.h>
schedule.c:#include <errno.h>
session.c:#include <errno.h>
sockmisc.c:#include <errno.h>
vendorid.c:#include <errno.h>

ipsec-tools-0.5.1/src/setkey# grep "errno.h" *
parse.y:#include <errno.h>
setkey.c:#include <errno.h>
test-pfkey.c:#include <errno.h>
token.l:#include <errno.h>

i3839 - I've posted your comments back to their list. Whatever the response is, you'll see it here.

Offline

#7 2005-04-12 15:16:07

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

ok, it seems that it's not using a path or anything, so I guess you can just override the errno.h path to kludge it to work...
maybe a nice sed hack on the makefile?

Offline

#8 2005-04-12 23:08:35

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Thanks for the suggestion, phrakture. Any chance you could point me towards a few examples of how to do that?! big_smile

Offline

#9 2005-04-13 09:50:32

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

i3839 wrote:

I think the easiest way to bypass the problem is to replace '#include <errno.h>' with '#include "/usr/include/errno.h"' in pfkey.c.

Ah yes, the compile won't complete without errors, I forgot about that. But the setkey program will be compiled without errors, and that's the important thing in this case.

If you need other parts too then you'll probably need to add similar workarounds elsewhere.

Just digging up old stuff I wrote long ago in that other thread...

But it stays a kludge, the proper fix would be that ipsec would include explicitly the kernel header files it needs, and not the whole directory blindly.

Offline

#10 2005-04-13 22:21:55

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Sorry i3839 - I should have said way back then that I tried your suggestion, and it didn't work. I've just tried it again to make sure, and it still falls over at exactly the same point. The compile definitely does not complete - it doesn't even get into the setkey or racoon directories.

I think I'll stick with my current kludge i.e. using the Debian binaries. I only need ipsec-tools because openswan depends on it, and it's working now, so I'll leave it at that. I had hoped to contribute PKGBUILDs for both apps, but I think I'll look into strongswan instead - it doesn't need ipsec-tools....

Offline

#11 2005-04-14 13:57:12

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Strange, although it fails for me too, at least it compiled the setkey binary first. Though I can't remember what I did exactly (perhaps "make" in the setkey dir instead of the topdir?)

Offline

#12 2005-04-21 11:24:49

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

I found that I couldn't give up on this, so I found another kludge - one that I hate less than the others... roll

I've put it into the following PKGBUILD:

# Contributor: Tom Killian <tomk@runbox.com>

pkgname=ipsec-tools
pkgver=0.5.1
pkgrel=1
pkgdesc="IPsec-Tools is a port of KAME's IPsec utilities to the Linux-2.6 IPsec implementation"
pkgurl="http://ipsec-tools.sourceforge.net"
source=(http://heanet.dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2)
md5sums=(62477669b3bbaaff7682f077aafca856)

build() {
  # Kludge to accommodate ipsec-tools include requirements  
  mv /usr/include/asm/errno.h /usr/include/asm/errno.h.orig
  cp /usr/src/linux-`uname -r`/include/asm/errno.h /usr/include/asm
  ln -s /usr/src/linux-`uname -r`/include/asm-generic /usr/include/asm-generic

  # Now we can build
  cd $startdir/src/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make || return 1
  make DESTDIR=$startdir/pkg install

  # Undo kludge
  mv /usr/include/asm/errno.h.orig /usr/include/asm/errno.h
  rm /usr/include/asm-generic
}

I'm sure this is breaking all sorts of rules, but everything compiles, and I get a package at the end of it, like this:

Package

Offline

#13 2005-04-21 14:03:03

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

............. and then I try to install it, and I get this:

# pacman -A *gz
loading package data... done.
checking for file conflicts... 
error: the following file conflicts were found:
  ipsec-tools: /usr/man/man8/setkey.8.gz: exists in filesystem


errors occurred, no packages were upgraded.

It turns out that the setkey man page is provided by the iputils package, even though that package does not include setkey itself. Seems a bit odd to me, but I can do -Af for the moment.

Offline

#14 2005-06-14 07:36:40

Nickm
Member
From: Netherlands
Registered: 2003-02-25
Posts: 106

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Hope you don't that I reply a lot later to this, but I experienced the same problem, and it was solved using adding --with-kernel-headers=/usr/include to configure.

Offline

#15 2005-06-14 10:33:10

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem compiling ipsec-tools [SOLVED (kind of..)]

Cheers Nickm. I saw your thread alright - I just don't need the package anymore!

Thanks anyway.

Offline

Board footer

Powered by FluxBB