Windows build

1,313 views
Skip to first unread message

Steven Eaton

unread,
Aug 23, 2015, 4:15:03 AM8/23/15
to OpenALPR
So peter's stuff is a huge step in the right direction, but broke and not working for anyone that I have talked to lately.   I am wondering if the next best option is to cross-compile on Linux, maybe that would be an option.
thoughts ?

Jerry Jones

unread,
Sep 1, 2015, 6:33:27 PM9/1/15
to OpenALPR
Do you know anyone that has compiled it successfully?
I see lots of folks trying, but no one that has succeeded.
Is there a better how to file on compiling it?


On Sunday, August 23, 2015 at 1:15:03 AM UTC-7, Steven Eaton wrote:

Paweł Kaczmarczyk

unread,
Sep 21, 2015, 3:27:44 AM9/21/15
to OpenALPR
Hi.
There are people who managed it and You can download the compiled version 2.0.1 using links from this thread:
https://groups.google.com/forum/#!topic/openalpr/2x9r5_n6KvY
I'm using this and it works fine, You can also try to compile version 2.1.0 yourself following tips from this thread:
https://groups.google.com/forum/#!topic/openalpr/GpqPjsbpUWg

Neil Ellis

unread,
Oct 29, 2015, 12:20:12 PM10/29/15
to OpenALPR
Just wanted to say a big thanks to Peter's windows scripts and other updates that I have just tried again (after leaving it a couple of months) ...they now worked for me first time to produce openalpr v2.2.0. Back to my project.....

Neil

Paweł Kaczmarczyk

unread,
Feb 15, 2017, 3:40:38 AM2/15/17
to OpenALPR
Hello.
I just returned to to my project and figured i need to compile the library. After a lot of struggles with the duild scripts i managed to get to the last part where openAlpr is compiled. And i keep getting the link error about missing ws2_32.lib file. I'm looking through the project files where it is listed and it is always without a path. So i just don't know where to put this file so the script can find it. Any suggestions would be appreciated.

Paweł Kaczmarczyk

unread,
Feb 15, 2017, 6:23:45 AM2/15/17
to OpenALPR
Ok, i hardcoded the path to that lib inside the build script but now the same file is missing when building openalpr-net insode the openalpr-net.vcxproj file. When i copied that file to the same location where openalpr-net.vcxproj file is i get 104 linker 2005 errors. Now i'm just fed up with this. Obviously i'm doing this wrong. Anyone?

Joel Vargas

unread,
Feb 16, 2017, 6:24:19 AM2/16/17
to OpenALPR
Hi everyone.
Last sunday after LONG hours of guessing I did it (Release, v140, CUDA=false) and man, it was a very hard work. Almost cried when done, lol.
 
Peter's scripts are still very nice tools, but you need to make some changes and follow new instructions because many things changed in libraries since the last release.

This is what I've done (If you have already compiled Tesseract successfuly, ignore #5):
1 - Instructions to clone from GitHub are wrong, so I did as described here: https://github.com/peters/openalpr-windows/issues/6


3 - Also, inside build.ps1, at the "Copy-Build-Result-To" function, change openalpr.conf.in to openalpr.conf.user and the line should be like this:
  
Copy-Item $OpenALPRDir\config\openalpr.conf.user -Force $DestinationDir\openalpr.conf | Out-Null

4 - In alpr_c.h from .\src\bindings\c, put this at the beggining of EVERY function declaration: OPENALPRC_DLL_EXPORT OPENALPR*
   Otherwise, a lot of annoying redefinition erros will come to life.

5 - As there is a dependencies hierarchy {openalpr (needs)-> Tesseract (needs)-> a bunch of libs inside tesseract-ocr\dependencies} you have to compile ALL of them in right-to-left order and play a lot with copy-paste after every compilation. E.g.: Compile zlib, then copy-paste it into Tesseract project, an so on. I believe there is a way to edit build.ps1 to automate this, but I was running out of patience and I made it all manually.

I'm not sure if I'm missing something right now, but in case you guys have any problem let me know and I'll try to help.

Just remember you'll need tons of patience, but the consumed time worth the prize because at the end, you'll have the perfect scenario to compile your own version. 

Good luck!!
Joel.

