Openjpeg: Fix autobuild issues - static compilation
cover Openjpeg: Fix autobuild issues - static compilation
For Static libraries, let openjpeg build third party libraries lzma,tiff,etc. Add Cmake directives to find pthreads and link against pthread libs by default
m68k | openjpeg-2.1 | http://autobuild.buildroot.net/results/2ca3e1b0eaadaf0cf5bf2fde756163ac5786a21c arm | openjpeg-2.1 | http://autobuild.buildroot.net/results/5d1184052e1cc7e9da1244d23c5932de4ad0c435 sh4 | openjpeg-2.1 | http://autobuild.buildroot.net/results/6e36f1ab549bd130ebbc6178576a7cfb2e5fe5ad
Olivier Schonken (2):
Openjpeg: Add patch to enable finding pthreads library by default
Openjpeg: Build third party dependencies for static library
...eLists-to-include-finding-of-pthreads-by-.patch | 49 ++++++++++++++++++++++ package/openjpeg/openjpeg.mk | 3 ++ 2 files changed, 52 insertions(+) create mode 100644 package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch
Signature · 1 line
2.7.4
PATCH 1/2 Openjpeg: Add patch to enable finding pthreads library by default
--- ...eLists-to-include-finding-of-pthreads-by-.patch | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch
package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch new file +49 -0
@@ -0,0 +1,49 @@ +From 0465bc4be814f01073cd31bbd6ad1f3a87a599c1 Mon Sep 17 00:00:00 2001 +From: Olivier Schonken <[email protected]> +Date: Sun, 18 Sep 2016 22:23:06 +0200 +Subject: [PATCH] Modify CmakeLists to include finding of pthreads by default + +Signed-off-by: Olivier Schonken <[email protected]> +--- + CMakeLists.txt | 8 ++++---- + src/bin/jp2/CMakeLists.txt | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 229da1e..66cf631 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -219,13 +219,13 @@ OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES) + + #----------------------------------------------------------------------------- + # Build Library ++find_package(Threads REQUIRED) ++if(NOT CMAKE_USE_PTHREADS_INIT) ++ message(FATAL_ERROR "Only pthread are supported") ++endif() + if(BUILD_JPIP_SERVER) + find_package(CURL REQUIRED) + find_package(FCGI REQUIRED) +- find_package(Threads REQUIRED) +- if(NOT CMAKE_USE_PTHREADS_INIT) +- message(FATAL_ERROR "Only pthread are supported") +- endif() + endif() + add_subdirectory(src/lib) + +diff --git a/src/bin/jp2/CMakeLists.txt b/src/bin/jp2/CMakeLists.txt +index 1c2ef39..ae35f0c 100644 +--- a/src/bin/jp2/CMakeLists.txt ++++ b/src/bin/jp2/CMakeLists.txt +@@ -32,7 +32,7 @@ endif() + foreach(exe opj_decompress opj_compress opj_dump) + add_executable(${exe} ${exe}.c ${common_SRCS}) + target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME} +- ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ++ ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${CMAKE_THREAD_LIBS_INIT} + ) + # To support universal exe: + if(ZLIB_FOUND AND APPLE) +-- +2.7.4 +
Signature · 1 line
2.7.4
PATCH 1/2 Openjpeg: Add patch to enable finding pthreads library by default
Hello,
Quoted 1 line · Olivier Schonken
Signed-off-by Olivier Schonken <[email protected]>
Missing commit log and autobuilder reference.
Quoted 28 lines
package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch new file +22
-0@@ -0,0 +1,49 @@ +From 0465bc4be814f01073cd31bbd6ad1f3a87a599c1 Mon Sep 17 00:00:00 2001 +From: Olivier Schonken <[email protected]> +Date: Sun, 18 Sep 2016 22:23:06 +0200 +Subject: [PATCH] Modify CmakeLists to include finding of pthreads by default + +Signed-off-by: Olivier Schonken <[email protected]> +--- + CMakeLists.txt | 8 ++++---- + src/bin/jp2/CMakeLists.txt | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 229da1e..66cf631 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -219,13 +219,13 @@ OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES) + + #----------------------------------------------------------------------------- + # Build Library ++find_package(Threads REQUIRED) ++if(NOT CMAKE_USE_PTHREADS_INIT) ++ message(FATAL_ERROR "Only pthread are supported")
package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch line 32
Quoted 10 lines
package/openjpeg/0001-Modify-CmakeLists-to-include-finding-of-pthreads-by-.patch new file +10
-0++endif() + if(BUILD_JPIP_SERVER) + find_package(CURL REQUIRED) + find_package(FCGI REQUIRED) +- find_package(Threads REQUIRED) +- if(NOT CMAKE_USE_PTHREADS_INIT) +- message(FATAL_ERROR "Only pthread are supported") +- endif() + endif() + add_subdirectory(src/lib)
While I agree that this will work around the build issue
http://autobuild.buildroot.net/results/2ca/2ca3e1b0eaadaf0cf5bf2fde756163ac5786a21c/build-end.log,
it is not really the proper solution.
The problem here is that lcms2 uses pthread, but the pkg-config file installed by lcms2 doesn't take this into account.
So the proper fix is to change the lcms2.pc file so that it includes -lpthread in Libs.private. Could you have a look at doing this?
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/2 Openjpeg: Build third party dependencies for static library
In reply to Olivier Schonken--- package/openjpeg/openjpeg.mk | 3 +++ 1 file changed, 3 insertions(+)
package/openjpeg/openjpeg.mk +3 -0
@@ -9,6 +9,9 @@ OPENJPEG_SITE = $(call github,uclouvain,openjpeg,version.$(OPENJPEG_VERSION)) OPENJPEG_LICENSE = BSD-2c OPENJPEG_LICENSE_FILES = LICENSE OPENJPEG_INSTALL_STAGING = YES +ifeq ($(BR2_STATIC_LIBS),y) +OPENJPEG_CONF_OPTS = -DBUILD_THIRDPARTY=ON +endif OPENJPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_ZLIB),zlib) OPENJPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBPNG),libpng)
Signature · 1 line
2.7.4
PATCH 2/2 Openjpeg: Build third party dependencies for static library
Hello,
package/openjpeg/openjpeg.mk OPENJPEG_SITE = $(call github,uclouvain,openjpeg,version.$(OPENJPEG_VERSION)) · line 14
Quoted 3 lines · Olivier Schonken
package/openjpeg/openjpeg.mk +3
-0+ifeq ($(BR2_STATIC_LIBS),y) +OPENJPEG_CONF_OPTS = -DBUILD_THIRDPARTY=ON +endif
If I understand correctly, this tells OpenJPEG to build its internal copy of lzma, tiff and other libraries. Is this correct?
If it is, then it is not the proper solution to the problem. Regardless of whether we're static linking or dynamic linking, we want to use the external libraries (i.e provided by the corresponding Buildroot packages).
Also, your commit log lacks a reference to the autobuilder failure being fixed (I know they are in the cover letter, but the cover letter doesn't get committed, which is why we want the explanation and the autobuilder reference to be in the commit lot itself).
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com