Can't Compile Tesseract API example for WIndows using Tesseract 3.0.2.02 archive - tesseract

I'm looking at using Tesseract to do some work with PDF files, and so I want to use the library rather than an external executable.
I started by downloading the full Tesseract source and looking at building that. Sadly the standard sources don't have any means to build on a non-Linux platform, in my case Windows. There are methods for doing so, and I looked at those.
Firstly the VS2008 build doesn't. I'm aware that it need Leptonica, but I figured I'd tackle that afterwards and just tried to build the existing code. Fails with "fatal error C1083: Cannot open include file: 'allheaders.h': No such file or directory". Nothing to do with Leptonica at this stage, it simply doesn't work.
Even if I were able to get past that, I'd have to build Leptonica, and that requires using GNU tools and therefore an installation of Cygwin, so I gave up. I Have a MingW instatllation, (I've never managed to get Cygwin to work in a usable fashion) but I'm not keen enough to mess with such a complicated and fragile build.
So I decided I'd just use the pre-built binaries which some kind soul creates. Downloaded that from code.google.com. Now I need to look into using the code, so the next obvious step is the Tesseract API example, which states it requires "tesseract-ocr-3.02.02-win32-lib-include-dirs.zip", no problem, because I already have that now.
No real clue as to where the API example wants the files to be placed, but a little messing about gets them in appropriate locations. Press build and "fatal error C1083: Cannot open include file: 'allheaders.h': No such file or directory", just like trying to build Tesseract from source.....
And indeed there is no such file.
So, where is this file ?

I also struggled some time ago to make it works under windows and then I found this git repository : https://github.com/charlesw/tesseract-vs2012
It includes all needed extern library (because Tesseract need Leptonica, but Leptonica also need extern library to handle the different image format) and is also working great with vs 2013.

OK so now I see that allheaders.h is part of Leptonica. Still leaves me wondering why the Tesseract pre-built library requires that I have Leptonica available, I would have expected that to be built-in, I guess it isn't.

Related

dyld: Library not loaded; llbuild image not found

I used swift package init --type executable.
I have already tried setting xcode command line tools on path.
Following error occurs:
dyld: Library not loaded: #rpath/llbuild.framework/Versions/A/llbuild
Referenced from:
/Library/Developer/CommandLineTools/usr/bin/swift-package Reason:
image not found
I had to go into the preference for xcode and under Locations, set Command Line Tools to the correct version. It was blank when I first opened it.
I have faced the similar issue.
Basically the framework or library is not properly linked in the project.
If you are doing drag and drop of framework in xcode project then you will have to link it in embed frameworks as well.
(Basically you will have to drag and drop the framework in embed frameworks section)
See the below image.
There was this bad config in bash_profile /Library/Developer/CommandLineTools/usr/bin for path. Just removed it. Fixed the problem. which swift should result in /usr/bin/swift.
I had the same problem. I wanted to do some simple command line coding but didn't want to install the full Xcode bloat. I installed only the Command Line Tools on Mojave 10.14.6.
I could call swiftc to compile a file from the command line which actually did everything I needed it to. (I can't remember where I found a reference to being able to do this but basically you just call 'swiftc filename.swift' and you're good.)
But it irritated me that coding the "proper" way (i.e. the way most of the tutorials on the Internet want you to) failed. The "swift package init..." stuff kept barfing with the error posted in the question above here. So I got obsessed with fixing it.
So the error says that swift-package can't find a tool called llbuild.
I found that the llbuild executable did actually exist on my machine at:
/Library/Developer/CommandLineTools/usr/lib/swift/pm/llbuild/llbuild.framework/
The error, then, is because swift-package isn't looking for the tool in that directory.
(As a side note, earlier in my quest to fix this error, I tried adding some paths to my .bash_profile. None of those attempts worked. I can't recall now if I ever tried adding that full path and I'm too lazy to try now.)
I did some more digging. Someone somewhere on the Internet pointed out that the #rpath (referenced in the error message) variable set in apps can be discovered with otools. I used otools on swift-package and found its #rpath seemed to be pointing to /usr/lib. I noticed there was a .../usr/lib/... structure in the location of llbuild mentioned above. I imagined that swift-package was looking in /usr/lib instead of the directory where the file actually was. So I linked the directory where llbuild really is into the /usr/lib directory and voila! It worked.
Most people who need to do this will likely know how to do a symlink of a directory, but just to be thorough, this is what solved the problem for me all as root or use sudo if you want:
cd /usr/lib
ln -s /Library/Developer/CommandLineTools/usr/lib/swift/pm/llbuild/llbuild.framework/ .
Note that trailing period there. That's necessary.
As a side note, I had System Integrity Protection turned on, which forbids making symlinks in /usr/lib, so I had to reboot and turn SIP off from the recovery login(reboot and hold down Command-R) before I could do this.
Also, note that none of this necessarily cured the underlying problem I had of being able to actually build swift packages from the command line--I could now use "swift package init" but I couldn't use "swift run" or do anything else useful. I posted this only to give others some clues when they go digging since I looked a lot of places and didn't have much luck.

