Hello all, I have been struggling with this problem for 2 days and I cannot really find a solution.
I have a c++ application that I want to cross compile under Fedora 15 to use it with Windows. The packages that my app depends on are already pre-compiled in : /usr/i686-mingw32...../ I am using CMake. It compiles okay and I generate the .exe file without problems. When I try to run it under Windows it complains : "The program cant start because boost_filesystem-gcc45-mt-1_ 46_1.dll ins missing......." I have boost 1.47 installed in the windows machine but the libraries have a different suffix (...vc-xx-mt...) When I cross compile I do it statically ( I am attaching my toolchain-mingw32 file ) My question is, why is the exe program looking for the boost dll with exactly the same name as it has in the linux machine where the cross compiled exe has been built from?? In my fedora mingw32 lib folder the boost libraries look like this : libboost_filesystem-gcc45-mt-1_46_1.dll·a Is there any way to tell cmake to disregard those suffixes while running in Windows? Is there any way to tell cmake to copy the boost libraries needed for my application into a local folder that will be included inside the the windows installer?? Also while cross compiling I had gotten this error : In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/detail/hash_float.hpp:17, from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/hash.hpp:15, from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash.hpp:6, from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered/unordered_set.hpp:17, from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered_set.hpp:16, from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimatorHelper.h:33, from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimator.cpp:28: /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected unqualified-id before 'unsigned' /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected ';' before 'unsigned' /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: declaration does not declare anything /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected unqualified-id before 'unsigned' /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected ';' before 'unsigned' /usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: declaration does not declare anything It seemed boost defines a typedf in cstdint that is already defined in somewhere else, I would guess it is because the windows flag is activated even though it is compiling under linux. I fixed it checking it the definition has been made already but this is not a proper solution. Is it maybe that definition in my code or another cross compiled library? Tool chain file : SET(CMAKE_SYSTEM_NAME Windows) # specify the cross compiler find_file(MINGWV NAMES i586-mingw32msvc-gcc i586-mingw32msvc-g++ PATHS /usr/bin /usr/local/bin) if(NOT MINGWV) set(MINGW_PREFIX "/usr/bin/i686-pc-mingw32-") SET(Boost_COMPILER "-gcc45") else(NOT MINGWV) set(MINGW_PREFIX "/usr/bin/i586-mingw32msvc-") SET(Boost_COMPILER "-mgw") endif(NOT MINGWV) # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows -mthreads -static-libgcc") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -mwindows -mthreads -static-libgcc") # SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined,--fix-cortex-a8,-lsupc++ -lstdc++ -L${CMAKE_INSTALL_PREFIX}/lib") # SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined,--fix-cortex-a8,-lsupc++ -lstdc++ -L${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_C_COMPILER ${MINGW_PREFIX}gcc) set(CMAKE_CXX_COMPILER ${MINGW_PREFIX}g++) set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres) # set(CMAKE_AR ${MINGW_PREFIX}ar) set(CMAKE_RANLIB ${MINGW_PREFIX}ranlib) set(CMAKE_LINKER ${MINGW_PREFIX}ld) set(CMAKE_STRIP ${MINGW_PREFIX}strip) set(CMAKE_EXECUTABLE_SUFFIX ".exe") # Boost Configuration SET(Boost_USE_STATIC_LIBS ON) # where is the target environment SET(CMAKE_FIND_ROOT_PATH /usr/i686-pc-mingw32;/usr/i586-mingw32msvc;/usr/i686-pc-mingw32/sys-root/mingw;/usr/i586-mingw32msvc/sys-root/mingw; /home/USERNAME/i586-mingw32msvc;/home/USERNAME/i686-pc-mingw32;${CMAKE_PREFIX_PATH}; ${PROJECT_SOURCE_DIR}/../libs;${PROJECT_SOURCE_DIR}/libs;${PROJECT_SOURCE_DIR}/../../libs) # 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) Thank you so much
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake