# error building kernel with ipsec

## friley

I get the following error when trying to build 2.4.19-gentoo-r9 with ipsec. All the .o's are in /usr/src/linux/net/ipsec/. Anyone know what I'm doing wrong?

net/network.o: In function `ipsec_init':

net/network.o(.text+0x3e662): undefined reference to `ipsec_prng'

net/network.o: In function `ipsec_cleanup':

net/network.o(.text+0x3e6ff): undefined reference to `ipsec_prng'

net/network.o: In function `ipsec_tunnel_start_xmit':

net/network.o(.text+0x428a8): undefined reference to `ipsec_prng'

net/network.o: In function `pfkey_ipsec_sa_init':

net/network.o(.text+0x46118): undefined reference to `ipsec_prng'

net/network.o: In function `pfkey_getspi_parse':

net/network.o(.text+0x465fc): undefined reference to `ipsec_prng'

net/network.o: In function `pfkey_sa_process':

net/network.o(.text+0x49598): undefined reference to `pfkey_alloc_ipsec_sa'

net/network.o: In function `pfkey_address_process':

net/network.o(.text+0x497fb): undefined reference to `pfkey_alloc_ipsec_sa'

net/network.o(.text+0x4982f): undefined reference to `pfkey_alloc_eroute'

net/network.o(.text+0x49859): undefined reference to `pfkey_alloc_eroute'

net/network.o(.text+0x4987e): undefined reference to `pfkey_alloc_eroute'

net/network.o(.text+0x4989f): undefined reference to `pfkey_alloc_eroute'

net/network.o: In function `pfkey_x_satype_process':

net/network.o(.text+0x49c6e): undefined reference to `pfkey_alloc_ipsec_sa'

make: *** [vmlinux] Error 1

----------

## dreamer3

Have you tried (make sure you backup your .config file first) running make mrproper to totally clean the source tree before compiling?

I had an issue once where a certain part of the kernel would never compile that was fixed by running make mrproper and then trying again.

----------

## friley

 *dreamer3 wrote:*   

> Have you tried (make sure you backup your .config file first) running make mrproper to totally clean the source tree before compiling?

 

Yes, I tried it twice to make sure I didn't do it wrong the first time.

----------

## securiteaze

You could try it with vanilla-sources, worked without a hitch for me.

----------

## Xor

where do you got the ipsec addon from? (is it built in in the r9) (I use the crypto kernel with freeswan - works fine...)

----------

## friley

 *Xor wrote:*   

> where do you got the ipsec addon from? (is it built in in the r9) (I use the crypto kernel with freeswan - works fine...)

 

I'm using the gentoo-sources kernel, which has the freeswan patch applied. I'm going to try the crypto-sources kernel next.

----------

## securiteaze

You can get the IPSEC aka freeswan patch here.

----------

## friley

The crypto sources kernel builds fine. I'll just use that since it has everything else I want.

----------

## lami

I can't compile kernel with ipsec/freeswan enabled. It fails when I do not enable ipv6 (implicit declaration of some function) and when enable it, it fails when linkink on sizeof() changed. Anyone had success with it?

```
key/key.o(.data+0x120): multiple definition of `extensions_bitmaps'

ipsec/ipsec.o(.data+0xc60): first defined here

ld: Warning: size of symbol `extensions_bitmaps' changed from 272 to 288 in key/key.o

key/key.o(.data+0xe0): multiple definition of `pfkey_v2_ext_bits_c_version'

ipsec/ipsec.o(.data+0xc20): first defined here

ld: Warning: size of symbol `pfkey_v2_ext_bits_c_version' changed from 61 to 63 in key/key.o

key/key.o(.text+0x1da0): In function `pfkey_msg_free':

: multiple definition of `pfkey_msg_free'

ipsec/ipsec.o(.text+0x14340): first defined here

key/key.o(.text+0x1b20): In function `pfkey_x_kmprivate_build':

: multiple definition of `pfkey_x_kmprivate_build'

ipsec/ipsec.o(.text+0x13ea0): first defined here

key/key.o(.text+0x1a60): In function `pfkey_spirange_build':

: multiple definition of `pfkey_spirange_build'

ipsec/ipsec.o(.text+0x13de0): first defined here

key/key.o(.text+0x1d00): In function `pfkey_extensions_free':

: multiple definition of `pfkey_extensions_free'

ipsec/ipsec.o(.text+0x142a0): first defined here

key/key.o(.text+0x1870): In function `pfkey_prop_build':

: multiple definition of `pfkey_prop_build'

ipsec/ipsec.o(.text+0x13bf0): first defined here

key/key.o(.text+0x940): In function `pfkey_proto_init':

: multiple definition of `pfkey_proto_init'

ipsec/ipsec.o(.text+0x88a0): first defined here

key/key.o(.bss+0x0): multiple definition of `pfkey_registered_sockets'

ipsec/ipsec.o(.bss+0x660): first defined here

key/key.o(.text+0x1b40): In function `pfkey_x_satype_build':

: multiple definition of `pfkey_x_satype_build'

ipsec/ipsec.o(.text+0x13ec0): first defined here

key/key.o(.text+0x12f0): In function `pfkey_lifetime_build':

: multiple definition of `pfkey_lifetime_build'

ipsec/ipsec.o(.text+0x13600): first defined here

ld: Warning: size of symbol `pfkey_lifetime_build' changed from 257 to 250 in key/key.o

key/key.o(.text+0x84c0): In function `ipsec_sysctl_unregister':

: multiple definition of `ipsec_sysctl_unregister'

ipsec/ipsec.o(.text+0x7ff0): first defined here

key/key.o(.text+0x1bf0): In function `pfkey_msg_build':

