GitHub issue: Errors while compiling validation package 1:1
State: open

/usr/bin/ld: validate11.cpp:(.text.startup+0x35): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x5b): undefined reference to `FRVT::FRVT_STRUCTS_MAJOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x85): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x12d): undefined reference to `FRVT_11::API_MAJOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x13b): undefined reference to `FRVT_11::API_MINOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x375): undefined reference to `FRVT_11::API_MAJOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x39f): undefined reference to `FRVT_11::API_MINOR_VERSION'
/usr/bin/ld: validate11.cpp:(.text.startup+0x538): undefined reference to `FRVT_11::Interface::getImplementation()'
collect2: error: ld returned 1 exit status
make[2]: *** [src/testdriver/CMakeFiles/validate11.dir/build.make:100:../bin/v
alidate11] Error 1
make[1]: *** [CMakeFiles/Makefilez:94:src/testdriver/CMakeFiles/validate11.dir
/all] Error 2
make: *** [Makefile:84: all] Error 2



I am facing the above issue when I placed my .so file in libs folder
Please suggest as to what changes needs to be done in my .so file or any other file to solve the issue 

As a sanity check, do you get the same error when you build the null implementation by running ./scripts/build_null_impl.sh and then running ./run_validate_11.sh?

I am facing same problem. 
/usr/bin/ld: CMakeFiles/validate_morph.dir/validate_morph.o: in function `main':
validate_morph.cpp:(.text+0xf9f): undefined reference to `FRVT::FRVT_STRUCTS_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfaf): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfd9): undefined reference to `FRVT::FRVT_STRUCTS_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfff): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x1087): undefined reference to `FRVT_MORPH::API_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x1097): undefined reference to `FRVT_MORPH::API_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x10c1): undefined reference to `FRVT_MORPH::API_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x10e7): undefined reference to `FRVT_MORPH::API_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x17b2): undefined reference to `FRVT_MORPH::Interface::getImplementation()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/validate_morph.dir/build.make:99: ../bin/validate_morph] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/validate_morph.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
sms@sms:~/Downloads/morph/src/testdriver_wvu/build4$ 


Can anyone give me the solution of this two error in the new FRVT?


As a sanity check, do you get the same error when you build the null implementation by running ./scripts/build_null_impl.sh and then running ./run_validate_morph.sh?

I do not  get any error in null implementation (./scripts/build_null_impl.sh).

Can you confirm that your implementation library was compiled and built on Ubuntu?  Can you also confirm that you **DO NOT** have "-DNIST_EXTERN_FRVT_STRUCTS_VERSION -DNIST_EXTERN_API_VERSION" included in the CMakeLists.txt/Makefile that you built your library with?

I have implemented into Ubuntu 20.04.3. I do not have "-DNIST_EXTERN_FRVT_STRUCTS_VERSION -DNIST_EXTERN_API_VERSION" those flags.

After building the null implementation, did you run ./run_validate_morph.sh to confirm there were no errors with linking against the validation testdriver?

After Null implementation I have run ./run_validate_morph.sh but there have no issue and no error.
Moreover,
./src/testdriver/ when i build through cmake and make 2 errors occur always.


sms@sms:~/Downloads/frvt-master_23March/morph/src/testdriver/build$ cmake ..
sms@sms:~/Downloads/frvt-master_23March/morph/src/testdriver/build$ make

I have not change any code of frvt into Ubuntu 20.04.3 . I just want to build test driver and got same error. That is

