Hi,
    I modified several positions, then the make can be done successfully with 
some minor problems, the details list below:

one is in the vpp.mk
--------------------------------------------------------------------------------------------
user@vpp-compiler:~/vpp1810$ git diff
diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk
index 2a1b9a7..288ed65 100644
--- a/build-data/packages/vpp.mk
+++ b/build-data/packages/vpp.mk
@@ -31,6 +31,12 @@ vpp_cmake_args += 
-DCMAKE_PREFIX_PATH:PATH="$(vpp_cmake_prefix_path)"
 ifeq ("$(V)","1")
 vpp_cmake_args += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
 endif
+ifneq ("$(PLATFORM)","native")
+vpp_cmake_args += 
-DCMAKE_TOOLCHAIN_FILE="$(WS_ROOT)/src/cmake/$(PLATFORM)_toolchain.cmake"
+vpp_cmake_args += -DPYTHON_INCLUDE_DIR="/usr/include/python2.7"
+vpp_cmake_args += -DPYTHON_LIBRARY="/usr/lib/libpython2.7.so"
+vpp_cmake_args += 
-DDPDK_INCLUDE_DIR:PATH="$(vpp_cmake_prefix_path)/include/dpdk"
+endif
 
 # Use devtoolset on centos 7
 ifneq ($(wildcard /opt/rh/devtoolset-7/enable),) 
 
------------------------------------------------------------------------------------------

one is in the src/cmake, we add a file named arm32_toolchain.cmake
 
------------------------------------------------------------------------------------------
user@vpp-compiler:~/vpp1810$ cat src/cmake/arm32_toolchain.cmake
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "arm")

# specify the cross compiler
set(CMAKE_C_COMPILER 
"/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/arm-marvell-linux-gnueabi-gcc")

# where is the target environment
set(CMAKE_SYSROOT 
"/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/arm-marvell-linux-gnueabi/libc")
set(CMAKE_FIND_ROOT_PATH 
"/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/arm-marvell-linux-gnueabi/libc")
#set(CMAKE_FIND_ROOT_PATH  
"/home/user/iproc_ARMv7_glibc/usr/arm-broadcom-linux-gnueabi/sysroot")

# search for programs in the build host directories (not necessary)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set( THREADS_PTHREAD_ARG "PLEASE_FILL_OUT-FAILED_TO_RUN" CACHE STRING "Result 
from TRY_RUN" FORCE)
---------------------------------------------------------------------------------------------

the compilation process:
--------------------------------------------------------------------------------------------
user@vpp-compiler:~/vpp1810$ make V=1 PLATFORM=arm32 build
make[1]: Entering directory '/home/user/vpp1810/build-root'
@@@@ Arch for platform 'arm32' is native @@@@
@@@@ Finding source for external @@@@
@@@@ Makefile fragment found in 
/home/user/vpp1810/build-data/packages/external.mk @@@@
@@@@ Source found in /home/user/vpp1810/build @@@@
@@@@ Arch for platform 'arm32' is native @@@@
@@@@ Finding source for vpp @@@@
@@@@ Makefile fragment found in /home/user/vpp1810/build-data/packages/vpp.mk 
@@@@
@@@@ Source found in /home/user/vpp1810/src @@@@
@@@@ Configuring external in 
/home/user/vpp1810/build-root/build-arm32_debug-native/external @@@@

@@@@ Building external in 
/home/user/vpp1810/build-root/build-arm32_debug-native/external @@@@
make[2]: Entering directory '/home/user/vpp1810/build/external'
make check-deb
make[3]: Entering directory '/home/user/vpp1810/build/external'
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
rule.
make[3]: Nothing to be done for 'check-deb'.
make[3]: Leaving directory '/home/user/vpp1810/build/external'
make[2]: Leaving directory '/home/user/vpp1810/build/external'
@@@@ Installing external @@@@
make[2]: Entering directory '/home/user/vpp1810/build/external'
make[2]: Nothing to be done for 'ebuild-install'.
make[2]: Leaving directory '/home/user/vpp1810/build/external'
@@@@ Configuring vpp in 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp @@@@
-- The C compiler identification is GNU 4.6.4
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for ccache
-- Looking for ccache - found
-- Performing Test compiler_flag_no_address_of_packed_member
-- Performing Test compiler_flag_no_address_of_packed_member - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Found Threads: TRUE  
-- Performing Test HAVE_MEMFD_CREATE
-- Performing Test HAVE_MEMFD_CREATE - Failed
-- The ASM compiler identification is GNU
-- Found assembler: 
/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/arm-marvell-linux-gnueabi-gcc
-- Looking for mbedTLS
-- -- mbedTLS not found - tlsmbedtls_plugin disabled
-- Marvell MUSDK not found - marvell_plugin disabled
-- DPDK not found - dpdk disabled
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", 
minimum required is "2.7") 
-- Found PythonLibs: /usr/lib/libpython2.7.so (found suitable version "2.7.12", 
minimum required is "2.7") 
-- Configuration:
VPP version         : 18.10-19~ga8e3001-dirty
VPP library version : 18.10
GIT toplevel dir    : /home/user/vpp1810
C flags             : -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 
-march=armv7-a -fstack-protector-all -fPIC -Werror
Linker flags        : -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 
-march=armv7-a -fstack-protector-all -fPIC -Werror
Target processor    : arm
Build type          : 
Prefix path         : 
/opt/vpp/external/x86_64;/home/user/vpp1810/build-root/install-arm32_debug-native/external
Install prefix      : 
/home/user/vpp1810/build-root/install-arm32_debug-native/vpp
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_VERBOSE_MAKEFILE


