usnistgov / NFIQ2

Optical live-scan and ink fingerprint image quality assessment tool
https://www.nist.gov/services-resources/software/development-nfiq-20
Other
129 stars 57 forks source link

Failed to build your example in VS 2017. #367

Closed indianscorpion closed 10 months ago

indianscorpion commented 10 months ago

Describe the issue Failed to build your example in VS 2017. It gave below link error: nfiq2.lib(nfiq2_algorithm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in example_api.obj

To reproduce Steps to reproduce the issue:

  1. Run command ld ...
  2. Look at linker output
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

OS information

Library information

NFIQ 2 version information Hint: run nfiq2 and copy the entire block of text under Version Info

Code sample Is there a reliable code sample you can include?

#include <nfiq2.hpp>
...

Additional context Add any other context about the problem here.

indianscorpion commented 10 months ago

I am trying to compile the example using the installation package.

gfiumara commented 10 months ago

Make sure you're build the Release configuration (cmake --build . --config Release), since what is distributed is a Release build, not Debug (which is CMake's default). Also, I'm seeing that the OpenCV library might be missing from the .msi installers, so are you sure you're using the release package and not your own compilation?

indianscorpion commented 10 months ago

Yes. now I am trying to build your nfiq2. but it failed on libbiomeval. complaining 2>CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message): 2> Could NOT find BERKELEYDB (missing: BERKELEYDB_LIBRARY 2> BERKELEYDB_INCLUDE_DIR)

does it depend on Berkeley DB? should I install it?

indianscorpion commented 10 months ago

also when I build your example using x64 with released nfiq2. it complains 1>nfiq2.lib(OFFeature.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(RVUPHistogramFeature.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4 1>nfiq2.lib(FeatureFunctions.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(QualityMapFeatures.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(LCSFeature.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4 1>nfiq2.lib(MuFeature.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(OCLHistogramFeature.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(FDAFeature.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4 1>nfiq2.lib(FingerJetFXFeature.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(FJFXMinutiaeQualityFeatures.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(ImgProcROIFeature.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_algorithm_impl.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_qualityfeatures_impl.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_exception.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_data.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_algorithm.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_modelinfo.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 1>nfiq2.lib(nfiq2_fingerprintimagedata.obj) : error LNK2001: unresolved external symbol GSHandlerCheck_EH4 any comments?

gfiumara commented 10 months ago

If you want to compile the library, you should follow the instructions from the README. On Windows, you'll need vcpkg to install dependencies needed by libbiomeval if you want to build the command line executable (not required for the library).

I'm confused where you need help now. On my Windows system, if I build the library and then point the NFIQ2_INSTALL_DIR in the examples directory to that location, everything builds fine. I am unable to find the OpenCV library when I use the .msi installer's copy because OpenCV appears to be missing (we'll get that packaging error fixed).

indianscorpion commented 10 months ago

I gave up building the NFIQ2 myself. Now I am using it. I realized that it needs the following libraries: opencv_world480.lib;FRFXLL_static.lib;nfir.lib;Nfiq2Api.lib;nfiq2.lib;

question, where can I find the WIN32 version of opencv_world480.lib? (the download website doesn't have it).

indianscorpion commented 10 months ago

my program was written in C language, so I am writing a wrapper library nfiq2_wrapper library in order for the c code to use your c++ library. also I am encountering lots of link error, like that one I mentioned.

nfiq2.lib(nfiq2_exception.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in NfiqLib2.lib(nfiq2_api.obj)

I changed the RuntimeLibrary to Multi-threaded (/MT). I am looking for building a static library wrapper, not the way like Nfiq2Api.dll.

indianscorpion commented 10 months ago

will your Nfiq2Api.dll load opencv_world480.dll automatically?

indianscorpion commented 10 months ago

for WIN32, I was able to integrate the Nfiq2Api.dll into c program successfully. the dependency file are: nist_plain_tir-ink.txt nist_plain_tir-ink.yaml

gfiumara commented 10 months ago

If I'm following, you have been able to resolve this issue, and so I will suggest closing this issue. I have opened a new issue that we are not distributing OpenCV libraries as part of the .msi installer in #368.

indianscorpion commented 10 months ago

be able to use the release binary, tried 32-bit, assume 64-bit will work too.