Comments (7)
According to the CMake configuration, you should include the -std=c++11 option for g++. I'm using -std=c++14 in my program compilation, and that also works.
from cld3.
Thanks for the info. It was useful although I needed to build .lib for windows with visual studio. My first attempt was use GN build tool and modify BUILD.gn ΡΠ°ΠΉΠ». It was very straight forward but unfortunately chrome uses clang and use_clang = false is not available. I used this setup
gn gen --args="is_debug=false is_component_build=false target_cpu="x64" use_lld=false" out/x64.release
On theory using VS2019 with clang should work but I got many unresolved externals during the linking and I gave up.
My approach to this was to avoid clang and build all dependencies with VS2017
-
Follow the steps for buidling cld_3
-
Build protobuf from source with Visual Studio and cmake matching the chromium protobuf version (currently 3.9.0)
Directory location of the source C:/protobuf/protobuf-3.9.0
Add these lines to C:\chromium\src\third_party\cld_3\src\CMakeList.txt with correct path pointing to your directory location
Add this as first line in the file cmake_policy(SET CMP0091 NEW) to allow usage of CMAKE_MSVC_RUNTIME_LIBRARY
set (Protobuf_INCLUDE_DIR "C:/protobuf/protobuf-3.9.0/src")
set (Protobuf_LIBRARIES "C:/protobuf/protobuf-3.9.0/cmake/build/solution/Release")
set (Protobuf_LITE_LIBRARIES "C:/protobuf/protobuf-3.9.0/cmake/build/solution/Release")
set (Protobuf_PROTOC_EXECUTABLE "C:/protobuf/protobuf-3.9.0/cmake/build/solution/Release/protoc.exe")
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
I am not sure if this is needed but I added it because of the post above
install(DIRECTORY include/ DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
replace
add_executable(language_identifier_main src/language_identifier_main.cc)
target_link_libraries(language_identifier_main cld3 ${Protobuf_LITE_LIBRARIES})
with
link_directories(C:/protobuf/protobuf-3.9.0/cmake/build/solution/Release)
add_executable(language_identifier_main src/language_identifier_main.cc)
target_link_libraries(language_identifier_main cld3 ${Protobuf_LITE_LIBRARIES})
target_link_libraries(language_identifier_main cld3 libprotobuf.lib)
target_link_libraries(language_identifier_main cld3 libprotobuf-lite.lib)
target_link_libraries(language_identifier_main cld3 libprotoc.lib)
- Execute in cmd.exe
cd "C:\chromium\src\third_party\cld_3\src"
mkdir build
cd build
for x64 build
cmake -G "Visual Studio 15 2017 Win64" -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../../install ../..
You should be able to build language_identifier_main.vcproj.
This is my cmake file
https://gist.github.com/ekalchev/493c3790cdb7378dc7d1db48fabc8705
from cld3.
@dczaretsky , Thanks for the steps able to successfully build libcld3.a but When am trying to execute the C++ code am getting following error in RHEL, any idea
cld3test.cc:(.text+0x6f): undefined reference to
chrome_lang_id::NNetLanguageIdentifier::NNetLanguageIdentifier()'
cld3test.cc:(.text+0x8f): undefined reference to chrome_lang_id::NNetLanguageIdentifier::FindLanguage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' cld3test.cc:(.text+0x111): undefined reference to
chrome_lang_id::NNetLanguageIdentifier::~NNetLanguageIdentifier()'
cld3test.cc:(.text+0x166): undefined reference to chrome_lang_id::NNetLanguageIdentifier::~NNetLanguageIdentifier()'
from cld3.
@gnanaravindhan sounds like maybe the library was not linked to your program or include files were not found. You might want to check where the include and lib files were installed, then compile with -I and -L parameters to provide their paths respectively, like this:
g++ -I/usr/local/include -L/usr/local/lib -lcld3 cld3test.cc -o cld3test
from cld3.
g++ -I/usr/local/include -L/usr/local/lib -lcld3 cld3test.cc -o cld3test
@dczaretsky Thanks for your response, as recommended i've tried the same, but no luck. following is the command which am executing
g++ -I/opt/rh/vcpkg/installed/x64-linux/include -I/usr/local/include -L/usr/local/lib -lcld3 cld3test.cc -o cld3test
from cld3.
I've sorted out the issue, after changing the
-D_GLIBCXX_USE_CXX11_ABI=0
to -D_GLIBCXX_USE_CXX11_ABI=1
it's started working fine.
@dczaretsky Thanks for your help
from cld3.
I have error as below, could you please help me how to solve it?
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install
output is:
`C:\Users\HardW\Downloads\cld3-master\build.release>cmake .. -DCMAKE_BUILD_TYPE=Release
CMake Error at CMakeLists.txt:3 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/HardW/Downloads/cld3-master/build.release/CMakeFiles/CMakeOutput.log"`
from cld3.
Related Issues (20)
- gcld3 compatible with pylint and mypy
- ImportError (Python3.9, protobuf 21.5) HOT 1
- Training set HOT 2
- request for documentation: how to add a new language
- Some of the languages not detected properly if repeats the words multiple times
- Some of the English words detect as different language HOT 4
- Import gcld3 fails
- Train a new model
- Can't install gcld3 on MacOS Ventura 13.2.1 HOT 4
- Could not build wheels for gcld3, which is required to install pyproject.toml-based projects HOT 5
- Cannot build with CMake and Make HOT 1
- documentation issue. HOT 1
- Make a release
- Unable to install gcld3 on python 3.10.12 HOT 1
- Cannot detect the regional variations/ dialects in the Language with gcld3
- Unable to install gcld3 on Apple MacOS M2 HOT 1
- Installing on windows requires 'protobuf.lib' file that does not exist
- Please, update installation instructions for windows.
- Please support Traditional Chinese to return "zh-Hant" code. HOT 1
- Is this project DEAD?
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 cld3.