# Error compiling hostapd



## mikro (Oct 11, 2013)

Hi, I am willing to hack hostapd and got en error:


```
:/root/work/wpa/hostapd # cp defconfig .config
:/root/work/wpa/hostapd # gmake
../src/ap/iapp.c:46:30: warning: netpacket/packet.h: No such file or directory
../src/ap/iapp.c: In function 'iapp_init':
../src/ap/iapp.c:394: error: storage size of 'addr' isn't known
../src/ap/iapp.c:424: error: 'struct ifreq' has no member named 'ifr_ifindex'
../src/ap/iapp.c:468: error: 'SOL_IP' undeclared (first use in this function)
../src/ap/iapp.c:468: error: (Each undeclared identifier is reported only once
../src/ap/iapp.c:468: error: for each function it appears in.)
../src/ap/iapp.c:475: error: 'PF_PACKET' undeclared (first use in this function)
../src/ap/iapp.c:483: error: 'AF_PACKET' undeclared (first use in this function)
../src/ap/iapp.c:394: warning: unused variable 'addr'
../src/ap/iapp.c: In function 'iapp_deinit':
../src/ap/iapp.c:522: error: 'SOL_IP' undeclared (first use in this function)
gmake: *** [../src/ap/iapp.o] Error 1
```


----------



## SirDice (Oct 11, 2013)

We have our own modified hostapd. 

http://svnweb.freebsd.org/base/head/contrib/wpa/hostapd/


----------



## mikro (Oct 11, 2013)

Thanks SirDice, but it failed to compile with the same error.


----------



## cpm@ (Oct 11, 2013)

Try using make(1)(): `# cd /usr/src/contrib/wpa/hostapd/ && make`


----------



## mikro (Oct 11, 2013)

cpu82 said:
			
		

> Try using make(1)(): `# cd /usr/src/contrib/wpa/hostapd/ && make`




```
:/root/work/wpa2/wpa/hostapd # make
"Makefile", line 1: Need an operator
"Makefile", line 3: Need an operator
"Makefile", line 5: Need an operator
"Makefile", line 7: Need an operator
"Makefile", line 16: Need an operator
"Makefile", line 18: Need an operator
"Makefile", line 19: Need an operator
"Makefile", line 21: Need an operator
"Makefile", line 23: Need an operator
"Makefile", line 24: Need an operator
"Makefile", line 26: Missing dependency operator
"Makefile", line 28: Need an operator
"Makefile", line 30: Need an operator
"Makefile", line 33: Need an operator
"Makefile", line 63: Need an operator
```


----------



## ShelLuser (Oct 12, 2013)

This doesn't work with make, you'll need gmake which can be found in the ports collection: devel/gmake.


----------



## cpm@ (Oct 12, 2013)

Please, show the output line of  `% uname -a`

Try using gmake(1)() as previously @ShelLuser has proposed.

Check that you have uncommented this line in /usr/src/contrib/wpa/hostapd/defconfig

```
CONFIG_IAPP=y
```

Furthermore, run `# make clean` before you try to compile it again.


----------



## mikro (Oct 13, 2013)

```
# uname -a
FreeBSD borys 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Tue Oct  1 19:58:59 EEST 2013     root@:/usr/obj/usr/src/sys/GENERIC  amd64
```

`gmake clean` 


```
# gmake
../src/ap/iapp.c:46:30: warning: netpacket/packet.h: No such file or directory
../src/ap/iapp.c: In function 'iapp_init':
../src/ap/iapp.c:394: error: storage size of 'addr' isn't known
../src/ap/iapp.c:424: error: 'struct ifreq' has no member named 'ifr_ifindex'
../src/ap/iapp.c:468: error: 'SOL_IP' undeclared (first use in this function)
../src/ap/iapp.c:468: error: (Each undeclared identifier is reported only once
../src/ap/iapp.c:468: error: for each function it appears in.)
../src/ap/iapp.c:475: error: 'PF_PACKET' undeclared (first use in this function)
../src/ap/iapp.c:483: error: 'AF_PACKET' undeclared (first use in this function)
../src/ap/iapp.c:394: warning: unused variable 'addr'
../src/ap/iapp.c: In function 'iapp_deinit':
../src/ap/iapp.c:522: error: 'SOL_IP' undeclared (first use in this function)
gmake: *** [../src/ap/iapp.o] Error 1
```

CONFIG_IAPP=y uncommented in .config


----------



## wblock@ (Oct 13, 2013)

Do you have a complete source tree?  gmake should not be required to build the base system version.


----------



## wblock@ (Oct 13, 2013)

The FreeBSD Makefile is /usr/src/usr.sbin/wpa/hostapd.  Start there.


----------



## cpm@ (Oct 13, 2013)

Seems that he need populate his /usr/src again. So, your next step is download the complete source tree using svn(1)() method as is well explained in section A.5. Using Subversion of the FreeBSD Handbook.

```
# mv /usr/src /usr/src.old
# svn checkout https://svn0.us-west.freebsd.org/base/releng/9.1/ /usr/src
```


----------



## cpm@ (Oct 13, 2013)

wblock@ said:
			
		

> gmake should not be required to build the base system version.



@wblock@: Where I can corroborate this expectation?


----------



## wblock@ (Oct 13, 2013)

The base system can be built without devel/gmake, and /usr/sbin/hostapd is part of the base.


----------



## cpm@ (Oct 13, 2013)

wblock@ said:
			
		

> The base system can be built without devel/gmake, and /usr/sbin/hostapd is part of the base.



Thanks for your input, @wblock@. Also, per take a look to /usr/src/usr.sbin/wpa/hostapd/Makefile anyone can guess that is a generic Makefile for *BSD make(1)().

Therefore, only the net/hostapd uses gmake(1)() instead make(1)() to be build.

```
[CMD]% make build-depends-list -C /usr/ports/net/hostapd/[/CMD]
/usr/ports/devel/gmake
```


----------



## ShelLuser (Oct 13, 2013)

wblock@ said:
			
		

> The base system can be built without devel/gmake, and /usr/sbin/hostapd is part of the base.


True, I've also been pondering about this.

I get the impression that the whole source code is included in the source tree, but that the actual building isn't done using its own Makefile but another higher up in the tree. For example; many sections come with their own configure file (see /usr/sys/contrib/opie for example) but those cannot be used on a readonly file system.

Yet those parts also get build, and without problems.


----------



## mikro (Oct 14, 2013)

wblock@ said:
			
		

> The FreeBSD Makefile is /usr/src/usr.sbin/wpa/hostapd.  Start there.


Thanks, it works!


----------

