Comments (5)
Could you let me know the OS and distribution?
Did you see some errors when running g++ manually?
/usr/local/gcc-5/4/0/bin/g++ -std=c++11 foo.cc
from sentencepiece.
My OS is CentOS Linux 7 (Core).
There is no error when I run g++ manually with -std=c++11 option.
/usr/local/gcc-5.4.0/bin/g++ -std=c++11 foo.cc
I am trying to embed sentencepiece into different project.
And I need to build sentencepiece with -std=c++11 option because the project built with -std=c++11 option.
I have code as shown below
...
#include <sentencepiece_processor.h>
...
sentencepiece::SentencePieceProcessor processor;
...
const auto status = processor.Load("sentencepiece model file");
...
processor.Encode(src, &pieces_src);
...
When I compile my project it shows error shown below
undefined reference to ...
`sentencepiece::SentencePieceProcessor::Encode(sentencepiece::util::min_string_view, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*) const'
from sentencepiece.
Seems that it's not related to the original question, but you can fix it by adding
-L/usr/local/lib -lsentencepiece -lsentencepiece_train -lprotobuf
to linker option. This option can be found with
% pkg-config --libs sentencepiece
from sentencepiece.
I am sorry, I was not clear.
I think there is no problem in linker option.
Compiler shows the error message not because of wrong linker option.
It shows the error message because of sentencepiece is compiled without std=c++11 option.
I checked compiled sentensepiece library and there is Encode() functions shown below
00000000000265f0 T sentencepiece::SentencePieceProcessor::Encode(sentencepiece::util::min_string_view, sentencepiece::SentencePieceText*) const
0000000000022df0 T sentencepiece::SentencePieceProcessor::Encode(sentencepiece::util::min_string_view, std::vector<std::string, std::allocator<std::string> >*) const
00000000000232f0 T sentencepiece::SentencePieceProcessor::Encode(sentencepiece::util::min_string_view, std::vector<int, std::allocator<int> >*) const
but my program (that uses sentencepiece library) needs Encode() function defined as follow.
sentencepiece::SentencePieceProcessor::Encode(sentencepiece::util::min_string_view, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*) const
I had same problem with other library and I solved it by compling the library with std=c++11 option.
But I was not able to build sentencepiece with std=c++11 option.
from sentencepiece.
In general, C++ has no ABI incompatibilities -- the same linker and compiler must be used in your program. --std=c++11 may not help this issue.
from sentencepiece.
Related Issues (20)
- No make file found while build and install the Python wrapper HOT 2
- Tokenize at the word level without spacers nor joiners HOT 2
- Build sentencepiece with mingw HOT 1
- Tokenization for phonetic languages HOT 1
- Runtime error on iOS HOT 4
- entry points return non-zero exit code (at least for `--help`) HOT 2
- HELP NEEDED Mask Token in SentencePiece tokenizer HELP NEEDED HOT 1
- Sequence of byte '<0x09>' as token HOT 1
- TSV for NFC normalization HOT 1
- Allow whitespace-only pieces
- coredump when build with CXXFLAGS `-Wp,-D_GLIBCXX_ASSERTIONS`
- Only Pretokenization HOT 3
- pip subprocess to install build dependencies did not run successfully. │ exit code: 1 HOT 1
- Windows pip Dependancy Installation Error HOT 2
- Any api for setting user defined symbols? HOT 1
- Inconsistent result between py and cpp HOT 1
- Error when running this command: pip install 'transformers[tf-cpu]' on mac HOT 1
- Support for Windows Python 3.12.2
- Is GGUF supported? HOT 1
- Treat Hawaiian Glottal stop as consonant, not punctuation HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentencepiece.