[CMake] Add support for cross compiling to VxWorks

Kuhl, Brian brian.kuhl at windriver.com
Wed Dec 30 15:38:02 EST 2015


Hi CMake Experts,
I'm trying to add support for VxWorks to CMake. 
My current dilemma is that the Compiler ID link test is failing because my library link path isn't being used, and libraries aren't being found. 
I've set the library path in all the obvious places ( or so I thought,) what setting am I missing?
Why isn't CMAKE_C_LINK_FLAGS  being used? 
My end goal is to compile Eigen and  OpenCV

Best of the season, and thanks,

Brian Kuhl
Manager, Technical Content Engineering
Wind River
----------------------------------------build log------------------------------------------
building EIGEN: eigen
cd C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b && C:/git/vx7-ux-ports/vxworks-7/host/binutils/x86-win32/bin/make -f vxworks.lib.mak CPU=SIMNT TOOL=gnu TOOL_VERSION=gnu_4_8_1 _CC_VERSION=gnu_4_8_1_5 _WRS_CONFIG_ENDIAN=little _WRS_CONFIG_FP=hard VSB_DIR=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64 ROOT_DIR=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/root VXE=eigen _mk
make[3]: Entering directory 'C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b'
C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/CMake/bin/cmake -DCMAKE_TOOLCHAIN_FILE=vxworks-env.cmake
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/ccpentium.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_2d1fb\fast"
-- Check for working C compiler: C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/ccpentium.exe -- broken
CMake Error at C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler
  "C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/ccpentium.exe" is
  not able to compile a simple test program.
  It fails with the following output:
   Change Dir: C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/CMakeTmp
  
  Run Build Command:"nmake" "/NOLOGO" "cmTC_2d1fb\fast"
  The system cannot find the file specified
  Generator: execution of make failed.  Make command was: "nmake" "/NOLOGO"
  "cmTC_2d1fb\fast"
  
  
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/CMakeOutput.log".
See also "C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/CMakeError.log".
vxworks.lib.mak:26: recipe for target 'cmake_build' failed

----------------------------- a generated vxworks-env.cmake --------------------------

SET(CMAKE_SYSTEM_NAME  VxWorks)             
SET(CMAKE_SYSTEM_VERSION  7   )              
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_C_COMPILER     C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/ccpentium.exe )        
SET(CMAKE_CXX_COMPILER   C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/c++pentium.exe )       
SET(CMAKE_C_FLAGS        -m64 -mcmodel=large -mno-red-zone -fno-implicit-fp -fno-builtin -fno-omit-frame-pointer -mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -O2 -fno-defer-pop -Wall -IC:/git/vx7-ux-ports/vxworks-7/pkgs/os/utils/unix/friend_h/ -D_WRS_CONFIG_VSB_USR_H=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h -D_VX_CPU=_VX_SIMNT -D_VX_TOOL_FAMILY=gnu -D_VX_TOOL=gnu -D_WRS_CONFIG_DEPENDS_LAYER_CMAKE -D_WRS_CONFIG_DEPENDS_LAYER_UNIX -D_nq_VSB_CONFIG_FILE=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/h/config/vsbConfig.h -save-temps -IC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/share/h -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/system -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public -I. -includeC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/autoconf_vsbConfig_quote.h )    
SET(CMAKE_CXX_FLAGS      -m64 -mcmodel=large -mno-red-zone -fno-implicit-fp -fno-builtin -fno-omit-frame-pointer -ansi -mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c++11 -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public/c++11 -O2 -fno-defer-pop -Wall -IC:/git/vx7-ux-ports/vxworks-7/pkgs/os/utils/unix/friend_h/ -D_WRS_CONFIG_VSB_USR_H=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h -D_VX_CPU=_VX_SIMNT -D_VX_TOOL_FAMILY=gnu -D_VX_TOOL=gnu -D_WRS_CONFIG_DEPENDS_LAYER_CMAKE -D_WRS_CONFIG_DEPENDS_LAYER_UNIX -D_nq_VSB_CONFIG_FILE=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/h/config/vsbConfig.h -save-temps -IC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/share/h -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/system -isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public -includeC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/autoconf_vsbConfig_quote.h )  
SET(CMAKE_C_LINK_FLAGS   -Wl,--defsym,__wrs_rtp_base=0x200000000 -mrtp -Wl,--defsym,_GLOBAL_OFFSET_TABLE_=0 -Wl,-T,C:/git/vx7-ux-ports/vxworks-7/build/tool/gnu_4_8_1/usr/ldscript.exe.lp64.SIMCOMMON -LC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/lib/common/ )  
SET(CMAKE_FIND_ROOT_PATH C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/root )      
SET(LIBS                 -lunix  -lsupc++  -lstdc++11 )           
set(CMAKE_SYSTEM_INCLUDE_PATH C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h ) 
set(CMAKE_SYSTEM_LIBRARY_PATH C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/libcommon )              
set(CMAKE_SYSTEM_PROGRAM_PATH C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/root/gnu/bin )     

