0

I try to build with an Cross Compiler for Windows (minw64) on a Linux and I get the following error.

[ 90%] Built target vsl.lang.types
Scanning dependencies of target copyFoms_vslation
[ 90%] Built target copyFoms_vslation
src/vslation/CMakeFiles/vslation.Gps.dir/build.make:152: *** target pattern contains no '%'.  Stop.
CMakeFiles/Makefile2:201: recipe for target 'src/vslation/CMakeFiles/vslation.Xps.dir/all' failed
make[1]: *** [src/vslation/CMakeFiles/vslation.Xps.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I use my cmake with the following command:

cmake -DCMAKE_TOOLCHAIN_FILE=/home/vagrant/toolchain.cmake ../../src-gen

My Toolchain File looks like this:

SET(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_CROSS_COMPILING TRUE)

SET(LIBRARY_PATH /home/vagrant/mingw64/lib/)
SET(CMAKE_INCLUDE_PATH /home/vagrant/mingw64/include/)

SET(CMAKE_FIND_ROOT_PATH /home/vagrant/mingw64/)

INCLUDE_DIRECTORIES(SYSTEM
 "/home/vagrant/mingw64/include"
)

#SET(CMAKE_SYSROOT /home/vagrant/mingw64/)

# specify the cross compiler
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)

SET(CMAKE_CXX_COMPILER_AR x86_64-w64-mingw32-gcc-ar)
SET(CMAKE_CXX_COMPILER_RANLIB x86_64-w64-mingw32-gcc-ranlib)

SET(CMAKE_C_COMPILER_AR x86_64-w64-mingw32-gcc-ar)
SET(CMAKE_C_COMPILER_RANLIB x86_64-w64-mingw32-gcc-ranlib)

# Cmake Path - Version 3.12.1
SET(CMAKE_COMMAND /home/vagrant/cmake/cmake-3.12.1-Linux-x86_64/bin/cmake)
SET(CMAKE_CPACK_COMMAND /home/vagrant/cmake/cmake-3.12.1-Linux-x86_64/bin/cpack)
SET(CMAKE_CTEST_COMMAND /home/vagrant/cmake/cmake-3.12.1-Linux-x86_64/bin/ctest)
SET(CMAKE_EDIT_COMMAND /home/vagrant/cmake/cmake-3.12.1-Linux-x86_64/bin/cmake-gui)

# Rti Libs
SET(RTI_INCLUDE_DIRS /home/vagrant/mingw64/include/rti1516e)

# Poco Libs
SET(PocoFoundation_DIR /home/vagrant/mingw64/lib/cmake/Poco)
SET(PocoJSON_DIR /home/vagrant/vagrant/lib/cmake/Poco)
SET(PocoNet_DIR /home/vagrant/vagrant/lib/cmake/Poco)
SET(PocoUtil_DIR /home/vagrant/vagrant/lib/cmake/Poco)
SET(PocoXML_DIR /home/vagrant/vagrant/lib/cmake/Poco)
SET(Poco_DIR /home/vagrant/vagrant/lib/cmake/Poco)

# Pvsomip Libs
SET(vsomeip_DIR /home/vagrant/mingw64/lib/cmake/vsomeip)

# search for programs in the build host directories
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(CMAKE_INSTALL_RPATH )

I try to save the libraries seperated. Dont be curios about library configuration in the toolcahin.cmake

This is the CMakeLists.txt. I hope it could help.

cmake_minimum_required(VERSION 3.4)

if(MSVC)
    message(FATAL_ERROR "MSVC not supported")
endif()

if(${CMAKE_CXX_COMPILER} MATCHES "mingw64")
    set(MINGW64 true)
    set(FMU_BINARY_DIR binaries/win64)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPOCO_WIN32_UTF8")
elseif(${CMAKE_CXX_COMPILER} MATCHES "mingw32")
    set(MINGW32 true)
    set(FMU_BINARY_DIR binaries/win32)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPOCO_WIN32_UTF8")
