2013-03-06 2 views
1

Я долго пытался выяснить проблему, но я не могу .. таким образом, я здесь, и мне очень жаль.Windows: Boost и CMake

Некоторая информация:

  • Моя система Windows 7, 64-разрядный профессионал с Visual Studio 10 и MinGW
  • Я составил подталкивания (1.53.0) с помощью:

    bootstrap.bat mingw 
    .\b2 --prefix=C:\boost toolset=gcc -j4 link=shared 
    .\b2 --prefix=C:\boost toolset=gcc -j4 link=shared install 
    
  • Моя установка выглядит так:

    C:\boost 
        include\boost-1_53\boost -- headers 
        lib\ -- libraries, both dll and dll.a 
    
    • ls -la выход из библиотеки (усеченный по длине)

      $ ls -la 
      total 124249 
      -rwxr-xr-x 1 kevin Administrators 43218 Mar 5 22:07 libboost_atomic-mgw46-mt-1_53.dll 
      -rw-r--r-- 1 kevin Administrators  1790 Mar 5 22:07 libboost_atomic-mgw46-mt-1_53.dll.a 
      -rwxr-xr-x 1 kevin Administrators 47785 Mar 5 22:07 libboost_atomic-mgw46-mt-d-1_53.dll 
      -rw-r--r-- 1 kevin Administrators  1802 Mar 5 22:07 libboost_atomic-mgw46-mt-d-1_53.dll.a 
      -rwxr-xr-x 1 kevin Administrators 87319 Mar 5 22:07 libboost_chrono-mgw46-mt-1_53.dll 
      
  • Мой файл CMake выглядит следующим образом для связанных наддува частей: cmake_minimum_required (версия 2.8) проект (HC12)

    set(Boost_DEBUG 1) 
    
    #need to add more components, used for testing 
    find_package(Boost 1.53.0 COMPONENTS system chrono thread filesystem unit_test_framework signals REQUIRED) 
    
    if(NOT Boost_FOUND) 
        message(fatal_error "Boost was not found. See FindBoost.cmake for details.") 
    endif() 
    
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) 
    
    # snip for brievity 
    
    add_library(hc12 SHARED ${libhc12_srcs}) 
    target_link_libraries(hc12 ${Boost_FILESYSTEM_LIBRARY} 
        ${Boost_SYSTEM_LIBRARY} 
        ${Boost_CHRONO_LIBRARY} 
        ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 
        ${Boost_SIGNALS_LIBRARY} 
        ${Boost_THREAD_LIBRARY} 
    ) 
    
    
    #--dependencies 
    add_executable(test ${test_srcs}) 
    
    add_dependencies(test hc12) 
    
    target_link_libraries(test hc12 ${Boost_FILESYSTEM_LIBRARY} 
        ${Boost_SYSTEM_LIBRARY} 
        ${Boost_CHRONO_LIBRARY} 
        ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 
        ${Boost_SIGNALS_LIBRARY} 
        ${Boost_THREAD_LIBRARY} 
    ) 
    
    • Файл на самом деле имеет намного больше, но большая его часть - cus tom команда мусора для автоматического генерации кода.

Выход cmake .. является:

$ cmake .. 
-- The C compiler identification is unknown 
-- The CXX compiler identification is unknown 
Setting to be debug 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:56 
6 ] _boost_TEST_VERSIONS = 1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:56 
8 ] Boost_USE_MULTITHREADED = TRUE 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:57 
0 ] Boost_USE_STATIC_LIBS = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:57 
2 ] Boost_USE_STATIC_RUNTIME = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:57 
4 ] Boost_ADDITIONAL_VERSIONS = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:57 
6 ] Boost_NO_SYSTEM_PATHS = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:64 
4 ] Declared as CMake or Environmental Variables: 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:64 
6 ] BOOST_ROOT = c:/Boost 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:64 
8 ] BOOST_INCLUDEDIR = c:/boost/include/ 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:65 
0 ] BOOST_LIBRARYDIR = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:65 
2 ] _boost_TEST_VERSIONS = 1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53 
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos 
t.cmake:732 (file): 
    file STRINGS file "C:/Program Files/boost/boost/version.hpp" cannot be 
    read. 
Call Stack (most recent call first): 
    CMakeLists.txt:15 (find_package) 


-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:73 
4 ] location of version.hpp: C:/Program Files/boost/boost/version.hpp 
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos 
t.cmake:746 (math): 
    math cannot parse the expression: "/100000": syntax error, unexpected 
    exp_DIVIDE, expecting exp_OPENPARENT or exp_NUMBER (2) 
Call Stack (most recent call first): 
    CMakeLists.txt:15 (find_package) 


CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos 
t.cmake:747 (math): 
    math cannot parse the expression: "/100 % 1000": syntax error, unexpected 
    exp_DIVIDE, expecting exp_OPENPARENT or exp_NUMBER (2) 
Call Stack (most recent call first): 
    CMakeLists.txt:15 (find_package) 


CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos 
t.cmake:748 (math): 
    math cannot parse the expression: " % 100": syntax error, unexpected 
    exp_MOD, expecting exp_OPENPARENT or exp_NUMBER (2) 
Call Stack (most recent call first): 
    CMakeLists.txt:15 (find_package) 


