Trouble with OpenCV setup on Visual Studio - visual-studio

I'm trying to setup a simple OpenCV project using Microsoft Visual Studio 2008 in a 64-bit Windows 7 system. I don't have admin rights to the system and as such, I can't go for a fresh installation of OpenCV here.
However, I do have the bin, include and lib directories of OpenCV, compiled on a simillar platform.
I have launched a 'Visual C++ -> General -> Empty Project' and created a .cpp file which reads:
#include <opencv/cv.h>
#include <opencv/highgui.h>
void main()
{
cv::Mat frame = cv::imread("D:\\Images\\lena.bmp");
cv::imwrite("D:\\lena_bw.bmp",frame);
}
In the 'Property->Configuration Property->C/C++->General->Additional Include Directories', I have provided the link to the 'include' directory of OpenCV.
In the 'Property->Configuration Property->Linker->Input->Additional Dependencies', I have provided the path to opencv_core230.lib, opencv_highgui230.lib, opencv_imgproc230.lib etc.
The code builds fine, but when I run it, I get:
Unhandled exception at 0x734761e7 in OpenCVTest.exe: 0xC0000005: Access violation reading location 0xcccccccc.
No symbols are loaded for any call stack frame. The source code cannot be displayed.
I'm getting nowehere with my own ideas. I'm kinda new to the Visual Studio platform.
Please help me figure out a way to make this work.
++++++++++++++++++++++++++++++++++++++++++++++++
When running in 'release' mode, I get the following error during compilation:
1>HelloOpenCV.obj : error LNK2001: unresolved external symbol "public: __thiscall cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray#cv##QAE#ABVMat#1##Z)
1>HelloOpenCV.obj : error LNK2001: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree#cv##YAXPAX#Z)
1>HelloOpenCV.obj : error LNK2001: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread#cv##YA?AVMat#1#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z)
1>HelloOpenCV.obj : error LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ)
1>HelloOpenCV.obj : error LNK2001: unresolved external symbol "bool __cdecl cv::imwrite(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &,class std::vector<int,class std::allocator<int> > const &)" (?imwrite#cv##YA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABV_InputArray#1#ABV?$vector#HV?$allocator#H#std###3##Z)

I am giving you detailed setup instructions that don't need Admin-Rights. Avoid doing things in C drive.
1) Launch VS2010 and select “New project…”.
2) Select “Empty Project”, enter Name, select a location to place project. Press “OK”.
3) Now we have created a project from scratch. It is time to link the libraries and make our project use OpenCV.
Switch to Property manager by clicking on the tab below. If you can’t find the tab, you can access Property manager from menu View.
4) The default properties are for 32-bit systems (note the Win32 suffixes), because you are using 64-bit system, from now on I am going to describe the configuration for 64-bit systems.
If yours is x64 already or you want to work with 32 bit development, leave this step.
From the “Build” menu, select “Configuration Manager”. Under “Active solution platform” Win32 should be selected by default. Click on it and select “New…”.
Select “x64″ as the new platform and select Win32 to copy settings from. Make sure that “Create new project platforms” is checked.
5) INCLUDE
Under “Common Properties” -> “C/C++” -> “General”, edit “Additional Include Directories” and add browse this path to add “..\OpenCV\build\include”. It is important that you select the “include” folder under “build” folder, not any other “include” folder.
6) LINK LIB
Under “Common Properties” -> “Linker” -> “General”, edit “Additional Library Directories” and add “..\OpenCV\build\x64\vc9\lib”. Here “x64″ stands for 64-bit systems, if you are using 32-bit change it to x86. “vc9″ stands for Visual C++ 2008, leave it as it is assuming you are using VS2008, use vc10 for Visual Studio 2010.
7) LIB INPUT
Under “Common Properties” -> “Linker” -> “Input”, edit “Additional Dependencies” and add the following lib files:
[For Debug]
opencv_core242d.lib
opencv_highgui242d.lib
opencv_imgproc242d.lib
[For Release]
opencv_core242.lib
opencv_highgui242.lib
opencv_imgproc242.lib
Here, naming is as: LibName_Version_Debug.lib ie opencv_imgproc242d.lib is opencv_imgproc is library name, 242 is opencv version and d at last indicate debugging library, if you are not using debug mode, don't use library with "d".
I have added very basic libs, you may need to add more according to your code.
8) The steps are the same for “Release” configuration except the linked library filenames. You just need to get rid of the “d” letters before the dot.
Your code should build without any complaints. But while running, you should get an error about a missing dll.
9) DLL
Locate exe/output in your project folder, it's name should be release/debug according to mode of your development and it should have an exe file which is output. Copy the dll files (ends with letter “d” if using debug mode) from “..\OpenCV\build\x64\vc9\bin” (for x64) OR “..\OpenCV\build\x64\vc9\bin” (for 32 bit) and to that folder .

