<legend id='m4CmR'><style id='m4CmR'><dir id='m4CmR'><q id='m4CmR'></q></dir></style></legend>

    <bdo id='m4CmR'></bdo><ul id='m4CmR'></ul>
  • <tfoot id='m4CmR'></tfoot>
  • <small id='m4CmR'></small><noframes id='m4CmR'>

  • <i id='m4CmR'><tr id='m4CmR'><dt id='m4CmR'><q id='m4CmR'><span id='m4CmR'><b id='m4CmR'><form id='m4CmR'><ins id='m4CmR'></ins><ul id='m4CmR'></ul><sub id='m4CmR'></sub></form><legend id='m4CmR'></legend><bdo id='m4CmR'><pre id='m4CmR'><center id='m4CmR'></center></pre></bdo></b><th id='m4CmR'></th></span></q></dt></tr></i><div id='m4CmR'><tfoot id='m4CmR'></tfoot><dl id='m4CmR'><fieldset id='m4CmR'></fieldset></dl></div>

        使用 LLVM 将问题与 OSX 上的 boost::program_options 链接起来

        Linking troubles with boost::program_options on OSX using LLVM(使用 LLVM 将问题与 OSX 上的 boost::program_options 链接起来)

        <tfoot id='8Lac1'></tfoot>
          <bdo id='8Lac1'></bdo><ul id='8Lac1'></ul>

          <i id='8Lac1'><tr id='8Lac1'><dt id='8Lac1'><q id='8Lac1'><span id='8Lac1'><b id='8Lac1'><form id='8Lac1'><ins id='8Lac1'></ins><ul id='8Lac1'></ul><sub id='8Lac1'></sub></form><legend id='8Lac1'></legend><bdo id='8Lac1'><pre id='8Lac1'><center id='8Lac1'></center></pre></bdo></b><th id='8Lac1'></th></span></q></dt></tr></i><div id='8Lac1'><tfoot id='8Lac1'></tfoot><dl id='8Lac1'><fieldset id='8Lac1'></fieldset></dl></div>
            1. <small id='8Lac1'></small><noframes id='8Lac1'>

              <legend id='8Lac1'><style id='8Lac1'><dir id='8Lac1'><q id='8Lac1'></q></dir></style></legend>

                    <tbody id='8Lac1'></tbody>
                1. 本文介绍了使用 LLVM 将问题与 OSX 上的 boost::program_options 链接起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  由于 Boost 1.49 的问题,我在 C++ 程序中无法通过链接阶段.我已切换到 C++ (-std=c++11 -libc=libc++),它适用于另一段代码(也使用 boost).Boost 是使用自制软件安装的:

                  I'm having trouble getting through the linking phase in my C++ program due to problems with Boost 1.49. I have switched to C++ (-std=c++11 -libc=libc++) which works fine for another piece of code (which also uses boost). Boost was installed using homebrew with:

                  brew install boost --universal --with-mpi --with-icu
                  

                  问题始于boost::program_options.我收到这样的链接错误:

                  The trouble starts with boost::program_options. I get the link errors like this:

                    "boost::program_options::validate(boost::any&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, int)", referenced from:
                  
                  ... etc. ...
                  
                  ld: symbol(s) not found for architecture x86_64
                  clang: error: linker command failed with exit code 1 (use -v to see invocation)
                  

                  这有点奇怪,因为在使用的库上执行 nm 显示,该符号似乎在那里:

                  This is a little strange, because doing an nm on the library used reveals, that the symbol appears to be there:

                  nm -U /usr/local/lib/libboost_program_options-mt.dylib  | grep validate
                  0000000000019880 - 01 0000   FUN __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS7_EEPSsi
                  0000000000019880 T __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS7_EEPSsi
                  00000000000199e0 - 01 0000   FUN __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS7_EEPbi
                  00000000000199e0 T __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS7_EEPbi
                  0000000000019930 T __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISsSaISsEEPSsi
                  0000000000019930 - 01 0000   FUN __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISsSaISsEEPSsi
                  0000000000019c70 - 01 0000   FUN __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISsSaISsEEPbi
                  0000000000019c70 T __ZN5boost15program_options8validateERNS_3anyERKSt6vectorISsSaISsEEPbi
                  

                  我已经尝试通过在安装前相应地设置 CXX 和 CXX_FLAGS 来诱使自制软件使用 clang 而不是 gcc 编译 boost.不过我不确定我成功了.

                  I have already tried coaxing homebrew to compile boost with clang instead of gcc by setting CXX and CXX_FLAGS accordingly prior to installation. Not sure I succeeded though.

                  不胜感激.

                  推荐答案

                  您将需要使用 clang 和 std11 标志重新编译 boost,libc++ 库与 OSX 中安装的 libstdc++ 二进制不兼容(gcc 之前的非常早期版本更改为 gpl3).如果您的 clang 版本是 3.1 或更高版本,那么您可以使用(否则将 c++11 更改为 c++0x 以获取早期版本).

                  You will need to recompile boost with clang and std11 flags, the libc++ library is not binary compatible with the installed libstdc++ in OSX (very early version of gcc prior to changing to gpl3). If your version of clang is 3.1 or over then you can use (otherwise change c++11 to c++0x for earlier versions).

                  ./bootstrap.sh
                  mkdir build
                  sudo ./bjam toolset=clang cxxflags="-std=c++0x -stdlib=libc++" variant=release link=static threading=multi runtime-link=shared --build-dir=Build --layout=system --without-mpi --without-python install --prefix=/usr/local 
                  

                  您当然可以随意更改其中任何一个,除了

                  You can of course alter any of these as you wish except

                  toolset=clang cxxflags="-std=c++0x -stdlib=libc++"

                  toolset=clang cxxflags="-std=c++0x -stdlib=libc++"

                  这应该对你有用.

                  这篇关于使用 LLVM 将问题与 OSX 上的 boost::program_options 链接起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to limit the number of running instances in C++(C++中如何限制运行实例的数量)
                  Using boost::asio::async_read with stdin?(将 boost::asio::async_read 与 stdin 一起使用?)
                  How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?(如何找出特定 Boost 库需要哪些依赖项(即其他 Boost 库)?)
                  What#39;s the purpose of a leading quot;::quot; in a C++ method call(引导“::的目的是什么?在 C++ 方法调用中)
                  Boost Spirit x3: parse into structs(Boost Spirit x3:解析为结构体)
                  How boost auto-linking makes choice?(boost自动链接如何做出选择?)

                      <tbody id='RLMuS'></tbody>
                    • <bdo id='RLMuS'></bdo><ul id='RLMuS'></ul>
                    • <tfoot id='RLMuS'></tfoot>
                      <i id='RLMuS'><tr id='RLMuS'><dt id='RLMuS'><q id='RLMuS'><span id='RLMuS'><b id='RLMuS'><form id='RLMuS'><ins id='RLMuS'></ins><ul id='RLMuS'></ul><sub id='RLMuS'></sub></form><legend id='RLMuS'></legend><bdo id='RLMuS'><pre id='RLMuS'><center id='RLMuS'></center></pre></bdo></b><th id='RLMuS'></th></span></q></dt></tr></i><div id='RLMuS'><tfoot id='RLMuS'></tfoot><dl id='RLMuS'><fieldset id='RLMuS'></fieldset></dl></div>

                        <legend id='RLMuS'><style id='RLMuS'><dir id='RLMuS'><q id='RLMuS'></q></dir></style></legend>

                          1. <small id='RLMuS'></small><noframes id='RLMuS'>