I am running into an odd problem, where I need to access boost libraries using both gcc and clang specific modules (these programs interact. One is gcc/g++ exclusive, and one is clang exclusive). Is there any way to build boost so that both modules access the same location when calling boost, but boost is able to facilitate gcc or clang specific requests?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It is possible, but it's questionable if you really should do that.
You would have to choose either to use libc++
or libstdc++
with both compilers.
libstdc++
is definitely the better one since clang can deal with it flawlessly,
gcc has problems parsing several libc++
headers.
Something like this should make clang use gcc's libstdc++
on Mac OS X.
clang++ \
-stdlib=libstdc++ \
-nostdinc++ \
-Qunused-arguments \
-nodefaultlibs \
<path to>x86_64-apple-darwin14/lib/libstdc++.a \
<path to>x86_64-apple-darwin14/lib/libsupc++.a \
<path to>lib/gcc/x86_64-apple-darwin14/5.2.0/libgcc.a \
<path to>lib/gcc/x86_64-apple-darwin14/5.2.0/libgcc_eh.a \
-lc \
-Wl,-no_compact_unwind \
-cxx-isystem <path to>x86_64-apple-darwin14/include/c++/5.2.0 \
-cxx-isystem <path to>x86_64-apple-darwin14/include/c++/5.2.0/x86_64-apple-darwin14 \
-mmacosx-version-min=10.7.0
I recommend to put this in a wrapper script, then pass CXX=clang++-libstdc++
to the boost build script.
Example wrapper script:
#!/bin/sh
ls -l "$@"
Wraps ls.