In opencv300 you need opencv_imgcodecs300.lib for imread()/imwrite().

Related

FASM dll to import from VS

I'm trying to use an import library from a FASM-created DLL to visual studio, no matter what I try I get the unresolved external message.
; proc to export has name exp2
exp2:
....
;
section '.edata' export readable
export 'fasmdll.dll',exp2,'exp2'
The DEF:
LIBRARY FASMDLL
EXPORTS
exp2#4
Then
lib /def:fasmdll.def /out:fasmdll.lib /machine:x86
Then in C++
#pragma comment(lib,"fasmdll.lib")
extern "C" __declspec(dllimport) void __stdcall exp2(DWORD);
The error
dllmain.obj : error LNK2019: unresolved external symbol __imp__exp2#4 referenced in function _exp1#4
If I use __declspec(dllexport) instead I also get
dllmain.obj : error LNK2019: unresolved external symbol _exp2#4
No matter the combination, I can't make it working. Why? In standard Windows libs, the import library wors correctly... I suspect a problem with the DEF file?

Could not find a file named "pubspec.yaml" in "/home/vagrant/.pub-cache/hosted/pub.dartlang.org/protobuf-0.5.3"

I'm trying to build a Dart project from inside a Vagrant VM. The project was actually created from my host machine using IntelliJ, but I would like that whoever uses the Vagrant VM is of course able to build the project (and in general do everything it's possible to do with a Dart project using the Dart tools), which is the main reason why I set up a Vagrant VM to develop.
So (as usual in a Vagrant environment) in my guest machine, the path /vagrant contains files which are the same (and synchronized) with the files where the Vagrantfile is located on my host machine.
My Dart project was created in the host machine under the folder dart-angular-client, which is at the same level as the Vagrantfile. I'm able to build the project from my host machine from inside dart-angular-client and from IntelliJ, but the idea was to be able to build the project from inside the Vagrant machine.
So, when I try to type pub build under /vagrant/dart-angular-client of my guest Vagrant VM, I obtain the following error
Could not find a file named "pubspec.yaml" in "/home/vagrant/.pub-cache/hosted/pub.dartlang.org/protobuf-0.5.3"
where /home/vagrant/ is basically the home directory of the guest Vagrant VM. I tried to install manually and globally a Dart package from inside the guest machine, and the package was indeed installed under /home/vagrant/.pub-cache, as one would expect, since (as far as I know) Dart packages that are installed/activated globally are put under that folder (even in my host machine).
How can I build my project from inside the Vagrant VM?
Edit
After doing pub get (as suggested by Günter Zöchbauer), when I run the command pub build now I obtain
vagrant#vagrant-ubuntu-trusty-64:/vagrant/dart-angular-client$ pub build
Loading source assets...
Loading angular2/transform/codegen and dart_to_js_script_rewriter transformers...
Loading angular2 transformers... (6.5s)Dumping native stack trace for thread c36
[0x000000000091a708] dart::WeakTable::SetValue(dart::RawObject*, long)
[0x000000000091a708] dart::WeakTable::SetValue(dart::RawObject*, long)
[0x00000000008c3e20] dart::Scavenger::ProcessWeakReferences()
[0x00000000008c464f] dart::Scavenger::Scavenge(bool)
[0x00000000006f0298] dart::Heap::CollectNewSpaceGarbage(dart::Thread*, dart::Heap::ApiCallbacks, dart::Heap::GCReason)
[0x00000000006f0cc8] dart::Heap::AllocateNew(long)
[0x000000000078baf8] dart::Object::Allocate(long, long, dart::Heap::Space)
[0x00000000007aadc3] dart::TypedData::New(long, long, dart::Heap::Space)
[0x0000000000aeaf69] dart::BootstrapNatives::DN_TypedData_Uint8Array_new(_Dart_NativeArguments*)
[0x00007f0cb907e579] Unknown symbol
[0x00007f0cb737e97d] Unknown symbol
[0x00007f0cab554524] Unknown symbol
[0x00007f0cab5534ee] Unknown symbol
[0x00007f0cab552588] Unknown symbol
[0x00007f0cab551e6d] Unknown symbol
[0x00007f0cb601dfba] Unknown symbol
[0x00007f0cab551a53] Unknown symbol
[0x00007f0cab54f4e9] Unknown symbol
[0x00007f0cab50fde3] Unknown symbol
[0x00007f0caeb01d4d] Unknown symbol
[0x00007f0cb6c78cb0] Unknown symbol
[0x00007f0cb52c198f] Unknown symbol
[0x00007f0cb6c7a97e] Unknown symbol
[0x00007f0cab56cf92] Unknown symbol
[0x00007f0cab58165a] Unknown symbol
[0x00007f0caeaee66d] Unknown symbol
[0x00007f0cab581ff7] Unknown symbol
[0x00007f0cab51bba1] Unknown symbol
[0x00007f0caeb01d4d] Unknown symbol
[0x00007f0cb6c78cb0] Unknown symbol
[0x00007f0cb52c198f] Unknown symbol
[0x00007f0cb6c7a97e] Unknown symbol
[0x00007f0cab56cf92] Unknown symbol
[0x00007f0cab58165a] Unknown symbol
[0x00007f0caeaee66d] Unknown symbol
[0x00007f0cab581ff7] Unknown symbol
[0x00007f0cab52c77b] Unknown symbol
[0x00007f0caeb01d4d] Unknown symbol
[0x00007f0cb6c78cb0] Unknown symbol
[0x00007f0cb52c198f] Unknown symbol
[0x00007f0cb6c7a97e] Unknown symbol
[0x00007f0cab56cf92] Unknown symbol
[0x00007f0cab58165a] Unknown symbol
[0x00007f0caeaee66d] Unknown symbol
[0x00007f0cab5389f0] Unknown symbol
[0x00007f0cb6c80a6d] Unknown symbol
[0x00007f0cb6c8048c] Unknown symbol
[0x00007f0cb30900bd] Unknown symbol
[0x00007f0caeaebbe4] Unknown symbol
[0x00007f0caeafbd71] Unknown symbol
[0x00007f0caeafe6b8] Unknown symbol
[0x00007f0cb6c80a6d] Unknown symbol
[0x00007f0cb6c8048c] Unknown symbol
[0x00007f0cb30900bd] Unknown symbol
[0x00007f0cb6c915c2] Unknown symbol
[0x00007f0cb6c80ae9] Unknown symbol
[0x00007f0cb6c8048c] Unknown symbol
[0x00007f0cb30900bd] Unknown symbol
[0x00007f0cb6c915c2] Unknown symbol
[0x00007f0cab582b12] Unknown symbol
[0x00007f0cb651de80] Unknown symbol
[0x00007f0caeaf2520] Unknown symbol
[0x00007f0cab58756e] Unknown symbol
[0x00007f0cb907e836] Unknown symbol
[0x000000000064e2f0] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&)
[0x00000000006521bd] dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&)
[0x000000000074f4e8] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
[0x000000000077124a] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
[0x00000000007715e1] dart::MessageHandlerTask::Run()
-- End of DumpStackTrace
which seems a little bit more severe. I'm not sure what caused this problem (pub, Vagrant, etc), but that seems C++ code. This looks like some stack corruption... This happened after having built the project from the host machine, but (as far as I've understood) the build (if it exists) is replaced whenever we try to rebuild the Dart project.
Edit 2
I retried to reload and provision the virtual machine again, and then I ssh inside it, and I tried to build the Dart project again, and this was similarly the result:
Loading source assets...
Loading angular2/transform/codegen and dart_to_js_script_rewriter transformers...
Loading angular2 transformers... (7.3s)runtime/vm/scavenger.cc: 399: error: Out of memory.
Dumping native stack trace for thread 9f9
(7.4s) [0x000000000087b7ee] dart::Profiler::DumpStackTrace()
[0x000000000087b7ee] dart::Profiler::DumpStackTrace()
[0x00000000005c8f5d] dart::DynamicAssertionHelper::Fail(char const*, ...)
[0x00000000008c353d] dart::Scavenger::Prologue(dart::Isolate*, bool)
[0x00000000008c43e6] dart::Scavenger::Scavenge(bool)
[0x00000000006f0298] dart::Heap::CollectNewSpaceGarbage(dart::Thread*, dart::Heap::ApiCallbacks, dart::Heap::GCReason)
[0x00000000006f0cc8] dart::Heap::AllocateNew(long)
[0x000000000078baf8] dart::Object::Allocate(long, long, dart::Heap::Space)
[0x000000000078bca8] Unknown symbol
[0x00000000006520cf] dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&)
[0x000000000074f4e8] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
[0x000000000077124a] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
[0x00000000007715e1] dart::MessageHandlerTask::Run()
-- End of DumpStackTrace
Aborted (core dumped)
Edit 3
Not even having destroyed and vagrant up the VM, it seems to have changed something, since I obtained:
vagrant#vagrant-ubuntu-trusty-64:/vagrant/dart-angular-client$ pub build
Loading source assets...
Loading angular2/transform/codegen and dart_to_js_script_rewriter transformers...
Loading angular2 transformers... (11.8s)runtime/vm/scavenger.cc: 399: error: Out of memory.
Dumping native stack trace for thread 2646
[0x000000000087b7ee] dart::Profiler::DumpStackTrace()
(17.0s) [0x000000000087b7ee] dart::Profiler::DumpStackTrace()
[0x00000000005c8f5d] dart::DynamicAssertionHelper::Fail(char const*, ...)
[0x00000000008c353d] dart::Scavenger::Prologue(dart::Isolate*, bool)
[0x00000000008c43e6] dart::Scavenger::Scavenge(bool)
[0x00000000006f0298] dart::Heap::CollectNewSpaceGarbage(dart::Thread*, dart::Heap::ApiCallbacks, dart::Heap::GCReason)
[0x00000000006f09b9] dart::Heap::AllocateOld(long, dart::HeapPage::PageType)
(17.6s) [0x000000000078ba67] dart::Object::Allocate(long, long, dart::Heap::Space)
[0x000000000078bca8] Unknown symbol
[0x00000000007d2c2b] dart::HashMap<dart::UnorderedHashTable<dart::CompressedTokenTraits, 1l> >::InsertOrGetValue(dart::Object const&, dart::Object const&) const
[0x00000000007d31e8] dart::CompressedTokenStreamData::AddToken(dart::Scanner::TokenDescriptor const&)
Killed
ensure pub get is run before pub build
ensure the virtual machine has enough RAM (see also How do I increase the RAM and set up host-only networking in Vagrant?)

