cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
eric.zimmerman
Visitor
Visitor
2,903 Views
Registered: ‎09-20-2018

Xilinx SDK 2017.4 CMake

Jump to solution

I am looking to cross-compile linux applications from Windows for petalinux on the Picozed using CMake.

I am able to use the Xilinx SDK to successfully build a linux application, but I have been unable to get cmake to work successfully.

 

Has anyone done this successfully?

If so, could you share the command-line you use and toolchain file?

 

Specifically, CMake seems to be failing on 'Detecting CXX complier ABI info'.

I am also not certain what the proper CMake generator is supposed to be or how to translate the compile options that the SDK uses (e.g. -Wall -O0 -g3 -c -fmessage-length=0 -MT"$@")

0 Kudos
Reply
1 Solution

Accepted Solutions
eric.zimmerman
Visitor
Visitor
2,856 Views
Registered: ‎09-20-2018

I was able to get it to build!

 

The CACHE portions were what I was missing so alternate make/compilers were being used.

Some additional configuration is needed if you want to regen the Eclipse project... haven't gotten to that yet.

 

Here is the toolchain file that I used:

SET(CMAKE_SYSTEM_NAME "Linux")
SET(CMAKE_SYSTEM_VERSION 1)

set (CMAKE_SYSTEM_NAME      "Linux")

# specify the cross compiler
set (CMAKE_SYSTEM_PROCESSOR "arm")
set (CROSS_PREFIX           "arm-linux-gnueabihf-")

set (CMAKE_MAKE_PROGRAM     "C:/Xilinx/SDK/2017.4/gnuwin/bin/make.exe" CACHE PATH "" FORCE)
set (CMAKE_C_COMPILER       "${CROSS_PREFIX}gcc" CACHE PATH "" FORCE)
set (CMAKE_CXX_COMPILER     "${CROSS_PREFIX}g++" CACHE PATH "" FORCE)
set (CMAKE_ASM_COMPILER     "${CROSS_PREFIX}gcc" CACHE PATH "" FORCE)
set (CMAKE_AR               "${CROSS_PREFIX}ar" CACHE FILEPATH "Archiver")

set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM	NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY	NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE	NEVER)

Build steps:

1. cd /path/to/<example1 folder>
2. mkdir build-zynq-linux
3. cd build-zynq-linux

# cmake <source directory> -DCMAKE_TOOLCHAIN_FILE=<path/to/toolchain-file> -G<generator name>
4. cmake .. -DCMAKE_TOOLCHAIN_FILE=..\cmake\zynq-linux-toolchain.cmake -G"Unix Makefiles"

# perform the build
5. cmake --build .

View solution in original post

1 Reply
eric.zimmerman
Visitor
Visitor
2,857 Views
Registered: ‎09-20-2018

I was able to get it to build!

 

The CACHE portions were what I was missing so alternate make/compilers were being used.

Some additional configuration is needed if you want to regen the Eclipse project... haven't gotten to that yet.

 

Here is the toolchain file that I used:

SET(CMAKE_SYSTEM_NAME "Linux")
SET(CMAKE_SYSTEM_VERSION 1)

set (CMAKE_SYSTEM_NAME      "Linux")

# specify the cross compiler
set (CMAKE_SYSTEM_PROCESSOR "arm")
set (CROSS_PREFIX           "arm-linux-gnueabihf-")

set (CMAKE_MAKE_PROGRAM     "C:/Xilinx/SDK/2017.4/gnuwin/bin/make.exe" CACHE PATH "" FORCE)
set (CMAKE_C_COMPILER       "${CROSS_PREFIX}gcc" CACHE PATH "" FORCE)
set (CMAKE_CXX_COMPILER     "${CROSS_PREFIX}g++" CACHE PATH "" FORCE)
set (CMAKE_ASM_COMPILER     "${CROSS_PREFIX}gcc" CACHE PATH "" FORCE)
set (CMAKE_AR               "${CROSS_PREFIX}ar" CACHE FILEPATH "Archiver")

set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM	NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY	NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE	NEVER)

Build steps:

1. cd /path/to/<example1 folder>
2. mkdir build-zynq-linux
3. cd build-zynq-linux

# cmake <source directory> -DCMAKE_TOOLCHAIN_FILE=<path/to/toolchain-file> -G<generator name>
4. cmake .. -DCMAKE_TOOLCHAIN_FILE=..\cmake\zynq-linux-toolchain.cmake -G"Unix Makefiles"

# perform the build
5. cmake --build .

View solution in original post