-- Build files have been written to: 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp
@@@@ Building vpp in /home/user/vpp1810/build-root/build-arm32_debug-native/vpp 
@@@@
--------------------------------------------------------------------------------------------

Please help me to check if these modifications is appropriate~_~
 
Something what I don't resolve or have a little confused:
1. during the make process there are some errors or warnings like below, how 
can I eliminate these errors:
---------------------------------------------------------------------
 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp/CMakeFiles/CMakeTmp/CheckSymbolExists.c:13:
 undefined reference to `pthread_create'
collect2: ld returned 1 exit status
ninja: build stopped: subcommand failed.

File 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if compiler accepts -pthread returned PLEASE_FILL_OUT-FAILED_TO_RUN 
instead of 2. The compiler had the following output:
Change Dir: 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_ceb0c"
[1/2] Building C object CMakeFiles/cmTC_ceb0c.dir/CheckForPthreads.c.o
[2/2] Linking C executable cmTC_ceb0c


Performing C SOURCE FILE Test HAVE_MEMFD_CREATE failed with the following 
output:
Change Dir: 
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_33ca2"
[1/2] Building C object CMakeFiles/cmTC_33ca2.dir/src.c.o
[2/2] Linking C executable cmTC_33ca2
FAILED: : && 
/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/arm-marvell-linux-gnueabi-gcc
  
--sysroot=/home/user/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/arm-marvell-linux-gnueabi/libc
 -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -DVLIB_MAX_CPUS=4 -march=armv7-a 
-fstack-protector-all -fPIC -Werror -DHAVE_MEMFD_CREATE   
CMakeFiles/cmTC_33ca2.dir/src.c.o  -o cmTC_33ca2   && :
CMakeFiles/cmTC_33ca2.dir/src.c.o: In function `main':
/home/user/vpp1810/build-root/build-arm32_debug-native/vpp/CMakeFiles/CMakeTmp/src.c:4:
 undefined reference to `memfd_create'
collect2: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Source file was:

  #define _GNU_SOURCE
  #include <sys/mman.h>
  int main() { return memfd_create ("/dev/false", 0); }   
------------------------------------------------------------------------------------

2. I found DPDK compilation wasn't executed, it's not the same as vpp 18.07, 
how can I use it with vpp? 
Should I download it in the vpp directoty or other directory?
Can I modify some positons or files to download and compile it automatically 
with vpp? 
If it can,  please give me some examples,  thanks!!





saint_...@aliyun.com
 
From: saint_...@aliyun.com
Date: 2018-12-20 10:09
To: dbarach; Andrew Pinski; dmar...@me.com
CC: vpp-dev
Subject: Re: Re: [vpp-dev] regarding cross compiling
Thanks to all who have helped, I am trying,  will resend the result later.



saint_...@aliyun.com
 
From: Dave Barach via Lists.Fd.Io
Date: 2018-12-20 00:29
To: Andrew Pinski; dmar...@me.com
CC: vpp-dev
Subject: Re: [vpp-dev] regarding cross compiling
Please give the instructions at 
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling
 a try and let us know what happens. 
 
Suffice it to say that the vpp committer community saw sufficient value in 
switching to cmake to do so.
 
D. 
 
-----Original Message-----
From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Andrew Pinski
Sent: Wednesday, December 19, 2018 10:40 AM
To: dmar...@me.com
Cc: Saxena, Nitin <nitin.sax...@cavium.com>; vpp-dev@lists.fd.io
Subject: Re: [vpp-dev] regarding cross compiling
 
On Wed, Dec 19, 2018 at 8:54 AM Damjan Marion via Lists.Fd.Io 
<dmarion=me....@lists.fd.io> wrote:
>
> i
>
> On 19 Dec 2018, at 14:00, Saxena, Nitin <nitin.sax...@cavium.com> wrote:
>
> Hi Damjan,
>
> >>Somebody needs to spend a bit of time to teach CMake how to properly 
> >>cross-compile....
>
> Correct me if I am wrong but I think cross-compilation support was there 
> before CMake transition.
>
> I guess so, never used it...
 
I am still disappointed moving away from autotools.  CMake has too much junk 
science of getting it right; autotools just work for all of these special cases.
Yes it is a bit slower to build with autotools but it makes cross compiling and 
debugging what is going wrong with the build easier.
 
>
> Also I am not finding capability to link VPP with externally compiled 
> dpdk? Am I correct or missing anything
>
> You can just specify -DCMAKE_INSTALL_PREFIX:PATH=..... to the tree where dpdk 
> tree is.
> That is what we do today with /opt/vpp/external/$(uname -m)/
 
Also it makes help messages from configure easier to find the needed options 
including but not limited to the above.  Having reading cmake files in the past 
and autoconfig files, the autoconf is easier to understand and understand how 
it works.  Also autoconf is standard, while cmake is very much unstandardized 
when it comes to finding headers, etc.  You need to pull in a library, here 
have a weird cmake file which might or might not work.
 
Thanks,
Andrew Pinski
 
>
> --
> Damjan
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
>
> View/Reply Online (#11694): 
> https://lists.fd.io/g/vpp-dev/message/11694
> Mute This Topic: https://lists.fd.io/mt/28800506/912176
> Group Owner: vpp-dev+ow...@lists.fd.io
> Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [pins...@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
 
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
 
View/Reply Online (#11700): https://lists.fd.io/g/vpp-dev/message/11700
Mute This Topic: https://lists.fd.io/mt/28800506/1454168
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [saint_...@aliyun.com]
-=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11753): https://lists.fd.io/g/vpp-dev/message/11753
Mute This Topic: https://lists.fd.io/mt/28800506/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to