opencv: Replace absolute path of static library with -l$library_name
PATCH v2 1/1 opencv: Replace absolute path of static library with -l$library_name
Some opencv modules are forced to build statically (for instance the "ts" module) because they have a line like this one in their CMakeLists.txt file:
set(OPENCV_MODULE_TYPE STATIC)
That makes a static library get installed and also listed in the "Libs:" line of the pkgconfig file (opencv.pc) along with all the shared libraries. That can cause link failures in other packages which link to opencv, for instance the gst1-plugins-bad package. Here is an example of the link failure:
CXXLD libgstopencv.la
*** Warning: Linking the shared library libgstopencv.la against the *** static library /usr/lib/libopencv_ts.a is not portable! mips-linux-gnu-g++: error: /usr/lib/libopencv_ts.a: No such file or directory
make[4]: *** [libgstopencv.la] Error 1
The solution is to not list the static library in the "Libs:" line of the pkgconfig file and add '-lopencv_ts' instead.
This issue has been reported upstream:
http://code.opencv.org/issues/3931
Fixes:
http://autobuild.buildroot.net/results/e8a/e8a859276db34aff87ef181b0cce98916b0afc90/
--- package/opencv/opencv.mk | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
package/opencv/opencv.mk +8 -0
@@ -247,4 +247,12 @@ endef OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_CLEAN_INSTALL_DATA endif +ifeq ($(BR2_PACKAGE_OPENCV_LIB_TS),y) +define OPENCV_FIX_PC_FILE_LIBS + $(SED) '/^Libs:/s/$${exec_prefix}\/lib\/libopencv_ts.a/-lopencv_ts/' \ + $(STAGING_DIR)/usr/lib/pkgconfig/opencv.pc +endef +OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_FIX_PC_FILE_LIBS +endif + $(eval $(cmake-package))
Signature · 1 line
1.7.1
PATCH v2 1/1 opencv: Replace absolute path of static library with -l$library_name
Hi Vincente, all,
Quoted 41 lines · Vicente Olivert Riera
Some opencv modules are forced to build statically (for instance the "ts" module) because they have a line like this one in their CMakeLists.txt file:
set(OPENCV_MODULE_TYPE STATIC)That makes a static library get installed and also listed in the "Libs:" line of the pkgconfig file (opencv.pc) along with all the shared libraries. That can cause link failures in other packages which link to opencv, for instance the gst1-plugins-bad package. Here is an example of the link failure:
CXXLD libgstopencv.la
*** Warning: Linking the shared library libgstopencv.la against the *** static library
/usr/lib/libopencv_ts.ais not portable! mips-linux-gnu-g++: error:/usr/lib/libopencv_ts.a: No such file or directory
make[4]: *** [libgstopencv.la] Error 1The solution is to not list the static library in the "Libs:" line of the pkgconfig file and add '-lopencv_ts' instead.
This issue has been reported upstream:
http://code.opencv.org/issues/3931Fixes:
http://autobuild.buildroot.net/results/e8a/e8a859276db34aff87ef181b0cce98916b0afc90/Signed-off-by Vicente Olivert Riera <[email protected]>--- package/opencv/opencv.mk | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)package/opencv/opencv.mk +0
-0@@ -247,4 +247,12 @@ endef OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_CLEAN_INSTALL_DATA endif
package/opencv/opencv.mk endef · line 258
Quoted 10 lines
package/opencv/opencv.mk +8
-0+ifeq ($(BR2_PACKAGE_OPENCV_LIB_TS),y) +define OPENCV_FIX_PC_FILE_LIBS + $(SED) '/^Libs:/s/$${exec_prefix}\/lib\/libopencv_ts.a/-lopencv_ts/' \ + $(STAGING_DIR)/usr/lib/pkgconfig/opencv.pc +endef +OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_FIX_PC_FILE_LIBS +endif + $(eval $(cmake-package))
Unfortunately, this patch is not enough :-/
After applying this patch, similar errors [1] can be triggered using this defconfig [2].
I'm working on the code generating the opencv.pc file in the opencv repository. So, stay tuned ;-)
Regards,
[1] http://code.bulix.org/ecmpin-87146
[2] http://code.bulix.org/782t24-87145
Signature · 1 line
Samuel
PATCH v2 1/1 opencv: Replace absolute path of static library with -l$library_name
In reply to Vicente Olivert RieraDear Vicente Olivert Riera,
Quoted 23 lines · Vicente Olivert Riera
Some opencv modules are forced to build statically (for instance the "ts" module) because they have a line like this one in their CMakeLists.txt file:
set(OPENCV_MODULE_TYPE STATIC)That makes a static library get installed and also listed in the "Libs:" line of the pkgconfig file (opencv.pc) along with all the shared libraries. That can cause link failures in other packages which link to opencv, for instance the gst1-plugins-bad package. Here is an example of the link failure:
CXXLD libgstopencv.la
*** Warning: Linking the shared library libgstopencv.la against the *** static library
/usr/lib/libopencv_ts.ais not portable! mips-linux-gnu-g++: error:/usr/lib/libopencv_ts.a: No such file or directory
make[4]: *** [libgstopencv.la] Error 1The solution is to not list the static library in the "Libs:" line of the pkgconfig file and add '-lopencv_ts' instead.
Quoted 7 lines
This issue has been reported upstream:
http://code.opencv.org/issues/3931Fixes:
http://autobuild.buildroot.net/results/e8a/e8a859276db34aff87ef181b0cce98916b0afc90/Signed-off-by Vicente Olivert Riera <[email protected]>
Following the feedback from Samuel on this patch, I have marked it as Rejected in patchwork. Can you work with Samuel to resubmit a proper fix?
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 opencv: Replace absolute path of static library with -l$library_name
Hi Vicente, Thomas, all,
Quoted 29 lines · Thomas Petazzoni
Dear Vicente Olivert Riera,
Quoted 26 lines · Vicente Olivert Riera
Some opencv modules are forced to build statically (for instance the "ts" module) because they have a line like this one in their CMakeLists.txt file:
set(OPENCV_MODULE_TYPE STATIC)That makes a static library get installed and also listed in the "Libs:" line of the pkgconfig file (opencv.pc) along with all the shared libraries. That can cause link failures in other packages which link to opencv, for instance the gst1-plugins-bad package. Here is an example of the link failure:
CXXLD libgstopencv.la
*** Warning: Linking the shared library libgstopencv.la against the *** static library
/usr/lib/libopencv_ts.ais not portable! mips-linux-gnu-g++: error:/usr/lib/libopencv_ts.a: No such file or directory
make[4]: *** [libgstopencv.la] Error 1The solution is to not list the static library in the "Libs:" line of the pkgconfig file and add '-lopencv_ts' instead.
This issue has been reported upstream:
http://code.opencv.org/issues/3931
Quoted 8 lines
Quoted 4 lines
Fixes:
http://autobuild.buildroot.net/results/e8a/e8a859276db34aff87ef181b0cce98916b0afc90/Signed-off-by Vicente Olivert Riera <[email protected]>Following the feedback from Samuel on this patch, I have marked it as Rejected in patchwork. Can you work with Samuel to resubmit a proper fix?
I'll respin the opencv series since opencv 2.4.11 is out and contains some patches (especially the one fixing this) from the opencv-2.4.10 series (which still cleanly applies hopefully, so no big deal :-])
Regards,
Signature · 1 line
Samuel