-------------------------------cmake-3.4/Modules/Platform/VxWorks.cmake---------------------------

# Indicate that this is a cross compiled unix-like system
#
set(UNIX 1)
set(CMAKE_CROSSCOMPILING TRUE)
#
# Library prefixes, suffixes, extra libs.
#
set(CMAKE_LINK_LIBRARY_SUFFIX "")
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")     # lib
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")      # .a

set(CMAKE_SHARED_LIBRARY_PREFIX "lib")     # lib
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")     # .so
set(CMAKE_EXECUTABLE_SUFFIX ".vxe")        # .vxe

#set(CMAKE_DL_LIBS "dl")

#set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")


#ignor build host paths
set(CMAKE_SYSTEM_IGNORE_PATH
  /lib             /lib64             /include
  /usr/lib         /usr/lib64         /usr/include
  /usr/local/lib   /usr/local/lib64   /usr/local/include
  /usr/X11/lib     /usr/X11/lib64     /usr/X11/include
  /usr/lib/X11     /usr/lib64/X11     /usr/include/X11
  /usr/X11R6/lib   /usr/X11R6/lib64   /usr/X11R6/include
  /usr/X11R7/lib   /usr/X11R7/lib64   /usr/X11R7/include
)

# generally use C++ compiler as linker 
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )

----------------------------------- eigen-eigen-b30b87236a1b\CMakeFiles\CMakeError.log -------------------------------------

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/ccpentium.exe 
Build flags: -m64;-mcmodel=large;-mno-red-zone;-fno-implicit-fp;-fno-builtin;-fno-omit-frame-pointer;-mrtp;-fno-strict-aliasing;-D_C99;-D_HAS_C9X;-std=c99;-fasm;-O2;-fno-defer-pop;-Wall;-IC:/git/vx7-ux-ports/vxworks-7/pkgs/os/utils/unix/friend_h/;-D_WRS_CONFIG_VSB_USR_H=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h;-D_VX_CPU=_VX_SIMNT;-D_VX_TOOL_FAMILY=gnu;-D_VX_TOOL=gnu;-D_WRS_CONFIG_DEPENDS_LAYER_CMAKE;-D_WRS_CONFIG_DEPENDS_LAYER_UNIX;-D_nq_VSB_CONFIG_FILE=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/h/config/vsbConfig.h;-save-temps;-IC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/share/h;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/system;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public;-I.;-includeC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/autoconf_vsbConfig_quote.h
Id flags: 

The output was:
1
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find crt0.o
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc_internal
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc_internal
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lnet
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -ldsi
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lsyscall
collect2.exe: error: ld returned 1 exit status


The C compiler identification could not be found in "C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/3.4.0/CompilerIdC/CMakeCCompilerId.i"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/c++pentium.exe 
Build flags: -m64;-mcmodel=large;-mno-red-zone;-fno-implicit-fp;-fno-builtin;-fno-omit-frame-pointer;-ansi;-mrtp;-fno-strict-aliasing;-D_C99;-D_HAS_C9X;-std=c++11;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public/c++11;-O2;-fno-defer-pop;-Wall;-IC:/git/vx7-ux-ports/vxworks-7/pkgs/os/utils/unix/friend_h/;-D_WRS_CONFIG_VSB_USR_H=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h;-D_VX_CPU=_VX_SIMNT;-D_VX_TOOL_FAMILY=gnu;-D_VX_TOOL=gnu;-D_WRS_CONFIG_DEPENDS_LAYER_CMAKE;-D_WRS_CONFIG_DEPENDS_LAYER_UNIX;-D_nq_VSB_CONFIG_FILE=C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/h/config/vsbConfig.h;-save-temps;-IC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/share/h;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/system;-isystemC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/h/public;-includeC:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/autoconf_vsbConfig_quote.h
Id flags: 

The output was:
1
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find crt0.o
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc_internal
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lc_internal
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lnet
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -ldsi
c:/git/vx7-ux-ports/compilers/gnu-4.8.1.5/x86-win32/bin/../../lib/gcc/i586-wrs-vxworks/4.8.1/../../../../x86-win32/i586-wrs-vxworks/bin/ld.exe: cannot find -lsyscall
collect2.exe: error: ld returned 1 exit status


The CXX compiler identification could not be found in "C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/3.4.0/CompilerIdCXX/CMakeCXXCompilerId.ii"

Determining if the C compiler works failed with the following output:
Change Dir: C:/git/vx7-ux-ports/workbench-4/workspace/VSB64/usr/src/EIGEN/eigen-eigen-b30b87236a1b/CMakeFiles/CMakeTmp

Run Build Command:"nmake" "/NOLOGO" "cmTC_2d1fb\fast"
The system cannot find the file specified
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_2d1fb\fast"





More information about the CMake mailing list