else()
    set(USE_VSOMEIP true)
    set(FMU_BINARY_DIR binaries/linux64)
endif()

find_path(RTI_INCLUDE_DIRS NAMES RTI
 PATH_SUFFIXES include/rti1516e
 DOC "The rti1516e include files"
)
if(RTI_INCLUDE_DIRS)
  #message(STATUS "rti1516e headers found: ${RTI_INCLUDE_DIRS}")
else()
  message(FATAL_ERROR "rti1516e headers NOT found")
endif (RTI_INCLUDE_DIRS)
set(RTI_LIBRARIES rti1516e fedtime1516e)

find_package(Poco 1.8.1 COMPONENTS Util JSON Net Foundation REQUIRED)
if(USE_VSOMEIP)
    find_package (vsomeip 2.6.2 REQUIRED)
    include_directories(include ${RTI_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS} ${VSOMEIP_INCLUDE_DIRS})
    set(LIBS ${RTI_LIBRARIES} ${Poco_LIBRARIES} ${VSOMEIP_LIBRARIES})
else()
    include_directories(include ${RTI_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS})
    set(LIBS ${RTI_LIBRARIES} ${Poco_LIBRARIES})
endif()

set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -s")
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -U__STRICT_ANSI__ -DRTI_USES_STD_FSTREAM -Wno-deprecated -Wno-deprecated-declarations")

subdirs(src/model src/gtl/lang/manager src/vslation src/gtl/lang/types )
GreenJenks
  • 111
  • 1
  • 9
  • And what content of line `src/vslation/CMakeFiles/vslation.Gps.dir/build.make:152`, referenced by the error message, is? Add this line into your question post. – Tsyvarev Sep 10 '18 at 12:01
  • This is the message from line 152 - 156 `src/vslation/vslation.Gps.exe: Poco::Util-NOTFOUND src/vslation/vslation.Gps.exe: Poco::JSON-NOTFOUND src/vslation/vslation.Gps.exe: Poco::Net-NOTFOUND src/vslation/vslation.Gps.exe: Poco::XML-NOTFOUND src/vslation/vslation.Gps.exe: Poco::Foundation-NOTFOUND` – GreenJenks Sep 10 '18 at 12:47
  • `Poco::Util-NOTFOUND` means that corresponded Poco library hasn't be found by CMake. Normally, CMake itself complains about using of "NOTFOUND" in `target_link_libraries`, but your case seems to be different: the problem has been caught only at build stage. – Tsyvarev Sep 10 '18 at 13:30
  • Yes, thats strange. All the missing libraries are availabale. Do I miss something in my toolchain.cmake? We have already the compiler for Windows. The build.make looks with the build in Windows fine `src/simulation/simulation.Gps.exe: W:/msys64/mingw64/lib/libPocoUtil.dll.a src/simulation/simulation.Gps.exe: W:/msys64/mingw64/lib/libPocoJSON.dll.a src/simulation/simulation.Gps.exe: W:/msys64/mingw64/lib/libPocoNet.dll.a src/simulation/simulation.Gps.exe: W:/msys64/mingw64/lib/libPocoXML.dll.a` – GreenJenks Sep 10 '18 at 13:36
  • You set `CMAKE_FIND_ROOT_PATH_MODE_LIBRARY` to only, so libraries are searched only under directories listed in `CMAKE_FIND_ROOT_PATH` variable. See that question and my answer for it for more details: https://stackoverflow.com/questions/35791251/possible-causes-for-boost-not-being-found-by-cmake-in-certain-situations. – Tsyvarev Sep 10 '18 at 13:42
  • I have already these configurations. – GreenJenks Sep 10 '18 at 14:14
  • Oops, just notice that you already have paths to the Poco library hardcoded in the toolchain. For resolving why they don't work as expected... we need to view their usage in `CMakeLists.txt`. Please, add corresponded code **into the question post** (via [edit]ing it). – Tsyvarev Sep 10 '18 at 14:26

0 Answers0