Visual Studio 2015 Native Unit Test Can't Find 3rd Party .DLL

I'm using Visual Studio 2015. I created a .dll and would like to write a Unit Test. I Created a New Project using the Native Unit Test Project found in the
File | New | Project...
Visual C++ | Test | Native Unit Test Project
All works until I run it. The code requires using the SQLite .dll (sqlite3.dll). When I run the test, I get the error dialogbox:
The program can't start because sqlite3.dll is missing from your computer. Try reinstalling the program to fix this problem.
I have the .dll so I suspect the message saying it is "missing" really means "unable to find".
I've attempted a lot of things to fix this, including editing the following Property Pages values:
Configuration Properties:
Debugging | Environment
VC++ Directories | Executable Directories
These changes to my project make no difference. Does anyone know how to get VS2015 testing to find 3rd party .dlls?
Thx.
Update:
Tried setting Configuration Properties | Debugging | Environment to:
PATH=%PATH%;$(SolutionDir)sqlite;$(LocalDebuggerEnvironment)
Then thought that I might need to reboot the Visual Studio environment for the PATH to be updated. Didn't help. It appears that if I let Visual Studio sit for a while, I get the following message:
An unhandled win32 exception occurred in StandardCollector.Service.exe [6324].
I don't know if the exception is related or not. I'm using VS2015 update #2 if that matters.
Update:
I got a stack dump from the crash...
ntdll.dll!string "Enabling heap debug options\n"() Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!StandardCollectorService::~StandardCollectorService(void) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!ATL::CComObjectCached::vector deleting destructor'(unsigned int) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!ATL::CComObjectCached<class StandardCollectorService>::Release(void) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!ATL::CComObjectCached<class ATL::CComClassFactorySingleton<class StandardCollectorService> >::vector deleting destructor'(unsigned int) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!ATL::CComObjectCached >::Release(void) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!ATL::CAtlComModule::Term(void) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!_guard_dispatch_icall_nop() Unknown
ucrtbase.dll!(void)() Unknown
ucrtbase.dll!__crt_seh_guarded_call::operator(),class &,class >(class &&,class &,class &&) Unknown
ucrtbase.dll!_execute_onexit_table() Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!operator new(unsigned __int64,struct std::nothrow_t const &) Unknown
DiagnosticsHub.StandardCollector.Runtime.dll!operator new(unsigned __int64,struct std::nothrow_t const &) Unknown
ntdll.dll!LdrShutdownProcess() Unknown
ntdll.dll!RtlExitUserProcess() Unknown
ucrtbase.dll!exit_or_terminate_process() Unknown
ucrtbase.dll!common_exit() Unknown
StandardCollector.Service.exe!CStandardCollectorService::OnStart(void) Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown

