Tesseract api linker (or build?) problem on window - c++

I want to use tesseract api on my project. And the problem is I can't compile my test code that look like this.
#include <iostream>
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
int main()
{
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
api->End();
delete api;
return 0;
}
I'm using this
g++ -L/Projects/cpp/CPE1/Project/lib/ -ltesseract50 -lleptonica -I/Projects/cpp/CPE1/Project/include t.cpp -o t
and got
C:\Users\MSINOT~1\AppData\Local\Temp\cc4xWMfF.o:t.cpp:(.text+0x21): undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'
C:\Users\MSINOT~1\AppData\Local\Temp\cc4xWMfF.o:t.cpp:(.text+0x44): undefined reference to `tesseract::TessBaseAPI::End()'
collect2.exe: error: ld returned 1 exit status
my folder structure looks like this (this is all on drive D:)
\---Project
+---bin
+---cmake
+---include
| +---leptonica
| \---tesseract
+---leptonica-1.80.0
+---lib
| +---cmake
| \---pkgconfig
+---tesseract-master
\---Uics
[my code is here]
I compiled leptonica and tesseract following this https://tesseract-ocr.github.io/tessdoc/Compiling.html#windows on "Develop Tesseract" and specify install path to my project folder.
I'm a noob in this type of problem, so if you have completely different ways to use tesseract API pls tell me.
g++.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Tesseract from main branch https://github.com/tesseract-ocr/tesseract
Leptonica from 1.80.0 release
https://github.com/DanBloomberg/leptonica
cmake version 3.19.4
*edit add lib folder listing
D:\PROJECTS\CPP\CPE1\PROJECT\LIB
| leptonica.lib
| tesseract50.lib
|
+---cmake
| +---leptonica
| | LeptonicaConfig-version.cmake
| | LeptonicaConfig.cmake
| | LeptonicaTargets-release.cmake
| | LeptonicaTargets.cmake
| |
| \---tesseract
| TesseractConfig.cmake
| TesseractConfigVersion.cmake
| TesseractTargets-release.cmake
| TesseractTargets.cmake
|
\---pkgconfig
lept.pc
tesseract.pc

Related

Using shellspec for testing

I try to implement a testing framework using shellspec.
I have read the article and README at shellspec github project.
But I`m still confused about how to customise projects directories.
I`d like to have the next structure of my testing framework:
<root_dir>
|-- README
|
|-- tests
|
|-- test_instance_1
| |
| |-- lib
| | |
| | |-- my_test_1.sh
| |
| |-- spec
| |
| |-- my_test_1_spec.sh
|
|
|-- test_instance_2
|
|-- lib
| |
| |-- my_test_2.sh
|
|-- spec
|
|-- my_test_2_spec.sh
As it is mentioned at shellspec github project, it is possible to customise directory structure:
This is the typical directory structure. Version 0.28.0 allows many of
these to be changed by specifying options, supporting a more flexible
directory structure.
So I tried to modify my .shellspec file in the following way:
--default-path "***/spec"
--execdir #basedir/lib`
But when I run shellspec command in my command line, I get the next errors:
shellspec.sh: eval: line 23: unexpected EOF while looking for matching ``'
shellspec.sh: eval: line 24: syntax error: unexpected end of file
shellspec is run in <root_dir>.
Also I saw that there should be .shellspec-basedir file in each subdirectory, but I don`t realise, what it should contain.
I'd be happy, if someone give an example of existing project with custome directory structure or tell me, what I`m doing wrong.
The answer turned out to be very simple. Need to use
--default-path "**/spec"
to find _spec.sh files in all spec/ directories in the project

Trouble with creating first Substrate chain