Running an OpenCV program with Eclipse

I'm trying to run a simple example of OpenCV on Eclipse [which was perfectly buit and installed before (using CMake and MinGw), even libraries and all includes are in place !].
When building, I'm getting no errors or warning, all seems good, but when I try to run, I get a message as if the project had no Binaries, even if all binaries are there. I even specified the path to the ".exe" (run->run conf-> new launch-> browse ...etc.).
You can notice on the images attached that the project is built and the binaries are generated.
Notice: when I run an example of a (Hellow world) on the console ... it displays the messag without errors.
I read a lot on Internet before posting here, but I found nothing that matches to this case.
Thank you so much,
Error Capture
Build Capture
Regards

How to package a PySide/Phonon app under Mac OSX?

I have a PySide/Phonon app (developed for and working flawlessly on Windows) that I need to "port" to Mac OSX - where I have no development experience whatsoever.
The app works as expected if I just run the Python file - the problems arise when I try to package it (which I need to do) with py2app.
If I leave the resulting .app as is, Phonon doesn't work, because it fails to load the required phonon_backend ; if I add the plugin path to qt.conf, as various sources suggest, Phonon seems to load (that is, I don't get the corresponding error message anymore), but I start getting the "so-and-so library is loaded twice, one will be used, which one is undefined" error, and the app crashes right away.
Finally, if I try to use the macdeploy_qt tool, I receive a message to the effect of "no external framework" and the results are functionally equivalent to what I get without using the tool, except there are a few more plugins in the relevant directory.
Any ideas/pointers/tutorials/etc? I'm using PySide1.1.1 for Qt4.7, by the way, and Python.org python binaries (otherwise py2app can't even start to build a standalone app, it seems).
I suggest you do it like in this tutorial.
Then you just have to add the following line somewhere at the top of your main module:
QApplication.setLibraryPaths([os.path.join(os.environ['_MEIPASS2'], 'qt4_plugins'), os.environ['_MEIPASS2'] ])
For PyInstaller >1.5 the following code should be used instead:
QApplication.setLibraryPaths([os.path.join(sys._MEIPASS, 'qt4_plugins'), sys._MEIPASS])

Overriding acm.program init() method; does Java have to be this hard?

