A distributed approximate nearest neighborhood search (ANN) library which provides a high quality vector index build, search and distributed online serving toolkits for large scale vector search scenario.
MIT License
4.83k
stars
581
forks
source link
build failure with GCC 13 due to missing `#include <cstdint> in `AnnService/inc/Helper/DiskIO.h` #389
Describe the bug
SPTAG fails to build on Linux with GCC 13, because AnnService/inc/Helper/DiskIO.h uses std::uint16_t, std::uint32_t and std::uint64_t but does not #include <cstdint>.
To Reproduce
Install GCC 13 and build SPTAG.
Steps to reproduce the behavior:
Install Debian
Upgrade to Debian 13
Add unstable to apt sources
apt update
apt install gcc-13 g++-13
Add experimental to apt sources
apt update
apt install -t experimental gcc g++
Build SPTAG
Notice failure
Expected behavior
All files should include the headers they need to use the types, variables and functions that they use but don't define.
All of the following files probably should contain #include <cstdint>:
cd "build/AnnService" && /usr/bin/c++ -DNUMA -DSPTAGLib_EXPORTS -I"AnnService" -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wunreachable-code -Wno-reorder -Wno-delete-non-virtual-dtor -Wno-sign-compare -Wno-unknown-pragmas -Wcast-align -lm -lrt -fopenmp -lnuma -fopenmp -std=gnu++17 -fPIC -MD -MT AnnService/CMakeFiles/SPTAGLib.dir/src/Helper/AsyncFileReader.cpp.o -MF CMakeFiles/SPTAGLib.dir/src/Helper/AsyncFileReader.cpp.o.d -o CMakeFiles/SPTAGLib.dir/src/Helper/AsyncFileReader.cpp.o -c "AnnService/src/Helper/AsyncFileReader.cpp"
In file included from AnnService/inc/Helper/AsyncFileReader.h:7,
from AnnService/src/Helper/AsyncFileReader.cpp:4:
AnnService/inc/Helper/DiskIO.h:29:18: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
29 | std::uint64_t m_offset;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:30:18: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
30 | std::uint64_t m_readSize;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h: In constructor 'SPTAG::Helper::AsyncReadRequest::AsyncReadRequest()':
AnnService/inc/Helper/DiskIO.h:42:34: error: class 'SPTAG::Helper::AsyncReadRequest' does not have any field named 'm_offset'
42 | AsyncReadRequest() : m_offset(0), m_readSize(0), m_buffer(nullptr), m_status(0), m_payload(nullptr), m_success(false), m_extension(nullptr) {}
| ^~~~~~~~
AnnService/inc/Helper/DiskIO.h:42:47: error: class 'SPTAG::Helper::AsyncReadRequest' does not have any field named 'm_readSize'
42 | AsyncReadRequest() : m_offset(0), m_readSize(0), m_buffer(nullptr), m_status(0), m_payload(nullptr), m_success(false), m_extension(nullptr) {}
| ^~~~~~~~~~
AnnService/inc/Helper/DiskIO.h: At global scope:
AnnService/inc/Helper/DiskIO.h:54:17: error: 'std::uint64_t' has not been declared
54 | std::uint64_t maxIOSize = (1 << 20),
| ^~~
AnnService/inc/Helper/DiskIO.h:55:17: error: 'std::uint32_t' has not been declared
55 | std::uint32_t maxReadRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:56:17: error: 'std::uint32_t' has not been declared
56 | std::uint32_t maxWriteRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:57:17: error: 'std::uint16_t' has not been declared
57 | std::uint16_t threadPoolSize = 4) = 0;
| ^~~
AnnService/inc/Helper/DiskIO.h:59:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
59 | virtual std::uint64_t ReadBinary(std::uint64_t readSize, char* buffer, std::uint64_t offset = UINT64_MAX) = 0;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:61:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
61 | virtual std::uint64_t WriteBinary(std::uint64_t writeSize, const char* buffer, std::uint64_t offset = UINT64_MAX) = 0;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:63:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
63 | virtual std::uint64_t ReadString(std::uint64_t& readSize, std::unique_ptr<char[]>& buffer, char delim = '\n', std::uint64_t offset = UINT64_MAX) = 0;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:65:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
65 | virtual std::uint64_t WriteString(const char* buffer, std::uint64_t offset = UINT64_MAX) = 0;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:69:72: error: 'std::uint32_t' has not been declared
69 | virtual bool BatchReadFile(AsyncReadRequest* readRequests, std::uint32_t requestCount) { return false; }
| ^~~
AnnService/inc/Helper/DiskIO.h:71:92: error: 'std::uint32_t' has not been declared
71 | virtual bool BatchCleanRequests(SPTAG::Helper::AsyncReadRequest* readRequests, std::uint32_t requestCount) { return false; }
| ^~~
AnnService/inc/Helper/DiskIO.h:73:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
73 | virtual std::uint64_t TellP() = 0;
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:87:17: error: 'std::uint64_t' has not been declared
87 | std::uint64_t maxIOSize = (1 << 20),
| ^~~
AnnService/inc/Helper/DiskIO.h:88:17: error: 'std::uint32_t' has not been declared
88 | std::uint32_t maxReadRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:89:17: error: 'std::uint32_t' has not been declared
89 | std::uint32_t maxWriteRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:90:17: error: 'std::uint16_t' has not been declared
90 | std::uint16_t threadPoolSize = 4)
| ^~~
AnnService/inc/Helper/DiskIO.h:96:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
96 | virtual std::uint64_t ReadBinary(std::uint64_t readSize, char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:103:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
103 | virtual std::uint64_t WriteBinary(std::uint64_t writeSize, const char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:111:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
111 | virtual std::uint64_t ReadString(std::uint64_t& readSize, std::unique_ptr<char[]>& buffer, char delim = '\n', std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:144:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
144 | virtual std::uint64_t WriteString(const char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:149:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
149 | virtual std::uint64_t TellP()
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:176:22: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
176 | std::uint64_t tellp()
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:192:17: error: 'std::uint64_t' has not been declared
192 | std::uint64_t maxIOSize = (1 << 20),
| ^~~
AnnService/inc/Helper/DiskIO.h:193:17: error: 'std::uint32_t' has not been declared
193 | std::uint32_t maxReadRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:194:17: error: 'std::uint32_t' has not been declared
194 | std::uint32_t maxWriteRetries = 2,
| ^~~
AnnService/inc/Helper/DiskIO.h:195:17: error: 'std::uint16_t' has not been declared
195 | std::uint16_t threadPoolSize = 4)
| ^~~
AnnService/inc/Helper/DiskIO.h:204:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
204 | virtual std::uint64_t ReadBinary(std::uint64_t readSize, char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:210:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
210 | virtual std::uint64_t WriteBinary(std::uint64_t writeSize, const char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:217:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
217 | virtual std::uint64_t ReadString(std::uint64_t& readSize, std::unique_ptr<char[]>& buffer, char delim = '\n', std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:251:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
251 | virtual std::uint64_t WriteString(const char* buffer, std::uint64_t offset = UINT64_MAX)
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/DiskIO.h:256:26: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
256 | virtual std::uint64_t TellP()
| ^~~~~~~~
| wint_t
AnnService/inc/Helper/AsyncFileReader.h: In member function 'virtual bool SPTAG::Helper::AsyncFileIO::ReadFileAsync(SPTAG::Helper::AsyncReadRequest&)':
AnnService/inc/Helper/AsyncFileReader.h:580:49: error: 'struct SPTAG::Helper::AsyncReadRequest' has no member named 'm_readSize'
580 | myiocb.aio_nbytes = readRequest.m_readSize;
| ^~~~~~~~~~
AnnService/inc/Helper/AsyncFileReader.h:581:75: error: 'struct SPTAG::Helper::AsyncReadRequest' has no member named 'm_offset'
581 | myiocb.aio_offset = static_cast<std::int64_t>(readRequest.m_offset);
| ^~~~~~~~
AnnService/src/Helper/AsyncFileReader.cpp: In function 'void SPTAG::Helper::BatchReadFileAsync(std::vector<std::shared_ptr<DiskIO> >&, AsyncReadRequest*, int)':
AnnService/src/Helper/AsyncFileReader.cpp:73:51: error: 'struct SPTAG::Helper::AsyncReadRequest' has no member named 'm_readSize'
73 | myiocb->aio_nbytes = readRequest->m_readSize;
| ^~~~~~~~~~
AnnService/src/Helper/AsyncFileReader.cpp:74:77: error: 'struct SPTAG::Helper::AsyncReadRequest' has no member named 'm_offset'
74 | myiocb->aio_offset = static_cast<std::int64_t>(readRequest->m_offset);
| ^~~~~~~~
make[2]: *** [AnnService/CMakeFiles/SPTAGLib.dir/build.make:233: AnnService/CMakeFiles/SPTAGLib.dir/src/Helper/AsyncFileReader.cpp.o] Error 1
make[2]: Leaving directory 'build'
make[1]: *** [CMakeFiles/Makefile2:959: AnnService/CMakeFiles/SPTAGLib.dir/all] Error 2
make[1]: Leaving directory 'build'
make: *** [Makefile:149: all] Error 2
Desktop (please complete the following information):
OS: Debian
Version 13
Additional context
I verified that adding #include <cstdint> to AnnService/inc/Helper/DiskIO.h fixes the build failure,
however it isn't sufficient to fix the more general problem of missing includes, the tool called
include-what-you-use can help discover the missing includes.
Forwarding Debian sptag bug #1037866
Describe the bug SPTAG fails to build on Linux with GCC 13, because
AnnService/inc/Helper/DiskIO.h
usesstd::uint16_t
,std::uint32_t
andstd::uint64_t
but does not#include <cstdint>
.To Reproduce Install GCC 13 and build SPTAG.
Steps to reproduce the behavior:
apt update
apt install gcc-13 g++-13
apt update
apt install -t experimental gcc g++
Expected behavior All files should include the headers they need to use the types, variables and functions that they use but don't define.
All of the following files probably should contain
#include <cstdint>
:Screenshots
Desktop (please complete the following information):
Additional context I verified that adding
#include <cstdint>
toAnnService/inc/Helper/DiskIO.h
fixes the build failure, however it isn't sufficient to fix the more general problem of missing includes, the tool called include-what-you-use can help discover the missing includes.