Open kyawaway opened 7 months ago
https://developer.apple.com/xcode/cpp/#c++17 によると、
XCode15を入れ,
しかし,
In file included from /path/to/slim/src/verifier/verifier.h:54:
/path/to/slim/src/verifier/mc_explorer.h:77:22: error: no member named 'atomic_ref' in namespace
'std'
auto flags2 = std::atomic_ref(s->flags2);
cppreferenceによって、AppleClangはまだatomic_ref
を実装していませんので、commit 511a5fe でstd::atomic_ref
で引用した変数をstd::atomic<T>
に変更しました。
std::atomic_ref
を使った理由は、State
のflag
は局所的にアトミック操作がありますが、std::atomic<T>
ではアトミック操作ではない部分を特別な修正が必要なので、便宜上atomic_ref
を使ってました。
今回すべてアトミック操作にしたから、性能への影響については調査が必要です。(あまりないはず)
対応ありがとうございます.
まだ数箇所怒られています.エラーログが全て見通せそうな規模になってきたので,エラーが出ている箇所を上から全て添付します.
(まだ自分では全く調べてないです,明日夜に見ます)
/path/to/slim/src/element/variant.hpp:56:33: error: invalid application of 'sizeof' to an incomp
lete type 'il::instr_arg::inst_list'
static constexpr auto size = sizeof(Z);
/path/to/slim/src/element/variant.hpp:57:33: error: invalid application of 'alignof' to an incom
plete type 'il::instr_arg::inst_list'
static constexpr auto align = alignof(Z);
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/v
ector:836:62: error: arithmetic on a pointer to an incomplete type 'Instruction'
__alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
/path/to/slim/src/element/variant.hpp:56:33: error: invalid application of 'sizeof' to an incomp
lete type 'il::instr_arg::inst_list'
static constexpr auto size = sizeof(Z);
/path/to/slim/src/element/variant.hpp:57:33: error: invalid application of 'alignof' to an incom
plete type 'il::instr_arg::inst_list'
static constexpr auto align = alignof(Z);
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/v
ector:549:52: error: arithmetic on a pointer to an incomplete type 'Instruction'
{return static_cast<size_type>(__end_cap() - this->__begin_);}
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/v
ector:763:54: error: arithmetic on a pointer to an incomplete type 'const value_type' (aka 'const Instruction')
__annotate_contiguous_container(data(), data() + capacity(),
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/v
ector:836:62: error: arithmetic on a pointer to an incomplete type 'Instruction'
__alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/_
_memory/allocator.h:131:58: error: invalid application of 'sizeof' to an incomplete type 'Instruction'
_VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
/path/to/slim/src/vm/task.cpp:53:10: fatal error: 'bits/ranges_algo.h' file not found
#include <bits/ranges_algo.h>
/path/to/slim/src/element/variant.hpp:56:33: error: invalid application of 'sizeof' to an incomp
lete type 'il::instr_arg::inst_list'
static constexpr auto size = sizeof(Z);
/path/to/slim/src/element/variant.hpp:57:33: error: invalid application of 'alignof' to an incom
plete type 'il::instr_arg::inst_list'
static constexpr auto align = alignof(Z);
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/_
_memory/allocator.h:131:58: error: invalid application of 'sizeof' to an incomplete type 'Instruction'
_VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
/path/to/slim/src/verifier/dpor_naive.cpp:41:10: fatal error: 'bits/ranges_algo.h' file not foun
d
#include <bits/ranges_algo.h>
12c21e6で必要ないヘッダを削除しましたが、エラーの中にincomplete type
についてはコンパイルフロントエンドの問題だと考えられます。手元のclang 16.0.6
とstiltonのgcc 11.2.0
ではそのエラーがありません。
手元のApple clang version 15.0.0 (clang-1500.1.0.2.5)
,gcc (Homebrew GCC 13.2.0) 13.2.0
でこのエラーが起きることを確認しています.引き続き調査します.
原因は大体つかめました。ここで確認できるhttps://godbolt.org/z/a1dMEYPbo
clang 15.0
以上はこういう「循環参照」みたいな型はincomplete type
としてエラーとなる。
(実はill-formed
であるかもしれませんからコードの修正は必要だと思います。参照:https://stackoverflow.com/questions/70357084/code-compiles-with-g-but-not-clang-if-incomplete-type-is-used-in-templated-f)
そしてgcc 13.2.0
でコンパイルできないのはCMakeLists.txt
のバグでもう修正しました。
build
フォルダにある内容を全部削除して、cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ ..
(gcc/g++
のパスは異なるかもしれません)で試してみてください
とりあえず手元のgcc 13.2.0
でビルドできることが確認できました,ありがとうございます!(そしてhttps://github.com/lmntal/slim/issues/281 で問題になっていたbus errorが起きていないように見える!(要調査))
ついでですが,デフォルトのmake install
のインストール先を,/usr/local/bin/
ではなく,develop
ブランチと同様にこのプロジェクトフォルダ直下にbin
ディレクトリを作ってインストールするように変えていただけるとありがたいかもです.
8bfc5abの修正でAppleClangでビルドできるかもしれません。
そして実際にインストールを行った結果、現在develop
ブランチのmake install
はデフォルトで/usr/local/bin/
にインストールしているようです。
そして実際にインストールを行った結果、現在developブランチのmake installはデフォルトで/usr/local/bin/にインストールしているようです。
たしかにそうなのですが、実際の運用上は
./configure --prefix=$(pwd)
でプロジェクトルート直下にインストール先を変えていることが多いです。
(複数のバージョンを使い分けたい場面等もあるので……)
また、develop
のインストール手順(1つ目)もそのようになっています。
そのため、
のいずれかの対応はお願いしたいです。
make -j
実行時,等