When I try to compile the Node Template I get a series of errors.
error: failed to run custom build command for node-template-runtime v2.0.0 (/Users/Modulus3D/VSCode Projects/substrate-node-template/runtime)
Caused by:
process didn't exit successfully: /Users/Modulus3D/VSCode Projects/substrate-node-template/target/release/build/node-template-runtime-cae9ad6029c9f681/build-script-build (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/Modulus3D/VSCode Projects/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
and also:
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1595 | / implement_fixed!(
1596 | | FixedI64,
1597 | | test_fixed_i64,
1598 | | i64,
... |
1601 | | "Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]",
1602 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1604 | / implement_fixed!(
1605 | | FixedI128,
1606 | | test_fixed_i128,
1607 | | i128,
... |
1611 | | [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
1612 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1614 | / implement_fixed!(
1615 | | FixedU128,
1616 | | test_fixed_u128,
1617 | | u128,
... |
1621 | | [0.000000000000000000, 340282366920938463463.374607431768211455]_",
1622 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
For more information about this error, try rustc --explain E0282.
error: could not compile sp-arithmetic
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed
Any suggestions on how to resolve these errors??
Look like you need to downgrade you nightly version.
You can do so by running the following sequence of commands:
rustup install nightly-2020-10-06
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-06
export WASM_BUILD_TOOLCHAIN=nightly-2020-10-06
You can learn more about how nightly is used with substrate here: https://substrate.dev/docs/en/knowledgebase/getting-started/#rust-nightly-toolchain
Fresh project always facing the efferent nightly versions issue.
If you running the substrate version 2.0.0 you can solve it with bellow command:
rustup install nightly-2020-07-02
rustup override set nightly-2020-07-02
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-07-02
then try to re build again!

How to specify different buld dirrectories for qmake?

I use qmake. I have the following project structure:
/
|_SFMLWidgets
| |_...
| |_View.h
| |_View.cpp
| \_...
|
|_MapEditor
| |_...
| |_View.h
| |_View.cpp
| \_...
|
\_main.cpp
This views do different things. When I try to compile project I get compilation errors:
overriding recipe for target 'debug/View.o'
ignoring old recipe for target 'debug/View.o'
It happens because both views are builded in same directory. Is there any way to specify different build dirrectories?
I want something like:
/
|_debug
|_SFMLWidgets
| |_...
| |_View.o
| \_...
|
|_MapEditor
| |_...
| |_View.o
| \_...
|
|_main.o
\_main.exe
My .pro file
You can put each of SFMLwidgets and MapEditor in separate subdirs qmake project files. Shared configuration of the two subprojects can go into a pri file.

rails 4 mysql2 gem Incorrect MySQL client library version! This gem was compiled for 5.5.30 but the client library is 5.6.19

upon deployment in production, I get this error , I don't understand where is coming from this 5.5.30... but I uninstalled the gem locally (oSX) and remotely (Debian) and reinstalled it... so it should be compiled with the latest libraries.. 5.6.19
here are both MySQL versions installed ...
on Debian
mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
Enter password:
+-------------------------+-------------------+
| Variable_name | Value |
+-------------------------+-------------------+
| innodb_version | 5.6.19 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.19-1~dotdeb.1 |
| version_comment | (Debian) |
| version_compile_machine | x86_64 |
| version_compile_os | debian-linux-gnu |
+-------------------------+-------------------+
on OSX
yves$ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
Enter password:
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.6.19 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.19 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | osx10.7 |
+-------------------------+------------------------------+

DOMElement has no member named 'getFirstElementChild xercesc C++

I'm writing a xml parser file, called GetConfig.cpp.
Here is my header file of 'GetConfig.h`:
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMDocumentType.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/dom/DOMNodeIterator.hpp>
#include <xercesc/dom/DOMText.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
However, When I try to compile the program, I get:
/home/pribeiro/sandbox/GetConfig.cpp:372: error: 'class xercesc_2_2::DOMElement' has no member named 'getFirstElementChild'
/home/pribeiro/sandbox/GetConfig.cpp:381: error: 'class xercesc_2_2::DOMElement' has no member named 'getFirstElementChild'
/home/pribeiro/sandbox/GetConfig.cpp:392: error: 'class xercesc_2_2::DOMElement' has no member named 'getFirstElementChild'
/home/pribeiro/sandbox/GetConfig.cpp:396: error: 'class xercesc_2_2::DOMElement' has no member named 'getNextElementSibling'
I'm not sure why I'm getting that ...
In that declaration I use:
DOMElement *volume = dynamic_cast<xercesc::DOMElement*>
(volManager);
while(volume){
// to the parsing here
volume = volume->getNextElementSibling();
}
I'm not sure ... Maybe something related to the version of xercesc? When I compiled that for xercesc 3.1 it worked fine.
Those functions were introduced in Xerces 3
You see them mentioned in the Xerces 3 API documentation:
http://xerces.apache.org/xerces-c/apiDocs-3/classDOMElement.html
but not in the Xerces 2 API documentation:
http://xerces.apache.org/xerces-c/apiDocs-2/classDOMElement.html
The string "getFirstElementChild" occurs 31 times in the Xerces 3.1.1 sources but not at all in the Xerces 2.8.0 sources:
erik#ubuntu:/tmp$ file=http://archive.apache.org/dist/xerces/c/2/sources/xerces-c-src_2_8_0.tar.gz
erik#ubuntu:/tmp$ curl -s $file | tar xfz - -O | grep getFirstElementChild | wc -l
0
erik#ubuntu:/tmp$ file=http://archive.apache.org/dist/xerces/c/3/sources/xerces-c-3.1.1.tar.gz
erik#ubuntu:/tmp$ curl -s $file | tar xfz - -O | grep getFirstElementChild | wc -l
31
erik#ubuntu:/tmp$