-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:75 
4 ] version.hpp reveals boost .. 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:78 
6 ] guessed _boost_COMPILER = 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:79 
6 ] _boost_MULTITHREADED = -mt 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:83 
9 ] _boost_RELEASE_ABI_TAG = - 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:84 
1 ] _boost_DEBUG_ABI_TAG = -d 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:88 
4 ] _boost_LIBRARY_SEARCH_DIRS = c:/Boost/lib;c:/Boost/stage/lib;C:/Program File 
s/boost/lib;C:/Program Files/boost/../lib;C:/Program Files/boost/stage/lib;C:/bo 
ost/lib;C:/boost;C:\Program Files (x86)/boost/boost___/lib;C:\Program Files (x86 
)/boost/boost__/lib;C:\Program Files (x86)/boost/lib;C:\Program Files (x86)/boos 
t;/sw/local/lib 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-mt-;boost_system-mt;boost 
_system-mt-;boost_system-mt;boost_system 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-mt-d-;boost_system-mt-d;boo 
st_system-mt-d-;boost_system-mt-d;boost_system-mt;boost_system 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for CHRONO_LIBRARY_RELEASE: boost_chrono-mt-;boost_chrono-mt;boost 
_chrono-mt-;boost_chrono-mt;boost_chrono 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for CHRONO_LIBRARY_DEBUG: boost_chrono-mt-d-;boost_chrono-mt-d;boo 
st_chrono-mt-d-;boost_chrono-mt-d;boost_chrono-mt;boost_chrono 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-mt-;boost_thread-mt;boost 
_thread-mt-;boost_thread-mt;boost_thread 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-mt-d-;boost_thread-mt-d;boo 
st_thread-mt-d-;boost_thread-mt-d;boost_thread-mt;boost_thread 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mt-;boost_filesys 
tem-mt;boost_filesystem-mt-;boost_filesystem-mt;boost_filesystem 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mt-d-;boost_filesys 
tem-mt-d;boost_filesystem-mt-d-;boost_filesystem-mt-d;boost_filesystem-mt;boost_ 
filesystem 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE: boost_unit_test_framework 
-mt-;boost_unit_test_framework-mt;boost_unit_test_framework-mt-;boost_unit_test_ 
framework-mt;boost_unit_test_framework 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG: boost_unit_test_framework-m 
t-d-;boost_unit_test_framework-mt-d;boost_unit_test_framework-mt-d-;boost_unit_t 
est_framework-mt-d;boost_unit_test_framework-mt;boost_unit_test_framework 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:96 
2 ] Searching for SIGNALS_LIBRARY_RELEASE: boost_signals-mt-;boost_signals-mt;bo 
ost_signals-mt-;boost_signals-mt;boost_signals 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:99 
4 ] Searching for SIGNALS_LIBRARY_DEBUG: boost_signals-mt-d-;boost_signals-mt-d; 
boost_signals-mt-d-;boost_signals-mt-d;boost_signals-mt;boost_signals 
-- [ c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:11 
08 ] Boost_FOUND = FALSE 
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos 
t.cmake:1192 (message): 
    Unable to find the requested Boost libraries. 

    Boost version: .. 

    Boost include path: C:/Program Files/boost 

    The following Boost libraries could not be found: 

      boost_system 
      boost_chrono 
      boost_thread 
      boost_filesystem 
      boost_unit_test_framework 
      boost_signals 

    No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the 
    directory containing Boost libraries or BOOST_ROOT to the location of 
    Boost. 
Call Stack (most recent call first): 
    CMakeLists.txt:15 (find_package) 


fatal_errorBoost was not found. See FindBoost.cmake for details. 
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPack 
ageHandleStandardArgs.cmake:97 (message): 
    Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE 
    QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_LIBRARY_DIR QT_QTCORE_LIBRARY) 
Call Stack (most recent call first): 
    c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStan 
dardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE) 
    c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1223 (F 
IND_PACKAGE_HANDLE_STANDARD_ARGS) 
    src/tools/InstructParser/CMakeLists.txt:7 (FIND_PACKAGE) 


-- Configuring incomplete, errors occurred! 

Я попытался объявить BOOST_ROOT и BOOST_INCLUDE_DIR и BOOST_LIBRARYDIR безрезультатно.

Ответы на все и любые вопросы о помощи.

+0

Покажите хотя бы одно имя библиотеки boost, например 'system' – ixSci

+0

Добавлено в исходный пост! – Nava2

+0

попытайтесь установить' Boost_COMPILER' '' 46. Также я предполагаю, что для вашего проекта вы используете генератор cmake для MinGW, а не для визуальной студии. – ixSci

ответ

4

Вот что я должен был сделать, чтобы все работало, как ожидалось:

  1. С Visual Studio Prompt: Recompile увеличить с помощью следующей команды: .\b2 --prefix=C:\boost toolset=gcc -j4 link=shared threading=multi --ignore-python --ignore-mpi --layout=tagged

    В layout=tagged причины повышения сделать библиотеки формы libboost_system-mt.dll, которая просто означает, что она многопоточная. Он удаляет посторонние части имени, которые раньше вызывали проблемы.

  2. От MinGW оболочка: Для того, чтобы настроить проект от build (при условии, что проект в каталоге верхнего уровня находится в ..): CC=gcc CXX=g++ cmake -G "MinGW Makefiles" -DQT_QMAKE_EXECUTABLE=~/Qt/ -DQJSON_DIR=~/qjson ..

    В QT_QMAKE_EXECUTABLE и QJSON_DIR переменных требуется только из-за мой проект. Для большинства вам нужно всего лишь сделать CC=gcc CXX=g++ cmake -G "MinGW Makefiles" .., чтобы скомпилировать простой проект с boost.

    У меня было несколько ошибок, так как я сделал это, но я только rm -rf 'создал каталог и начал с нуля исправлять ошибки.

  3. Чтобы компилировать, вместо того, чтобы использовать makeвы обязательно использовать mingw32-make.exe (или то, что когда-либо ваша установка MinGW имеет) для компиляции, из MinGW Shell.

Теперь все, что нужно сделать, это выяснить, как правильно установить связь для повышения бинарных библиотек для запуска моего пользовательского кода-генератора внутри CMake .. :(

Спасибо за помощь!

Смежные вопросы