sms@sms:~/Downloads/frvt-master_23March/morph/src/testdriver/build$ make
Scanning dependencies of target validate_morph
[ 33%] Building CXX object CMakeFiles/validate_morph.dir/home/sms/Downloads/frvt-master_23March/common/src/util/util.o
[ 66%] Building CXX object CMakeFiles/validate_morph.dir/validate_morph.o
[100%] Linking CXX executable ../bin/validate_morph
/usr/bin/ld: CMakeFiles/validate_morph.dir/validate_morph.o: in function `main':
validate_morph.cpp:(.text+0xf9f): undefined reference to `FRVT::FRVT_STRUCTS_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfaf): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfd9): undefined reference to `FRVT::FRVT_STRUCTS_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0xfff): undefined reference to `FRVT::FRVT_STRUCTS_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x1087): undefined reference to `FRVT_MORPH::API_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x1097): undefined reference to `FRVT_MORPH::API_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x10c1): undefined reference to `FRVT_MORPH::API_MAJOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x10e7): undefined reference to `FRVT_MORPH::API_MINOR_VERSION'
/usr/bin/ld: validate_morph.cpp:(.text+0x17b2): undefined reference to `FRVT_MORPH::Interface::getImplementation()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/validate_morph.dir/build.make:99: ../bin/validate_morph] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/validate_morph.dir/all] Error 2
make: *** [Makefile:84: all] Error 2


Can I try to packaging the FRVT (old version) into CentOS because of Ubuntu 20.04.3 provide that issue.Please, Solve this issue,it is very urgent because we (WVU team) will submit the new FRVT encrypted package to NIST. 
Thanks


Ok, I think I see what your issue is.  You can't just go into the ./src/testdriver directory and build the testdriver directly.  There is a variable called FRVT_IMPL_LIB that needs to be set in order to know what implementation library to link to.  Please follow the instructions from the ./README.md file.  You need to place your implementation library in ./lib and then run run_validate_morph.sh, which will set up all necessary variables and paths.

I will follow the steps that you say and ./README.md file depicts. Thanks for your kind reply.

I am able to run  run_validate_morph.sh (with this: libfrvt_morph_wvu_001.so in library) into CentOS . But new FRVT with Ubuntu causes 2 error for running run_validate_morph.sh .
**Does NIST allow to previous version of FRVT with CentOS. That will be easy for me to compile and packaging the software.**
The generated shared object (.so file) causes the problem in Ubuntu. But that shared object (libfrvt_morph_wvu_001.so) able to compile in the previous version of FRVT (operating system is CentOS). 
Thanks. 

Can you confirm that your libfrvt_morph_wvu_001.so file was compiled and built on Ubuntu?  What are the errors that you're encountering when running on Ubuntu?

Yes.  
libfrvt_morph_wvu_001.so causes the error. When I put  libfrvt_morph_null_001.so there have no error. Moreover I have compiled  libfrvt_morph_wvu_001.so into the ubuntu. (Also I have checked previous version of  libfrvt_morph_wvu_001.so too. ) But facing the same problem for  libfrvt_morph_wvu_001.so in Ubuntu. 
But when I switch to CentOS with our previous  libfrvt_morph_wvu_001.so it compiled easily. **Can we are allowed to package our software through previous FRVT with CentOS for NIST submission?**

Can you please provide the exact error messages that you are seeing when you run ./run_validate_morph.sh on Ubuntu?

Thanks for your kind reply.
`sms@sms:~/Downloads/frvt-master_24_march/morph$ ./run_validate_morph.sh
Checking installation of required packages [SUCCESS]
Looking for core implementation library in /home/sms/Downloads/frvt-master_24_march/morph/lib.[SUCCESS] Found core implementation library /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so.
Attempting to compile and link /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so against test harness.
Scanning dependencies of target validate_morph
[ 33%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/home/sms/Downloads/frvt-master_24_march/common/src/util/util.cpp.o
[ 66%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/validate_morph.cpp.o
[100%] Linking CXX executable ../../../bin/validate_morph
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libc10.so: .dynsym local symbol at index 138 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libc10.so: .dynsym local symbol at index 140 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 149 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 227 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 252 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 291 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 574 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 625 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 739 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 742 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 743 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 747 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 748 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 749 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 750 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 779 (>= sh_info of 2)
/usr/bin/ld: /home/sms/Downloads/libtorch/lib/libtorch_cpu.so: .dynsym local symbol at index 785 (>= sh_info of 2)
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::view::call(at::Tensor const&, c10::ArrayRef<long>)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::div_Scalar::call(at::Tensor const&, c10::Scalar const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `torch::jit::Method::operator()(std::vector<c10::IValue, std::allocator<c10::IValue> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, c10::IValue, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, c10::IValue> > > const&) const'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::full::call(c10::ArrayRef<long>, c10::Scalar const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::TensorBase::__dispatch_contiguous(c10::MemoryFormat) const'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::select_int::call(at::Tensor const&, long, long)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::to_dtype::call(at::Tensor const&, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::permute::call(at::Tensor const&, c10::ArrayRef<long>)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `vtable for torch::jit::Method'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::copy_::call(at::Tensor&, at::Tensor const&, bool)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::sub_Scalar::call(at::Tensor const&, c10::Scalar const&, c10::Scalar const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::softmax_int::call(at::Tensor const&, long, c10::optional<c10::ScalarType>)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `at::_ops::clone::call(at::Tensor const&, c10::optional<c10::MemoryFormat>)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/testdriver/CMakeFiles/validate_morph.dir/build.make:100: ../bin/validate_morph] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: src/testdriver/CMakeFiles/validate_morph.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
[ERROR] There were errors during compilation of your library with the validation test harness.  Please investigate and re-compile.
sms@sms:~/Downloads/frvt-master_24_march/morph$ 


Your errors appear to be related to the version of libtorch that you're linking to may have been compiled with an older compiler - https://github.com/pytorch/pytorch/issues/13541.  Have you tried installing a new version of libtorch that's compatible with g++ 9.x or tried re-compiling torch with -D_GLIBCXX_USE_CXX11_ABI=0?

I have changed Libtorch also opencv (new version) but there are 2 errors
```
sms@sms:~/Downloads/frvt-master_24_march/morph$ ./run_validate_morph.sh
Checking installation of required packages [SUCCESS]
Looking for core implementation library in /home/sms/Downloads/frvt-master_24_march/morph/lib.[SUCCESS] Found core implementation library /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so.
Attempting to compile and link /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so against test harness.
Scanning dependencies of target validate_morph
[ 33%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/home/sms/Downloads/frvt-master_24_march/common/src/util/util.cpp.o
[ 66%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/validate_morph.cpp.o
[100%] Linking CXX executable ../../../bin/validate_morph
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20200310::Net::setInput(cv::_InputArray const&, std::string const&, double, cv::Scalar_<double> const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20200310::Net::forward(cv::_OutputArray const&, std::vector<std::string, std::allocator<std::string> > const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20200310::readNetFromCaffe(std::string const&, std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/testdriver/CMakeFiles/validate_morph.dir/build.make:100: ../bin/validate_morph] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: src/testdriver/CMakeFiles/validate_morph.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
[ERROR] There were errors during compilation of your library with the validation test harness.  Please investigate and re-compile.
sms@sms:~/Downloads/frvt-master_24_march/morph$ 

```


Could you please solve the above error?

@ShoaibMerajSami this looks like an error on your side. It is missing symbols from OpenCV DNN lib

Thanks @xsacha . I have tried to solve this issue, so, I have install opencv 4.5.3 from source then I have added the opencv path into the cmake. But there remain 2 error. How can I solve this error. Could you give me yours valuable suggestion for solve OpenCV DNN lib issue?
The error is:
```
sms@sms:~/Downloads/frvt-master_24_march/morph$ ./run_validate_morph.sh
Checking installation of required packages [SUCCESS]
Looking for core implementation library in /home/sms/Downloads/frvt-master_24_march/morph/lib.[SUCCESS] Found core implementation library /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so.
Attempting to compile and link /home/sms/Downloads/frvt-master_24_march/morph/lib/libfrvt_morph_wvu_001.so against test harness.
Scanning dependencies of target validate_morph
[ 33%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/home/sms/Downloads/frvt-master_24_march/common/src/util/util.cpp.o
[ 66%] Building CXX object src/testdriver/CMakeFiles/validate_morph.dir/validate_morph.cpp.o
[100%] Linking CXX executable ../../../bin/validate_morph
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20210608::Net::forward(cv::_OutputArray const&, std::vector<std::string, std::allocator<std::string> > const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20210608::Net::setInput(cv::_InputArray const&, std::string const&, double, cv::Scalar_<double> const&)'
/usr/bin/ld: ../../../lib/libfrvt_morph_wvu_001.so: undefined reference to `cv::dnn::dnn4_v20210608::readNetFromCaffe(std::string const&, std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/testdriver/CMakeFiles/validate_morph.dir/build.make:100: ../bin/validate_morph] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: src/testdriver/CMakeFiles/validate_morph.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
[ERROR] There were errors during compilation of your library with the validation test harness.  Please investigate and re-compile.
```

Is there an OpenCV library with the word 'dnn' in it that you have forgotten to link?
If building from source it may be easier for you to statically link it in this case.