2017-08-17 2 views
1

私のMacのコードをLinuxホストにコンパイルするためにdistccを使いたいのですが、すべてを "ラインアップ"にする。私は正常にMacからMacへのdistccを使用したので、私はものを設定する方法の一般的な考えがあります。clangとdistccを使って別のアーキテクチャのスレーブでコンパイルする方法(例:mac/linux)

私はclang 4.0を使用しており、MacとLinuxの両方にインストールされ、動作しています。次のコマンドは、先頭にdistccせずに罰金コンパイルが、distccのを追加した後、私は次の問題を得る:

distcc /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang++ -I/usr/local/include -I/Users/xaxxon/v8toolkit/./include -I/Users/xaxxon/v8/include -stdlib=libc++ -g -Werror=return-type -g -std=gnu++1z -o CMakeFiles/v8toolkit_static.dir/src/v8toolkit.cpp.o -c /Users/xaxxon/v8toolkit/src/v8toolkit.cpp 

私は何のコンパイラは、Linux上でピックアップされ、またどのように私が知っているかわかりません調べる。それはclangの代わりにgccを取得する可能性があります。

私の最初の懸念はこれです:

clang: warning: argument unused during compilation: '-stdlib=libc++' 

私の最初のエラーは、次のとおりです。

In file included from /Users/xaxxon/v8toolkit/src/v8toolkit.cpp:5: 
In file included from /usr/include/assert.h:44: 
In file included from /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/stdlib.h:94: 
/usr/include/stdlib.h:250:20: error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them 
int atexit_b(void (^)(void)) __attribute__((availability(macosx,introduced=10.6))); 

私は手動でコンパイルコマンドに-fblocksを追加した場合、最初のエラーになり、私は(取得、次のエラー(ネイティブのMacビルドに必要とされていない)である:私はSをやっている場合

/Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:289:13: error: unknown type name '__type_pack_element' 
    typedef __type_pack_element<_Ip, _Types...> type; 
      ^
/Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:289:32: error: expected member name or ';' after declaration specifiers 
    typedef __type_pack_element<_Ip, _Types...> type; 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ 
/Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:356:43: error: use of undeclared identifier '__type_pack_element' 
     typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... 
             ^
/Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:357:6: error: expected a type 
    >; 

私は理解していません何か根本的に間違っているか、Linuxコンパイラの動作が異なっている、私が見逃している小さなものがあるかどうか。

ありがとうございました。

編集:Linux上で同じ名前のディレクトリにclangを持っていることを確認しましたが、現在は-fblocksunused during compilation -stdlib=libc++という問題が発生しています。

EDIT2:私はすべてが(警告とはいえ)をコンパイルするために取得することができ、それがリンクしたときに、私が取得:

ld: warning: ignoring file CMakeFiles/v8toolkit_shared.dir/src/debugger.cpp.o, file was built for 
unsupported file format (0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00) which is not the architecture being linked 
(x86_64): CMakeFiles/v8toolkit_shared.dir/src/debugger.cpp.o 

答えて

1

-targetフラグを追加するには、すべてを修正!私の場合は、エルキャピタンのために、ターゲットは、トリプルです:のビルドコマンドの

-target x86_64-apple-darwin15.6.0 

distcc /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang++ -Dv8toolkit_shared_EXPORTS -I/usr/local/include -I/Users/xaxxon/v8toolkit/./include -isystem /Users/xaxxon/v8/include -stdlib=libc++ -g -Werror=return-type -target x86_64-apple-darwin15.6.0 -g -fPIC -std=gnu++1z -o CMakeFiles/v8toolkit_shared.dir/src/v8toolkit.cpp.o -c /Users/xaxxon/v8toolkit/src/v8toolkit.cpp 
あなたが現在のホストのターゲットを得ることができます

clang -vを入力して:

$ clang -v 
clang version 4.0.0 (tags/RELEASE_400/final) 
Target: x86_64-apple-darwin15.6.0 <<==== THIS LINE HERE 
Thread model: posix 
InstalledDir: /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin 

次のCMake行は現在のマシンのトリプルを取得(および印刷)します:

# Get the target triple for the current host by calling clang -v and then stripping out the Target: value from its output. CMake regex syntax is quite limited. 
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v ERROR_VARIABLE CLANG_VERSION_INFO) 
string(REGEX REPLACE ".*Target:[\r\n\t ]*([^\r\n\t]*).*Thread model.*" "\\1" TARGET_TRIPLE ${CLANG_VERSION_INFO}) 
message(STATUS "TARGET TRIPLE: '${TARGET_TRIPLE}' END") 

@duskwuffとoftc.net #llvmに感謝します。

関連する問題