Closed aejazm closed 5 months ago
what's the compiler that you are using, it looks uint8_t type definition is missed, which was added in C++ 11 standard. You may try to explicitly add
I also ran into this issue when trying to run the library build. I'm running on a basic install of Arch Linux, using GCC 13, on the current HEAD (d47a3dd)
./build_lib.sh --config Release --update --build --parallel
/usr/bin/c++ --version
c++ (GCC) 13.2.1 20230801
I had to add <cstdint>
to base64.h
, and remove the std::
prefix from some of the types in segment_extraction.cc
(which makes them consistent with other usages in the file), to get it compiled:
diff --git a/base/base64.h b/base/base64.h
index 121b223..e29290f 100644
--- a/base/base64.h
+++ b/base/base64.h
@@ -4,6 +4,7 @@
#pragma once
#include <string>
#include <vector>
+#include <cstdint>
bool base64_encode(const std::vector<uint8_t>& input, std::string& encoded);
bool base64_decode(const std::string& encoded, std::vector<uint8_t>& raw);
diff --git a/operators/math/segment_extraction.cc b/operators/math/segment_extraction.cc
index 1d4871a..3d880b6 100644
--- a/operators/math/segment_extraction.cc
+++ b/operators/math/segment_extraction.cc
@@ -11,9 +11,9 @@ OrtStatusPtr segment_extraction(const ortc::Tensor<int64_t>& input,
return OrtW::CreateStatus("[SegmentExtraction]: Expect input dimension [n] or [1,n].", ORT_INVALID_GRAPH);
}
const int64_t* p_data = input.Data();
- std::vector<std::int64_t> segment_value;
- std::vector<std::int64_t> segment_position;
- for (std::int64_t i = 0; i < input.NumberOfElement(); i++) {
+ std::vector<int64_t> segment_value;
+ std::vector<int64_t> segment_position;
+ for (int64_t i = 0; i < input.NumberOfElement(); i++) {
if (!p_data[i]) {
continue;
}
I'm not going to make a PR only because I'm not sure how the changes will affect things (especially on other platforms), but hopefully this helps if anyone else sees the same error.
I am also having the same build error on Arch and GCC 13.2.1.
@aejazm, @KilowattJunkie, @leejuyuu , I don't have a machine with GCC-13 installed, can any of you help to validate the PR I linked here?
@wenbingl I can build this branch successfully on Arch Linux, with GCC version as follows.
➜ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230801 (GCC)
The tests passed, but I see some warnings
Thanks for verification. The warnings are irrelevant which are caused by the glitches in the test onnx models.
Got it. Thanks for fixing this!
Getting the following errors while building the HEAD version on Linux following instructions from here. I am attaching the full build output as well. Please let me know if I am missing something basic.
$ git clone https://github.com/microsoft/onnxruntime-extensions $ cd onnxruntime-extensions $ ./build_lib.sh --config Release --update --build --parallel .................. [ 42%] Building CXX object _deps/spm-build/src/CMakeFiles/sentencepiece-static.dir/normalizer.cc.o [ 42%] Building CXX object _deps/opencv-build/modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o In file included from ./sources/onnxruntime-extensions/base/base64.cc:3: ./sources/onnxruntime-extensions/base/base64.h:8:38: error: ‘uint8_t’ was not declared in this scope 8 | bool base64_encode(const std::vector& input, std::string& encoded);
| ^’; did you forget to ‘#include ’?
6 | #include
+++ |+#include
7 |
./sources/onnxruntime-extensions/base/base64.h:8:45: error: template argument 1 is invalid
8 | bool base64_encode(const std::vector& input, std::string& encoded);
| ^
./sources/onnxruntime-extensions/base/base64.h:8:45: error: template argument 2 is invalid
./sources/onnxruntime-extensions/base/base64.h:9:60: error: ‘uint8_t’ was not declared in this scope
9 | bool base64_decode(const std::string& encoded, std::vector& raw);
| ^’; did you forget to ‘#include ’?
./sources/onnxruntime-extensions/base/base64.h:9:67: error: template argument 1 is invalid
9 | bool base64_decode(const std::string& encoded, std::vector& raw);
| ^
./sources/onnxruntime-extensions/base/base64.h:9:67: error: template argument 2 is invalid
./sources/onnxruntime-extensions/base/base64.cc:9:38: error: ‘uint8_t’ was not declared in this scope
9 | bool base64_encode(const std::vector& input, std::string& encoded) {
| ^’; did you forget to ‘#include ’?
4 | #include
+++ |+#include
5 |
./sources/onnxruntime-extensions/base/base64.cc:9:45: error: template argument 1 is invalid
9 | bool base64_encode(const std::vector& input, std::string& encoded) {
| ^
./sources/onnxruntime-extensions/base/base64.cc:9:45: error: template argument 2 is invalid
./sources/onnxruntime-extensions/base/base64.cc: In function ‘bool base64_encode(const int&, std::string&)’:
./sources/onnxruntime-extensions/base/base64.cc:11:27: error: request for member ‘size’ in ‘input’, which is of non-class type ‘const int’
11 | encoded.reserve(((input.size() / 3) + (input.size() % 3 > 0)) 4);
| ^~~~
./sources/onnxruntime-extensions/base/base64.cc:11:48: error: request for member ‘size’ in ‘input’, which is of non-class type ‘const int’
11 | encoded.reserve(((input.size() / 3) + (input.size() % 3 > 0)) 4);
| ^~~~
./sources/onnxruntime-extensions/base/base64.cc:12:3: error: ‘uint32_t’ was not declared in this scope
12 | uint32_t temp;
| ^’; did you forget to ‘#include ’?
./sources/onnxruntime-extensions/base/base64.cc:13:15: error: ‘uint8_t’ was not declared in this scope
13 | std::vector::const_iterator cursor = input.begin();
| ^’; did you forget to ‘#include ’?
./sources/onnxruntime-extensions/base/base64.cc:13:22: error: template argument 1 is invalid
13 | std::vector::const_iterator cursor = input.begin();
| ^
./sources/onnxruntime-extensions/base/base64.cc:13:22: error: template argument 2 is invalid
./sources/onnxruntime-extensions/base/base64.cc:13:40: error: expected initializer before ‘cursor’
13 | std::vector::const_iterator cursor = input.begin();
| ^& decoded) {
| ^’; did you forget to ‘#include ’?
./sources/onnxruntime-extensions/base/base64.cc:43:65: error: template argument 1 is invalid
43 | bool base64_decode(const std::string& input, std::vector& decoded) {
| ^
./sources/onnxruntime-extensions/base/base64.cc:43:65: error: template argument 2 is invalid
./sources/onnxruntime-extensions/base/base64.cc: In function ‘bool base64_decode(const std::string&, int&)’:
./sources/onnxruntime-extensions/base/base64.cc:54:11: error: request for member ‘clear’ in ‘decoded’, which is of non-class type ‘int’
54 | decoded.clear();
| ^~~~~
./sources/onnxruntime-extensions/base/base64.cc:55:11: error: request for member ‘reserve’ in ‘decoded’, which is of non-class type ‘int’
55 | decoded.reserve(((input.length() / 4) * 3) - padding);
| ^’; did you forget to ‘#include ’?
./sources/onnxruntime-extensions/base/base64.cc:61:7: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
61 | temp <<= 6;
| ^~~~
| tm
./sources/onnxruntime-extensions/base/base64.cc:75:21: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’
75 | decoded.push_back((temp >> 16) & 0x000000FF);
| ^
~~ ./sources/onnxruntime-extensions/base/base64.h:7:1: note: ‘uint8_t’ is defined in header ‘~~ ./sources/onnxruntime-extensions/base/base64.h:9:60: note: ‘uint8_t’ is defined in header ‘~~ ./sources/onnxruntime-extensions/base/base64.cc:5:1: note: ‘uint8_t’ is defined in header ‘~~~ ./sources/onnxruntime-extensions/base/base64.cc:12:3: note: ‘uint32_t’ is defined in header ‘~~ ./sources/onnxruntime-extensions/base/base64.cc:13:15: note: ‘uint8_t’ is defined in header ‘~./sources/onnxruntime-extensions/base/base64.cc:14:36: error: request for member ‘size’ in ‘input’, which is of non-class type ‘const int’ 14 | for (size_t idx = 0; idx < input.size() / 3; idx++) { | ^~~~ ./sources/onnxruntime-extensions/base/base64.cc:15:5: error: ‘temp’ was not declared in this scope; did you mean ‘tm’? 15 | temp = (cursor++) << 16; //Convert to big endian | ^~~~ | tm ./sources/onnxruntime-extensions/base/base64.cc:15:14: error: ‘cursor’ was not declared in this scope 15 | temp = (cursor++) << 16; //Convert to big endian | ^~./sources/onnxruntime-extensions/base/base64.cc:23:17: error: request for member ‘size’ in ‘input’, which is of non-class type ‘const int’ 23 | switch (input.size() % 3) { | ^~~~ ./sources/onnxruntime-extensions/base/base64.cc:25:7: error: ‘temp’ was not declared in this scope; did you mean ‘tm’? 25 | temp = (cursor++) << 16; | ^~~~ | tm ./sources/onnxruntime-extensions/base/base64.cc:25:16: error: ‘cursor’ was not declared in this scope 25 | temp = (cursor++) << 16; | ^~./sources/onnxruntime-extensions/base/base64.cc: At global scope: ./sources/onnxruntime-extensions/base/base64.cc:43:58: error: ‘uint8_t’ was not declared in this scope 43 | bool base64_decode(const std::string& input, std::vector~~ ./sources/onnxruntime-extensions/base/base64.cc:43:58: note: ‘uint8_t’ is defined in header ‘~~ ./sources/onnxruntime-extensions/base/base64.cc:56:3: error: ‘uint32_t’ was not declared in this scope 56 | uint32_t temp = 0; | ^~~~ ./sources/onnxruntime-extensions/base/base64.cc:56:3: note: ‘uint32_t’ is defined in header ‘~~~~ ./sources/onnxruntime-extensions/base/base64.cc:76:21: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’ 76 | decoded.push_back((temp >> 8) & 0x000000FF); | ^~~~~ ./sources/onnxruntime-extensions/base/base64.cc:79:21: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’ 79 | decoded.push_back((temp >> 10) & 0x000000FF); | ^~~~~ ./sources/onnxruntime-extensions/base/base64.cc:88:13: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’ 88 | decoded.push_back((temp >> 16) & 0x000000FF); | ^~~~~ ./sources/onnxruntime-extensions/base/base64.cc:88:24: error: ‘temp’ was not declared in this scope; did you mean ‘tm’? 88 | decoded.push_back((temp >> 16) & 0x000000FF); | ^~~~ | tm ./sources/onnxruntime-extensions/base/base64.cc:89:13: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’ 89 | decoded.push_back((temp >> 8) & 0x000000FF); | ^~~~~ ./sources/onnxruntime-extensions/base/base64.cc:90:13: error: request for member ‘push_back’ in ‘decoded’, which is of non-class type ‘int’ 90 | decoded.push_back((temp)&0x000000FF); | ^~~~~ buildOutput.txt