Can't build unittest with gcc8.5 and clang 12
- Dominant language
- C++
- Stars
- 4.4k
- Forks
- 658
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 10
Description
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
### Version
centos8/gcc8.5/clang12
kvrocks: unstable/2ecf764d
### Minimal reproduce step
./x.py build -j 20 --unittest
```
Consolidate compiler generated dependencies of target unittest
[ 94%] Linking CXX executable unittest
CMakeFiles/unittest.dir/tests/cppunit/compact_test.cc.o: In function `Compact_Filter_Test::TestBody()':
/usr/include/c++/8/bits/fs_path.h:185: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
CMakeFiles/unittest.dir/tests/cppunit/compact_test.cc.o: In function `Compact_Filter_Test::TestBody()':
/home/yanzhao.tang/Code/kvrocks/tests/cppunit/compact_test.cc:128: undefined reference to `std::filesystem::remove_all(std::filesystem::__cxx11::path const&, std::error_code&)'
CMakeFiles/unittest.dir/tests/cppunit/disk_test.cc.o: In function `TestBase::~TestBase()':
/usr/include/c++/8/bits/fs_path.h:185: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
CMakeFiles/unittest.dir/tests/cppunit/disk_test.cc.o: In function `TestBase::~TestBase()':
```
./x.py build -j 20 --unittest --compiler clang
```
[100%] Linking CXX executable unittest
ld.lld: error: undefined symbol: std::filesystem::__cxx11::path::_M_split_cmpts()
>>> referenced by fs_path.h:185 (/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/fs_path.h:185)
>>> CMakeFiles/unittest.dir/tests/cppunit/compact_test.cc.o:(Compact_Filter_Test::TestBody())
>>> referenced by fs_path.h:185 (/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/fs_path.h:185)
>>> CMakeFiles/unittest.dir/tests/cppunit/disk_test.cc.o:(TestBase::~TestBase())
>>> referenced by fs_path.h:185 (/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/fs_path.h:185)
>>> CMakeFiles/unittest.dir/tests/cppunit/rdb_test.cc.o:(std::filesystem::__cxx11::path::path, std::allocator >, std::filesystem::__cxx11::path>(std::__cxx11::basic_string, std::allocator > const&, std::filesystem::__cxx11::path::format))
```
### What did you expect to see?
code compiled
### What did you see instead?
code not compiled
### Anything Else?
_No response_
### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failure with ./x.py build -j 20 --unittest using GCC 8.5 and Clang 12, then inspect the build configuration and the filesystem usages in tests/cppunit/compact_test.cc, disk_test.cc, and rdb_test.cc. Done means the unittest target links and builds successfully with both compiler commands shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100