I am using CMake for compiling in Linux and Windows with a specific toolchain (nios2-linux-gnu-g++.exe (Sourcery CodeBench Lite 2013.05-43) 4.7.3).
The options "-Wl,--out-implib,myapp.dll.a" and "-Wl,--major-image-version,0,--minor-image-version,0" generated from CMake to linker are invalid for compiler.
Compiler errors:
CMakeCache.txt:
# This is the CMakeCache file.
# For build in directory: t:/
# It was generated by CMake: C:/Program Files (x86)/CMake 2.8/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.
########################
# EXTERNAL cache entries
########################
Boost_ATOMICS_LIBRARY_DEBUG:FILEPATH=boost_atomic-gcc-mt-s-1_55
Boost_ATOMICS_LIBRARY_RELEASE:FILEPATH=boost_atomic-gcc-mt-s-1_55
Boost_CHRONO_LIBRARY_DEBUG:FILEPATH=boost_chrono-gcc-mt-s-1_55
Boost_CHRONO_LIBRARY_RELEASE:FILEPATH=boost_chrono-gcc-mt-s-1_55
Boost_DIR:PATH=Boost_DIR-NOTFOUND
Boost_INCLUDE_DIR:PATH=C:/boost_1_55_0
Boost_LIBRARY_DIR:PATH=C:\boost_1_55_0\stage\lib
Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=boost_system-gcc-mt-s-1_55
Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=boost_system-gcc-mt-s-1_55
Boost_THREAD_LIBRARY_DEBUG:FILEPATH=boost_thread_pthread-gcc-mt-s-1_55
Boost_THREAD_LIBRARY_RELEASE:FILEPATH=boost_thread_pthread-gcc-mt-s-1_55
CMAKE_AR:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-ar.exe
CMAKE_BUILD_TYPE:STRING=MinSizeRel
CMAKE_COLOR_MAKEFILE:BOOL=ON
CMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-g++.exe
CMAKE_CXX_FLAGS:STRING=-c
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-gcc.exe
CMAKE_C_FLAGS:STRING=-c
CMAKE_C_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_ECLIPSE_EXECUTABLE:FILEPATH=CMAKE_ECLIPSE_EXECUTABLE-NOTFOUND
CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES:BOOL=ON
CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT:BOOL=OFF
CMAKE_ECLIPSE_MAKE_ARGUMENTS:STRING=
CMAKE_ECLIPSE_VERSION:STRING=3.6 (Helios)
CMAKE_EXE_LINKER_FLAGS:STRING=' -static '
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/safes
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-ld.exe
CMAKE_MAKE_PROGRAM:FILEPATH=C:/MinGW/bin/mingw32-make.exe
CMAKE_MODULE_LINKER_FLAGS:STRING=' '
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_NM:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-nm.exe
CMAKE_OBJCOPY:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-objcopy.exe
CMAKE_OBJDUMP:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-objdump.exe
CMAKE_PROJECT_NAME:STATIC=safes
CMAKE_RANLIB:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-ranlib.exe
CMAKE_RC_COMPILER:FILEPATH=C:/MinGW/bin/windres.exe
CMAKE_RC_FLAGS:STRING=' '
CMAKE_SH:FILEPATH=CMAKE_SH-NOTFOUND
CMAKE_SHARED_LINKER_FLAGS:STRING=' '
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_SKIP_INSTALL_RPATH:BOOL=OFF
CMAKE_SKIP_RPATH:BOOL=OFF
CMAKE_STATIC_LINKER_FLAGS:STRING=
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_STRIP:FILEPATH=C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_Nios_II_GNU_Linux/bin/nios2-linux-gnu-strip.exe
CMAKE_TOOLCHAIN_FILE:FILEPATH=T:/toolchain/Toolchain-nios2-linux.cmake
CMAKE_USE_RELATIVE_PATHS:BOOL=OFF
CMAKE_VERBOSE_MAKEFILE:BOOL=OFF
core_BINARY_DIR:STATIC=T:/core
core_LIB_DEPENDS:STATIC=
core_SOURCE_DIR:STATIC=T:/sources/core
crypto_BINARY_DIR:STATIC=T:/crypto
crypto_LIB_DEPENDS:STATIC=
crypto_SOURCE_DIR:STATIC=T:/sources/crypto
protocol_BINARY_DIR:STATIC=T:/protocol
protocol_LIB_DEPENDS:STATIC=
protocol_SOURCE_DIR:STATIC=T:/sources/protocol
safes_BINARY_DIR:STATIC=T:/
safes_SOURCE_DIR:STATIC=T:/sources
server_BINARY_DIR:STATIC=T:/server
server_SOURCE_DIR:STATIC=T:/sources/server
user_control_BINARY_DIR:STATIC=T:/user_control
user_control_LIB_DEPENDS:STATIC=
user_control_SOURCE_DIR:STATIC=T:/sources/user_control
utils_BINARY_DIR:STATIC=T:/utils
utils_LIB_DEPENDS:STATIC=
utils_SOURCE_DIR:STATIC=T:/sources/utils
########################
# INTERNAL cache entries
########################
Boost_ATOMICS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
Boost_ATOMICS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
Boost_CHRONO_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
Boost_CHRONO_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
Boost_DIR-ADVANCED:INTERNAL=1
Boost_INCLUDE_DIR-ADVANCED:INTERNAL=1
Boost_LIBRARY_DIR-ADVANCED:INTERNAL=1
Boost_SYSTEM_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
Boost_SYSTEM_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
Boost_THREAD_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
Boost_THREAD_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
CMAKE_AR-ADVANCED:INTERNAL=1
CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1
CMAKE_BUILD_TOOL:INTERNAL=C:/MinGW/bin/mingw32-make.exe
CMAKE_CACHEFILE_DIR:INTERNAL=t:/fircopro_cmake/toolchain_win_eclipse
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
CMAKE_CACHE_MINOR_VERSION:INTERNAL=8
CMAKE_CACHE_PATCH_VERSION:INTERNAL=12
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
CMAKE_COMMAND:INTERNAL=C:/Program Files (x86)/CMake 2.8/bin/cmake.exe
CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files (x86)/CMake 2.8/bin/cpack.exe
CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files (x86)/CMake 2.8/bin/ctest.exe
CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT-ADVANCED:INTERNAL=1
CMAKE_ECLIPSE_VERSION-STRINGS:INTERNAL=3.2 (Callisto);3.3 (Europa);3.4 (Ganymede);3.5 (Galileo);3.6 (Helios);3.7 (Indigo);4.2 (Juno)
CMAKE_EDIT_COMMAND:INTERNAL=C:/Program Files (x86)/CMake 2.8/bin/cmake-gui.exe
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_EXTRA_GENERATOR:INTERNAL=Eclipse CDT4
CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS:INTERNAL=c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/../../../../nios2-linux-gnu/include/c++/4.7.3;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/../../../../nios2-linux-gnu/include/c++/4.7.3/nios2-linux-gnu;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/../../../../nios2-linux-gnu/include/c++/4.7.3/backward;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/include;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/include-fixed;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/../../../../nios2-linux-gnu/include;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../nios2-linux-gnu/libc/usr/include
CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS:INTERNAL=c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/include;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/include-fixed;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../lib/gcc/nios2-linux-gnu/4.7.3/../../../../nios2-linux-gnu/include;c:\program files (x86)\codesourcery\sourcery_codebench_lite_for_nios_ii_gnu_linux\bin\../nios2-linux-gnu/libc/usr/include
CMAKE_GENERATOR:INTERNAL=MinGW Makefiles
CMAKE_GENERATOR_TOOLSET:INTERNAL=
CMAKE_HAVE_LIBC_CREATE:INTERNAL=1
CMAKE_HAVE_PTHREAD_H:INTERNAL=1
CMAKE_HOME_DIRECTORY:INTERNAL=T:/fircopro_cmake/sources
CMAKE_LINKER-ADVANCED:INTERNAL=1
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_NM-ADVANCED:INTERNAL=1
CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=7
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
CMAKE_RANLIB-ADVANCED:INTERNAL=1
CMAKE_RC_COMPILER-ADVANCED:INTERNAL=1
CMAKE_RC_COMPILER_WORKS:INTERNAL=1
CMAKE_RC_FLAGS-ADVANCED:INTERNAL=1
CMAKE_ROOT:INTERNAL=C:/Program Files (x86)/CMake 2.8/share/cmake-2.8
CMAKE_SH-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
CMAKE_STRIP-ADVANCED:INTERNAL=1
CMAKE_SUPPRESS_DEVELOPER_WARNINGS:INTERNAL=FALSE
CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()]
_BOOST_ROOT_LAST:INTERNAL=C:/boost_1_55_0
_Boost_COMPILER_LAST:INTERNAL=-gcc
_Boost_COMPONENTS_SEARCHED:INTERNAL=atomics;chrono;system;thread
_Boost_INCLUDE_DIR_LAST:INTERNAL=C:/boost_1_55_0
_Boost_LIBRARY_DIR_LAST:INTERNAL=C:\boost_1_55_0\stage\lib
_Boost_NO_SYSTEM_PATHS_LAST:INTERNAL=TRUE
_Boost_USE_MULTITHREADED_LAST:INTERNAL=TRUE
Any ideas of how resolve this problem?
Thanks
It is the path to a file which is read early in the CMake run and which specifies locations for compilers and toolchain utilities, and other target platform and compiler related information.
CMake needs a way to determine which compiler to use to invoke the linker. This is determined by the LANGUAGE property of source files of the target , and in the case of static libraries, the LANGUAGE of the dependent libraries. The choice CMake makes may be overridden with the LINKER_LANGUAGE target property.
To cross-compile is to build on one platform a binary that will run on another platform. When speaking of cross-compilation, it is important to distinguish between the build platform on which the compilation is performed, and the host platform on which the resulting executable is expected to run.
I solved the problem by setting the variable set(CMAKE_SYSTEM_NAME Generic)
in the toolchain file. I was using Windows than Generic, when I changed to "Generic" the generation works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With