Java problems
I am a student of Java. I managed to write about 15 Java programs so far and get them working on the PC. But I have not yet written a init() method like my latest assignment requires in order to initialize some instance variables. The compiler tells me that my init() method is attempting to override the final init() method in the acm.program. Isn’t that what an init() method is supposed to do? After exhausting all avenues on PC for the last week, I thought maybe it is an Eclipse problem on the PC. All the example code in the Java documentation shows little Mac windows. So I thought I would try moving my code to a Mac running Lion OS 10.7.2.
Switching to MAC environment.
The Mac claims to have Java installed but I think it’s just the run time environment, not a development environment. All I could find for applications is the Java VisualVM, which I assume is the virtual machine so there is no java development software. So… I downloaded Eclipse for Mac from Stanford’s website and got Eclipse IDE for Java Developers Version: Helios Service Release 2 and tried to run a simple program which included an import statement.
The import acm.program.*; statement is giving the compiler a problem: "acm cannot be resolved”. After researching this I think the problem is I have not downloaded the acm.jar archive and added that to my build path. Why this isn’t already done for me, as part of Eclipse I have no clue. I guess everything has to be difficult.
So I downloaded the acm.jar archive and it’s sitting in my download folder. I tried double clicking it and thankfully the mac won’t execute it. I tried dragging it into my source folder in Eclipse and then adding it to the build path. Once in the build path, Eclipse tells me the jar is missing. So I removed it from the build path and instead from inside Eclipse went to Properties/Java Build Path/Libraries/add External JARS… and navigated to my downloads folder where the acm.jar folder is to select the JAR. However, Eclipse seems to be looking for a .jar;.zip file, which there are none because my Mac helpfully already unzipped the folder. So I changed the open window to look for all files (.) and now I see individual .java files that are too numerous to add to the build path individually.
So back to the PC and download the acm.jar zip file and copy it over to the Mac in unzipped form and again add it to the build path as a zip file. This resolved the compiler error and my simple program executed on the Mac!
Next I will try my program with the init() method to see if that now works. Nope. Same problem on the Mac. This init method causes the following error: Multiple markers at this line
overrides acm.program.Program.init
Cannot override the final method from
Program
public void init() {
canvas = new HangmanCanvas();
add(canvas);
}
Does it have to be this hard or am I missing something?
Generally Macs have the whole JDK installed. Eclipse is nice, though.
This "acm" package isn't installed because it's not any kind of standard thing; this is like asking why your refrigerator doesn't come with asparagus already in it.
That last dialog was the right one; you need the original jar file. Try again, right-click and "Save As..." the link to save the file from your browser.
See 3. I find it particularly funny that anybody would use a Windows computer to make up for shortcomings of a Mac; in reality the Mac is infinitely more flexible and more powerful.
If you got a message that complains you're trying to override a final method, then you are indeed trying to do something wrong; final actually means "You're not allowed to override this." Perhaps you didn't fully understand the instructions for the assignment.
It gets better, I promise. Just be sure to use each of these annoyances as a learning experience.
There is no reasons why Java for the Mac would be any better than Java for the PC. The language and tools should work the same ... assuming that you are using the same versions of the language and similar versions of the tools.
Your problem with init is nothing to do with PCs versus Macs. So don't waste your time switching platforms to try to fix it. You need to figure out what the
On the face of is, the compiler / IDE is telling you the truth. Java won't let you override a final method. In fact the whole point of declaring a method to be final is to prevent overloading.
However, this does not make sense. According to the documentation I found here, the acm.program.Program.init() method is designed to be overridden. So why won't it let you?
I suspect that the cause of your problems is that you've downloaded or been given a copy of the JAR file that someone has messed around with. Someone has changes the method to be final (for some reason best kown to themselves), compiled it and put it up for people to download. Google is not always your friend ...
So, what I suggest you do is review all of the handouts and the files that were provided to find either the copy of the JAR that is provided, or the instructions on WHERE to download it from. Then replace the copy of the JAR you are currently using with the recommended one.
Why this isn’t already done for me, as part of Eclipse I have no clue. I guess everything has to be difficult.
How is Eclipse supposed to know what this "acm" stuff is? Which version you require? Where to download it from?

Is is possible to compile projects with "IDE-Managed Components" through the command line?

I've been trying to build some huge projects in BCB5 for some time now. I want to use the command line tools because it would cut build time by more than 50% (it already takes 4 hours in the IDE). Often, projects will build just fine in the IDE but fail miserably in the command line. I did some digging and discovered this nice little comment in a header file:
__published: // IDE-managed Components
Is this saying that the components that follow can only be built with the IDE open? Please tell me there is a way around this. BCB5 is starting to make me depressed.
Extra info:
Make.exe gives a pile of errors claiming ambiguity between the header file and an imported file. I''m pretty sure the header file is supposed to be referencing the imported file though, rather than comparing with it.
In the header file:
#include <ComCtrls.hpp>
ComCtrls.hpp has the variable TTreeNode.
Error from make:
[exec] Error E2015 .\TMain.h 876: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode'
__published: // IDE-managed Components Is this saying that the
components that follow can only be
built with the IDE open? Please tell
me there is a way around this. BCB5 is
starting to make me depressed.
No, this does not mean that you can only build the source in the IDE. It just means that this section is automatically populated by the IDE (the form designer)
While there are good third party solutions (as mentioned by the others) C++Builder 2007 and above made huge improvements in the build system. IDE build times are very similar to command line builds and the MSBuild integration now makes it possible to be sure that the same parameters are passed to the command line tools as are used by the IDE.
Have you tried installing the C++ Compiler Enhancements plugin, by Andreas Hausladen, which improves the compilation speed. I would also recommend installing the DelphiSpeedUp plugin.
I think you need to export the project as makefile, to compile from the command line, because C++Builder 5 project files are XML. Have a look at this article, from the C++Builder Developer's Journal.
If none of the above fails try the official C++Builder Forum.
I've more or less given up on the BCB5 command line tools. It appears that they are fundamentally broken.
I did, however, manage to find a nice open source tool, ProjectMaker, that uses the command line tools effectively. You can find it here: http://projectmaker.jomitech.com.
ProjectMaker fixes up a few of the problems with BPR2MAK, but it's not perfect. Most project build perfectly with ProjectMaker, some still require the IDE. It's not a perfect solution, but it does alright.