: multiple definition of `pfkey_msg_build'

ipsec/ipsec.o(.text+0x140c0): first defined here

ld: Warning: size of symbol `pfkey_msg_build' changed from 439 to 231 in key/key.o

key/key.o(.text+0x0): In function `pfkey_msg_interp':

: multiple definition of `pfkey_msg_interp'

ipsec/ipsec.o(.text+0x9760): first defined here

ld: Warning: size of symbol `pfkey_msg_interp' changed from 435 to 835 in key/key.o

key/key.o(.data+0x4): multiple definition of `pfkey_open_sockets'

ipsec/ipsec.o(.data+0x8c4): first defined here

key/key.o(.text+0x1ce0): In function `pfkey_extensions_init':

: multiple definition of `pfkey_extensions_init'

ipsec/ipsec.o(.text+0x14280): first defined here

key/key.o(.text+0x710): In function `pfkey_get_info':

: multiple definition of `pfkey_get_info'

ipsec/ipsec.o(.text+0x8570): first defined here

key/key.o(.text+0x11e0): In function `pfkey_sa_build':

: multiple definition of `pfkey_sa_build'

ipsec/ipsec.o(.text+0x134f0): first defined here

key/key.o(.data+0x20): multiple definition of `pfkey_ops'

ipsec/ipsec.o(.data+0x8e0): first defined here

key/key.o(.text+0x1860): In function `pfkey_sens_build':

: multiple definition of `pfkey_sens_build'

ipsec/ipsec.o(.text+0x13be0): first defined here

key/key.o(.text+0x58a0): In function `ipsec_sa_put':

: multiple definition of `ipsec_sa_put'

ipsec/ipsec.o(.text+0x1a0): first defined here

ld: Warning: size of symbol `ipsec_sa_put' changed from 102 to 95 in key/key.o

key/key.o(.text+0x8c0): In function `pfkey_cleanup':

: multiple definition of `pfkey_cleanup'

ipsec/ipsec.o(.text+0x8790): first defined here

ld: Warning: size of symbol `pfkey_cleanup' changed from 263 to 116 in key/key.o

key/key.o(.data+0x80): multiple definition of `pfkey_v2_build_c_version'

ipsec/ipsec.o(.data+0xbe0): first defined here

ld: Warning: size of symbol `pfkey_v2_build_c_version' changed from 58 to 67 in key/key.o

key/key.o(.text+0x1690): In function `pfkey_ident_build':

: multiple definition of `pfkey_ident_build'

ipsec/ipsec.o(.text+0x13a80): first defined here

ld: Warning: size of symbol `pfkey_ident_build' changed from 339 to 464 in key/key.o

key/key.o(.text+0x350): In function `pfkey_list_remove_socket':

: multiple definition of `pfkey_list_remove_socket'

ipsec/ipsec.o(.text+0x8010): first defined here

key/key.o(.text+0x3b0): In function `pfkey_upmsg':

: multiple definition of `pfkey_upmsg'

ipsec/ipsec.o(.text+0x80c0): first defined here

ld: Warning: size of symbol `pfkey_upmsg' changed from 531 to 536 in key/key.o

key/key.o(.text+0x5d0): In function `pfkey_registered_get_info':

: multiple definition of `pfkey_registered_get_info'

ipsec/ipsec.o(.text+0x83d0): first defined here

key/key.o(.text+0x6b0): In function `pfkey_list_insert_socket':

: multiple definition of `pfkey_list_insert_socket'

ipsec/ipsec.o(.text+0x84b0): first defined here

key/key.o(.text+0x820): In function `pfkey_init':

: multiple definition of `pfkey_init'

ipsec/ipsec.o(.text+0x8680): first defined here

ld: Warning: size of symbol `pfkey_init' changed from 267 to 150 in key/key.o

key/key.o(.text+0x1100): In function `pfkey_msg_hdr_build':

: multiple definition of `pfkey_msg_hdr_build'

ipsec/ipsec.o(.text+0x13410): first defined here

key/key.o(.text+0x1960): In function `pfkey_supported_build':

: multiple definition of `pfkey_supported_build'

ipsec/ipsec.o(.text+0x13ce0): first defined here

key/key.o(.text+0x1580): In function `pfkey_key_build':

: multiple definition of `pfkey_key_build'

ipsec/ipsec.o(.text+0x13970): first defined here

key/key.o(.data+0x8): multiple definition of `pfkey_family_ops'

ipsec/ipsec.o(.data+0x8c8): first defined here

key/key.o(.data+0x0): multiple definition of `pfkey_sock_list'

ipsec/ipsec.o(.data+0x8c0): first defined here

key/key.o(.text+0x84a0): In function `ipsec_sysctl_register':

: multiple definition of `ipsec_sysctl_register'

ipsec/ipsec.o(.text+0x7fb0): first defined here

ld: Warning: size of symbol `ipsec_sysctl_register' changed from 49 to 32 in key/key.o

key/key.o(.text+0x13f0): In function `pfkey_address_build':

: multiple definition of `pfkey_address_build'

ipsec/ipsec.o(.text+0x13710): first defined here

ld: Warning: size of symbol `pfkey_address_build' changed from 599 to 400 in key/key.o

make[2]: *** [network.o] Error 1
```

----------

## simon

lami, what kernel-version do you use?

You may take a look at this thread.

Simon

----------

## lami

 *simon wrote:*   

> lami, what kernel-version do you use?

 

I use gentoo-sources 2.4.20-r2

I compiled ipsec and ipv6 as modules and it looks fine now, at least modprobe ipsec inserts module into kernel. At first case I've got undefined symbols in ipv6.o, but after rebooting with new kernel it is Ok. Strange...

----------

