xref: /f-stack/doc/F-Stack_Build_Guide.md (revision d30ea906)
1# F-Stack Build GUide
2
3The procedures to compile f-stack in different linux releases is almost the same, but there are still some points you need to pay attention to. This document aims to help you solve some of the problems you may meet when compiling f-stack in different linux releases.
4
5```sh
6$ sudo -i
7# in centos and redhat
8$ yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel python
9# in ubuntu
10$ apt-get install git gcc openssl libssl-dev linux-headers-$(uname -r) bc libnuma1 libnuma-dev libpcre3 libpcre3-dev zlib1g-dev python
11
12$ mkdir /data/f-stack
13$ git clone https://github.com/F-Stack/f-stack.git /data/f-stack
14
15# compile dpdk
16$ cd /data/f-stack/dpdk
17$ make config T=x86_64-native-linuxapp-gcc
18$ make
19
20# Compile f-stack lib
21$ export FF_PATH=/data/f-stack
22$ export FF_DPDK=/data/f-stack/dpdk/build
23$ cd /data/f-stack/lib
24$ make
25
26# Compile Nginx
27$ cd ../app/nginx-1.11.10
28$ ./configure --prefix=/usr/local/nginx_fstack --with-ff_module
29$ make
30$ make install
31
32# Compile Redis
33$ cd ../redis-3.2.8
34$ make
35
36# Compile f-stack tools
37$ cd ../../tools
38$ make
39
40# Compile helloworld examples
41$ cd ../examples
42$ make
43```
44
45## Compile Nginx in Ubuntu
46
47- before make Nginx, remove -Werror from CFLAGS at app/nginx-1.11.10/objs/Makefile line 3. (you should run ./configure command first to generate Makefile) (fixed in 2018/07/23)
48
49```
50-   CFLAGS = -pipe -Os -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
51+   CFLAGS = -pipe -Os -W -Wall -Wpointer-arith -Wno-unused-parameter -g
52```
53
54- remove '\\' in statement printf at f-stack/tools/netstat/Makefile line 70, now it should be:
55
56```
57-   printf("\#define\tN%s\t%s\n", toupper($$2), i++);
58+   printf("#define\tN%s\t%s\n", toupper($$2), i++);
59```
60
61## Compile Redis in Ubuntu 18.04 (fixed in 2018/07/10)
62
63- add an extra Macros to STD in f-stack/app/redis-3.2.8/src/Makefile line 28, and now it should be:
64
65```
66-   STD=-std=c99 -pedantic -DREDIS_STATIC=''
67+   STD=-std=c99 -pedantic -DREDIS_STATIC='' -D_POSIX_C_SOURCE=199506L
68```
69
70## Compile Nginx in Ubuntu 18.04
71
72- there will be a lot of warnings when compiling Nginx in Ubuntu 18.04, and sometimes it may fail, you'd better configure with the following command:
73
74```
75    ./configure --prefix=/usr/local/nginx_fstack --with-ff_module --with-cc-opt="-Wno-implicit-fallthrough -Wno-unused-result"
76```
77
78## Compile DPDK in CentOS 7.5 and RHEL 7.5
79
80- struct member 'ndo_change_mtu' in struct net_device_ops has been renamed to 'ndo_change_mtu_rh74', f-stack/dpdk/lib/librte_eal/linuxapp/kni/kni_net.c line 704 should also be updated:
81
82```
83-   .ndo_change_mtu = kni_net_change_mtu,
84+   .ndo_change_mtu_rh74 = kni_net_change_mtu,
85```
86
87## Compile dpdk in virtual machine
88
89- f-stack/dpdk/lib/librte_eal/linuxapp/igb_uio/igb_uio.c line 279:
90```
91
92-   if (pci_intx_mask_supported(udev->pdev)) {
93+   if (true || pci_intx_mask_supported(udev->pdev)) {
94```