I have a BUILD.gn in which I want to include a shared library which is located in usr/lib
.
I have taken reference from this topic How to include a shared library in chromium's gn file?
But the .so file is not getting linked with the main function. Below is the BUILD.gn code:-
executable("check") {
sources = [ "check.cpp" ]
deps = [
":SampleCheck",
]
lib_dirs = [ "//usr/lib/SampleFile.so" ]
libs = [ "SampleFile" ]
}
shared_library("SampleCheck") {
sources = [
"SampleCheck.h", // Header file for functions
]
}
But, when executing this I am getting an error:-
ninja: Entering directory `out'
[0/1] Regenerating ninja files
[1/1] LINK main
FAILED: main
g++ -Wl,-rpath=\$ORIGIN/ -Wl,-rpath-link= -L../usr/lib/SampleFile.so -o main -Wl,--start-group @main.rsp -Wl,--end-group -lSampleDll.so
/usr/bin/ld: cannot find -lSampleDll.so
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I have surveyed many websites but I am not getting where am i wrong?