-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Describe the bug
Trying to build jpegli with -DJPEGXL_STATIC=ON only succeeds if third party dependencies have been fetched using git submodule update --init. When building from a tarball, which causes deps.sh to fetch tarballs for the dependencies, the build fails because it cannot locate lcms:
-- Could NOT find LCMS2 (missing: LCMS2_LIBRARY LCMS2_INCLUDE_DIR) (Required is at least version "2.12")
CMake Error at third_party/CMakeLists.txt:62 (message):
Please install lcms2 or run git submodule update --init
A workaround for this bug is to build using skcms instead, by passing -DJPEGXL_ENABLE_SKCMS=ON.
To Reproduce
- Download a tarball of this repo at a specific commit, e.g.
wget https://github.com/google/jpegli/archive/9e21f7e38283fe0837be763e02d97b7f4988831f.tar.gz - Extract it:
tar -xaf 9e21f7e38283fe0837be763e02d97b7f4988831f.tar.gz - Enter the directory
cd jpegli-9e21f7e38283fe0837be763e02d97b7f4988831f - Fetch third party dependencies:
./deps.sh - Attempt to build:
SKIP_TEST=1 ./ci.sh release -DJPEGXL_STATIC=ON
Dockerfile doing the above:
FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y full-upgrade && \
apt-get install -y \
ca-certificates \
clang \
cmake \
curl \
doxygen \
extra-cmake-modules \
g++ \
git \
graphviz \
libgif-dev \
libgoogle-perftools-dev \
libjpeg-dev \
ninja-build
WORKDIR /root
ARG JPEGLI_SHA=9e21f7e38283fe0837be763e02d97b7f4988831f
ARG JPEGLI_VERSION=jpegli-${JPEGLI_SHA}
ENV SKIP_TEST=1
ADD https://github.com/google/jpegli/archive/${JPEGLI_SHA}.tar.gz .
RUN tar -xaf ./${JPEGLI_SHA}.tar.gz && \
cd ./${JPEGLI_VERSION} && \
./deps.sh && \
./ci.sh release -DJPEGXL_STATIC=ONExpected behavior
A successful jpegli build, with statically linked binaries in build/tools.
Environment
- OS: Debian 12 "bookworm"
- Compiler version: clang 14.0.6
- CPU type: aarch64
- cjxl/djxl version string: not applicable, i think
Additional context
One problem is that deps.sh does not download a lcms tarball (there's no THIRD_PARTY_LCMS variable specifying the revision to use, nor an appropriate download_github invocation). Secondly, there are some problems in third_party/CMakeLists.txt:
- To determine if lcms in the repo, the code checks whether
"${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git"exists;.gitis not included in GitHub's tarballs, hence this consistently fails unless lcms is fetched as a submodule. Fix: check for a file that actually is included, like.gitignore. - The code attempts to call
configure_file()onthird_party/lcms/COPYING, a file which does not exist (it's somehow created when using submodules, but I don't understand how).
In summary, this is the changes needed in order to make the build succeed (just commenting out configure_file() is not really an acceptable solution, but I'm not sure what the correct way to fix this is).
diff --git a/deps.sh b/deps.sh
index 00395390..1b638081 100755
--- a/deps.sh
+++ b/deps.sh
@@ -23,6 +23,7 @@ THIRD_PARTY_SJPEG="e5ab13008bb214deb66d5f3e17ca2f8dbff150bf"
THIRD_PARTY_ZLIB="51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf" # v1.3.1
THIRD_PARTY_LIBPNG="f135775ad4e5d4408d2e12ffcc71bb36e6b48551" # v1.6.40
THIRD_PARTY_LIBJPEG_TURBO="8ecba3647edb6dd940463fedf38ca33a8e2a73d1" # 2.1.5.1
+THIRD_PARTY_LCMS="5176347635785e53ee5cee92328f76fda766ecc6"
# Download the target revision from GitHub.
download_github() {
@@ -91,6 +92,7 @@ EOF
download_github third_party/zlib madler/zlib
download_github third_party/libpng glennrp/libpng
download_github third_party/libjpeg-turbo libjpeg-turbo/libjpeg-turbo
+ download_github third_party/lcms mm2/Little-CMS
echo "Done."
}
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 9bd1b8c9..be75981f 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -56,15 +56,15 @@ if (JPEGXL_ENABLE_SKCMS)
${PROJECT_BINARY_DIR}/LICENSE.skcms COPYONLY)
endif ()
if (NOT JPEGXL_ENABLE_SKCMS)
- if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" OR JPEGXL_FORCE_SYSTEM_LCMS2 )
+ if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.gitignore" OR JPEGXL_FORCE_SYSTEM_LCMS2 )
find_package(LCMS2 2.12)
if ( NOT LCMS2_FOUND )
message(FATAL_ERROR "Please install lcms2 or run git submodule update --init")
endif ()
else()
include(lcms2.cmake)
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING"
- ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY)
+ #configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lcms/COPYING"
+ # ${PROJECT_BINARY_DIR}/LICENSE.lcms COPYONLY)
endif()
endif()