GitHub issue: Adding open source libraries for core library
State: closed

Hi @kayee-nist 
  We have few open source libraries which we would like to add to our core library. It seems NIST only accepts 1 core library in .so format which includes 4 folders config, doc, etc 

 Currently We add these lines to NIST demo code in this repo and it works. 

```
 include_directories($INCLUDE_DIR_LIB1, $INCLUDE_DIR_LIB2, $INCLUDE_DIR_LIB3, ...)

 link_libraries(/usr/local/lib/liblib1.so, /usr/local/lib/liblib2.so, /usr/local/lib/liblib3.so, ... ) 
```

 The strict requirement has been to **NOT** modify the CMake build system and to **NOT** modify any include files. Addidng dep packages is really hard with these constraints. Hence, we are asking if a better solution is possible.

But would like to know if there is a better way to submit our proposal than to hard code these library functions (fcn1 from lib1, fcn2 from lib2, fcn3 from lib3, etc) and deps as a single libImplfrvt1N.cpp file. 

FRNinja123

You can try using rpath=$ORIGIN when you build your library, but you need to link your submission library against any 3rd party libraries that are required. For example, add the following to your CMakeLists.txt:

set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-rpath,$ORIGIN")
add_library (frvt_11_null_001 SHARED nullimplfrvt11.cpp)
target_link_libraries(frvt_11_null_001 thirdpartylib1.so thirdpartylib2.so thirdpartylib3.so)

@mlngan 
 Thank you for the above note. We are able to build the shared library using the above method and are able to run the demo code in this repo (but the catch is that we are **modifying** the **CMake build** system) both for the shared library generation and for the evaluation code. 

In this case, can you let know how the final submission library would look like **libfrvt_11_null_001.so** and this is the library sent to NIST for FRVT evaluation. When we compile the library with dependecy libraries and use this library for evaluation without linking internal dep libs, the problem arises for undefined internal reference functions.

i.e. **w/o** these lines in **CMAKE** for **validate_1N.cpp**, we get **undefined reference** to "**fcn1 from lib1**", etc. as the **compiler cannot find** these internal dep fcns. 

```
include_directories($INCLUDE_DIR_LIB1, $INCLUDE_DIR_LIB2, $INCLUDE_DIR_LIB3) 
target_link_libraries($LIB1, $LIB2, $LIB3)
```

The final .tar.gz file contains these folders from run_validate_1N.sh ([Link](https://github.com/usnistgov/frvt/blob/master/1N/run_validate_1N.sh), line 111) -> **doc, config, lib, validation**

`tar -zcf $libstring.tar.gz ./doc ./config ./lib ./validation`

Please comment or elaborate on how the final submission would look like and if we are to add the include directories can we put it in a folder **include** and it to the above 4 folders **doc, config, lib, validation**
while adding the $LIB1.so to **lib** folder. 

FRNinja123

You should be putting it in the lib directory (where your tested library is) for simplification as that would ensure it gets put in the same place on the test system too.
If you're linking against the adjacent library (and looking in the current directory), it will also find it there.

@xsacha and @mlngan 
 Thank you for your support. We think we have the hang of it. This has more to do with how CMake Build systems works. Kindly close/delete the issue as this is solved. 

FRNinja123