Joel Vargas

unread,
Feb 16, 2017, 6:53:40 AM2/16/17
to OpenALPR
One more thing!

The new version of C# binding (2.4.0) needs a libopenalprc.dll wich you won't find with that name after compiling all. 

What I did was: make a copy of the openalprc.dll from the C binding, then rename it to libopenalprc.dll and paste it into my C# project. 

It works like a charm.

Paweł Kaczmarczyk

unread,
Feb 17, 2017, 5:27:34 AM2/17/17
to OpenALPR
Thanks Joel, but it still doesn't work. 
I still get the missing ws2_32.lib, it goes away when i add the path to it in cmakelists.txt.
Then, when compiling alpr it says it can't find video.lib, but it is where it is supposed to be. 

Also this point:

4 - In alpr_c.h from .\src\bindings\c, put this at the beggining of EVERY function declaration: OPENALPRC_DLL_EXPORT OPENALPR*
   Otherwise, a lot of annoying redefinition erros will come to life.

How are those function definitions supposed to look like? Can you give one example? Am i supposed to replace the retutn type with OPENALPRC_DLL_EXPORT OPENALPR* or paste it before return type? Either way it doesn't work.

Joel Vargas

unread,
Feb 17, 2017, 2:56:38 PM2/17/17
to OpenALPR
Well, I can't figure out why is that lib link error arising because I never had it, but it seems to be something with C++. Wich Visual Studio version are you using? Did you already installed the vcredist packages? Probably you'll want to start a new clean build in order to get rid of any old mess.

And about this:


How are those function definitions supposed to look like? Can you give one example? Am i supposed to replace the retutn type with OPENALPRC_DLL_EXPORT OPENALPR* or paste it before return type? Either way it doesn't work.

I made a typing mistake. The part to be added is only OPENALPRC_DLL_EXPORT  and you need to paste it before the return type (OPENALPR*). This is because the implementation methods at alpr_c.cpp are already declared that way, and if they don't have the same return type but still with the same name, the compiler takes that as a redefinition error.

Here you have an example:
The line OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir);

Should be like this: OPENALPRC_DLL_EXPORT OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir);

Sorry for the mistake.

Paweł Kaczmarczyk

unread,
Feb 18, 2017, 11:42:15 AM2/18/17
to OpenALPR
Thanks again Joel. I managed to compile everything on another computer using release x64 v140, it failed however when i tried again with v120, but that's ok, if v140 works then i'll use that. Now i'll have to modify the library a little bit to get some more data out, which will be another huge dose of pain. :) 

Joel Vargas

unread,
Feb 18, 2017, 6:57:26 PM2/18/17
to OpenALPR
Glad to know you made it, Pawel!!. 

Now you got it. Good luck!!

Willie

unread,
May 18, 2017, 2:48:40 AM5/18/17
to OpenALPR
Hi Joel, thanks a lot for the details. 
Regarding the step 5: "... E.g.: Compile zlib, then copy-paste it into Tesseract project, an so on."
I have 2 questions:
1). Do I need to compile for x64 or Win32?
2). I have compiled the zlib project (from ..\..\openalpr\windows\tesseract-ocr\dependencies\zlib) using Visual Studio 2013 x64 Release build and I have zlib128-static-mtdll.lib now. Where should I copy and paste this .lib file into?
Currently under my ..\..\openalpr\windows\tesseract-ocr\ there are only 3 folders: 
* dependencies
* include
* source

Many thanks,
Willie

Joel Vargas

unread,
May 22, 2017, 9:40:36 AM5/22/17
to OpenALPR
Hi Willie.

Answering your questions:
R1) It's up to to your application's platform target. You can compile for both of them, but you need to compile ALL for the same platform.

R2) If I'm not wrong, you should copy them here: openalpr\windows\tesseract-ocr\src\vs2010\build\lib\Win32
Note that in my case, I compiled for x86 and that's why the end of the path is Win32. I guess it will be x64 if the libs are compiled for that platform.

It is not that complicated once you have made it with the powershell script. Try to understand the codes, the dependencies. Look at the VS Solution Explorer and find what's missing if something is going wrong.
Reply all
Reply to author
Forward
0 new messages