Solving Heartbleed issue on Tomcat with APR and OpenSSL. Compilation errors

I am running TeamCity on a Windows machine that uses Tomcat as a web server and uses Apache Portable Runtime (APR) and OpenSSL for SSL.
I have not managed to upgrade the version of OpenSSL to 1.0.1g, and I think the reason is because the Tomcat native library binary (tcnative-1.dll) (http://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.1.29/binaries/tomcat-native-1.1.29-win32-bin.zip) contains both APR and version 1.0.1e of OpenSSL, and I can't find a new binary with 1.0.1.g.
I've tried to compile the Tomcat native library myself, but I get compilation errors when trying to compile the "libapr" project.
The compilation errors I get are:
Error 4 error LNK2019: unresolved external symbol __InterlockedIncrement referenced in function _apr_atomic_inc32#4 C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\apr_atomic.obj libapr
Error 5 error LNK2019: unresolved external symbol __InterlockedExchangeAdd referenced in function _apr_atomic_add32#8 C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\apr_atomic.obj libapr
Error 6 error LNK2019: unresolved external symbol __InterlockedExchange referenced in function _apr_atomic_set32#8 C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\apr_atomic.obj libapr
Error 7 error LNK2019: unresolved external symbol __InterlockedDecrement referenced in function _apr_atomic_dec32#4 C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\apr_atomic.obj libapr
Error 8 error LNK2019: unresolved external symbol __InterlockedCompareExchange referenced in function _apr_atomic_cas32#12 C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\apr_atomic.obj libapr
Error 9 error LNK1120: 5 unresolved externals C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\apr\Debug\libapr-1.dll 1 1 libapr
I am trying to compile in Visual Studio Ultimate 2013 (perhaps too new a version of Visual Studio?).
How do I fix this problem?
Has anyone successfully built Tomcat native library with OpenSSL 1.0.1.g?
Updates
I've set the "Platform Toolset" to v100 (as advised here https://groups.google.com/forum/#!topic/UniMRCP/Iybpn51UYnI) and the previous compilation errors went away, but now I get new ones:
Error 9 error C1083: Cannot open include file: 'apr.h': No such file or directory C:\Users\heartbleed\tomcat-native-1.1.29-win32-src\jni\native\include\tcn.h 26 1 tcnative
More updates
I did manage to solve the compilation problems and build a tcnative-1.dll with OpenSSL 1.0.1g, and my TeamCity is up and running with the Heartbleed problem fixed! I am busy now. But please ask if you want a detailed description of the procedure.
This is what I did.
I started off with Visual Studio 2013.
Install Visual C++ 2010 Express (http://go.microsoft.com/?linkid=9709949).
Install OpenSSL (http://slproweb.com/products/Win32OpenSSL.html), I chose "Win32 OpenSSL v1.0.1g".
Download Tomcat Native (http://apache.mirrors.spacedump.net//tomcat/tomcat-connectors/native/1.1.29/source/tomcat-native-1.1.29-win32-src.zip)
Extract it somewhere.
Download APR source code (http://apache.mirrors.spacedump.net//apr/apr-1.5.0-win32-src.zip)
Extract it and move it into the directory "tomcat-native-1.1.29-win32-src/jni".
Rename it from "apr-1.5.0" directory to "apr", so that you have a "apr" folder in the "jni" folder.
Open up "tomcat-native-1.1.29-win32-src/jni/native/libtcnative.dsw" in Visual Studio 2013. It will make some conversions.
Change from "Debug" to "Release".
For projects "apr" and "tcnative".
right click on them, go into Properties -> Configuration Properties.
Set "Platform Toolset" to "v100".
Right click "tcnative" click Properties -> Configuration Properties -> C/C++ -> Additional Include Directories -> Edit
Change "./srclib/apr/include" to "../apr/include"
Change "./srclib/apr/include/arch/win32" to "../apr/include/arch/win32"
Add "C:\OpenSSL-Win32\include" (or wherever you installed OpenSSL).
Go to Configuration Properties -> Linker -> Input -> Additional Dependencies -> Edit
Change "libeay32.lib" to "libeay32MT.lib"
Change "ssleay32.lib" to "ssleay32MT.lib"
Go to Configuration Properties -> Linker -> Additional Library Directories -> Edit.
Add "C:\OpenSSL-Win32\lib\VC\static" (or wherever you installed OpenSSL).
Right click tcnative and click on Build.
After the build completes you will find "tcnative-1.dll"
inside "tomcat-native-1.1.29-win32-src\jni\native\LibR"
At present, the tcnative team has finished working on the next version which has the Heartbleed fix in. So one can get this version from Latest tcnative with heartbleed fix.
This version will soon be released officially.
Apache Tomcat 7.0.53 (latest release) is vulnerable to Heartbleed, if you are using Tomcat Native (check if tcnative-1.dll is in bin folder. That's the case if you download the Tomcat Windows binary).
You can find the binaries for Windows (x86 and x64) at http://people.apache.org/~mturk/native/1.1.30/binaries/.
I hope they will release it officially soon at http://tomcat.apache.org/download-native.cgi.
Just download the DLL file, put it into Tomcat/bin folder, restart Tomcat and you're done.
To verify the fix, check file catalina.log:
Apr 11, 2014 8:39:27 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1g 7 Apr 2014)
The Heartbleed fix has been in OpenSSL since OpenSSL 1.0.1f.
For now here's the dll that I built:
https://docs.google.com/file/d/0B4GOp0amHg-0SU5GXzZuM2lJT3c/edit
I believe Tomcat is not vulnerable to Heartbleed out of the box.
Yes, the APR library is linked and SSLEngine is on.
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
But if you look at the server.xml config file of a default Tomcat deployment, its SSL connector uses JSSE, not the APR library.
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
So it shouldn't be explotable via Heartbleed. Unless you manually changed the SSL connector to use APR, I think it's safe to say, you are not vulnerable.

Link Error 2001 when linking to User32.dll

I'm trying to link an object file that uses two methods declared in winuser.h and defined in User32.dll: GetMonitorInfo and WindowFromMonitor. The source compiles to an object file just fine, but when I try to link, I get the following error output:
D3dCtx.obj : error LNK2001: unresolved external symbol xGetMonitorInfo
D3dCtx.obj : error LNK2001: unresolved external symbol xMonitorFromWindow
The thing is, I don't call "xGetMonitorInfo" or "xMonitorFromWindow". Running grep on all source files shows that only "GetMonitorInfo" and "WindowFromMonitor" are being called. I'm properly including windows.h, which includes winuser.h. I'm also properly setting my LIBPATH in the linker options, which is confirmed by verbose link output.
The following also appears in my verbose link output:
Found __imp_GetMonitorInfoA
Referenced in nafxcw.lib(afxribboncategory.obj)
Referenced in nafxcw.lib(afxtooltipctrl.obj)
Referenced in nafxcw.lib(afxribbonkeytip.obj)
Referenced in nafxcw.lib(afxfullscreenimpl.obj)
Referenced in nafxcw.lib(afxframeimpl.obj)
Referenced in nafxcw.lib(afxglobalutils.obj)
Referenced in nafxcw.lib(afxdropdowntoolbar.obj)
Referenced in nafxcw.lib(wincore.obj)
Referenced in nafxcw.lib(afxglobals.obj)
Referenced in nafxcw.lib(afxpopupmenu.obj)
Referenced in nafxcw.lib(afxpropertygridtooltipctrl.obj)
Loaded User32.lib(USER32.dll)
Found __imp_MonitorFromWindow
Referenced in nafxcw.lib(wincore.obj)
Loaded User32.lib(USER32.dll)
Furthermore, GetMonitorInfo is defined in winuser.h as:
WINUSERAPI
BOOL
WINAPI
GetMonitorInfoA(
__in HMONITOR hMonitor,
__inout LPMONITORINFO lpmi);
WINUSERAPI
BOOL
WINAPI
GetMonitorInfoW(
__in HMONITOR hMonitor,
__inout LPMONITORINFO lpmi);
#ifdef UNICODE
#define GetMonitorInfo GetMonitorInfoW
#else
#define GetMonitorInfo GetMonitorInfoA
#endif // !UNICODE
When I change all reference to "GetMonitorInfo" to "GetMonitorInfoA", I only get
D3dCtx.obj : error LNK2001: unresolved external symbol xMonitorFromWindow
as my linker error output. Unfortunately, MonitorFromWindow doesn't seem to have multiple versions available.
I should note that I am using the 64bit versions of the libraries, link, and cl.
What's going on here, and how can I successfully link my program?
I don't know whether you were able to find solution to this or not But I had the same problem and the reason this was happening was that I had a file included named multimon.h
Looks like in case of 64 bit compilation, due to Macro definitions, the definitions of these functions are coming from two sources and probably one from multimon.h is overriding and is wrong.
I solved it by just commenting out this include and it has started to link fine.
//#include <multimon.h>

Resources