-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.1.0 failed to build with aom -DCONFIG_TUNE_BUTTERAUGLI or -DCONFIG_TUNE_VMAF #2274
Comments
I was able to reproduce with the following: sudo apt install libjxl-dev
git clone https://github.com/AOMediaCodec/libavif.git
cd libavif
git clone -b v3.9.1 --depth 1 https://aomedia.googlesource.com/aom ext/aom
cmake -S ext/aom -B ext/aom/build.libavif -DCONFIG_TUNE_BUTTERAUGLI=1 -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DBUILD_SHARED_LIBS=OFF
cmake --build ext/aom/build.libavif --parallel
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=ON
cmake --build build --parallel
Note: I failed to use STATIC_LINK_JXL=1 even with these hacky stepsgit clone -b v0.10.3 --depth 1 https://github.com/libjxl/libjxl.git ext/aom/third_party/libjxl
cd ext/aom/third_party/libjxl
./deps.sh
cd ../../../..
cmake -S ext/aom/third_party/libjxl -B ext/aom/third_party/libjxl/build \
-DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_JPEGLI=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_DEVTOOLS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
cmake --build ext/aom/third_party/libjxl/build --parallel
touch ext/aom/third_party/libjxl/build/third_party/highway/libskcms.a
cp ext/aom/third_party/libjxl/build/third_party/brotli/libbrotlicommon.a ext/aom/third_party/libjxl/build/third_party/brotli/libbrotlicommon-static.a
cp ext/aom/third_party/libjxl/lib/jxl/butteraugli/butteraugli.h ext/aom/third_party/libjxl/build/lib/include/
cp ext/aom/third_party/libjxl/lib/jxl/butteraugli/butteraugli.h ext/aom/third_party/libjxl/build/lib/include/jxl/
cmake -S ext/aom -B ext/aom/build.libavif -DCONFIG_TUNE_BUTTERAUGLI=1 -DSTATIC_LINK_JXL=1 -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DBUILD_SHARED_LIBS=OFF \
-DCMAKE_PREFIX_PATH="third_party/libjxl/build/lib/;third_party/libjxl/build/third_party/highway/;third_party/libjxl/build/third_party/brotli/;third_party/libjxl/build/lib/include/"
cmake --build ext/aom/build.libavif --parallel |
To fix this issue, I guess either:
|
Yannis: Thank you for looking into this bug. @Dzhami-Jame-ALI Did this work for you in an older verison of libavif, such as v1.0.4? If so, could you provide the steps you used to build the older version of libavif with aom -DCONFIG_TUNE_BUTTERAUGLI or -DCONFIG_TUNE_VMAF? Thanks. |
@jzern James: This is the issue Yannis mentioned in our team meeting. |
It looks like libavif is missing the library dependency for libvmaf or the butteraugli libs. With either option libaom should include the dependency in its pkg-config file. For instance with
libaom does not install cmake module files, however. |
@wantehchang Sure. |
@AMDmi3 @fdintino Please take a look (especially Frankie). Thanks! @Dzhami-Jame-ALI Thanks for the info. Because of the deprecation of Butteraugli in the jxl library, I am going to deal with vmaf first. I don't know how to fix this. A workaround is to build libaom as a shared library (with It is complicated, because two commits are responsible for this bug. Here are the details. I verified that v1.0.4 works but v1.1.0 doesn't. git bisect says:
The pull request was written by @AMDmi3. I think the pull request makes sense for the libaom shared library, but you are building libaom as a static library (without Reverting the above commit 28ba2af worked for a while, but it stopped working at this commit (found by another git bisection):
|
I think something like this would be sufficient to pull in the library dependencies from pkg-config (replacing the current if(AOM_LIBRARY)
if("${AOM_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
add_library(aom STATIC IMPORTED GLOBAL)
set(_AOM_PC_PREFIX "_AOM_STATIC")
else()
add_library(aom SHARED IMPORTED GLOBAL)
set(_AOM_PC_PREFIX "_AOM")
endif()
set_target_properties(aom PROPERTIES IMPORTED_LOCATION "${AOM_LIBRARY}")
target_include_directories(aom INTERFACE ${AOM_INCLUDE_DIR})
target_link_directories(aom INTERFACE "${${_AOM_PC_PREFIX}_LIBRARY_DIRS}")
set(_AOM_PC_LIBRARIES "${${_AOM_PC_PREFIX}_LIBRARIES}")
# remove "aom" so we only have library dependencies
list(REMOVE_ITEM _AOM_PC_LIBRARIES "aom")
target_link_libraries(aom INTERFACE "${_AOM_PC_LIBRARIES}")
endif() Something similar can be done for aom that was compiled into ext/aom/build.libavif in libavif/cmake/Modules/LocalAom.cmake Lines 17 to 21 in 7d9522d
By prepending the build.libavif directory to PKG_CONFIG_PATH and using the variables set by if(MSVC)
set(ENV{PKG_CONFIG_PATH} "${AOM_EXT_SOURCE_DIR}/build.libavif;$ENV{PKG_CONFIG_PATH}")
else()
set(ENV{PKG_CONFIG_PATH} "${AOM_EXT_SOURCE_DIR}/build.libavif:$ENV{PKG_CONFIG_PATH}")
endif()
pkg_check_modules(_AOM QUIET aom)
target_link_directories(aom INTERFACE ${_AOM_STATIC_LIBRARY_DIRS})
set(_AOM_PC_LIBRARIES ${_AOM_STATIC_LIBRARIES})
list(REMOVE_ITEM _AOM_PC_LIBRARIES "aom")
target_link_libraries(aom INTERFACE ${_AOM_PC_LIBRARIES}) I could probably open a PR with these changes tomorrow or this weekend if it would be helpful. |
In #2274 (comment), I said "A workaround is to build libaom as a shared library (with Based on the incorrect info, I asked Frankie to restrct his fix to the libaom static library case. So his fix (#2304) only fixes the libaom static library case and does not fix the libaom shared library case. Sorry! I verified that we just need to go back to an earlier version of his fix. |
Here are the steps I used to reproduce the bug with libvmaf. Note that I use the
|
I figured out what I did differently in my testing. Last time I set the Frankie: I am no longer sure if we need to add back your fix for the shared library case. What do you think? |
Fix an issue introduced in AOMediaCodec#2304 when libaom is built locally in the ext/ directory. See AOMediaCodec#2304 (review) for more information. Related to AOMediaCodec#2274.
Fix an issue introduced in #2304 when libaom is built locally in the ext/ directory. See #2304 (review) for more information. Related to #2274.
I am going to consider it a libvmaf installation error if libvmaf.so is not on the run-time linker's search path. I attached two shell scripts, static.sh and shared.sh, which I used to reproduce the bug and verify the fix. static.sh builds libvmaf and libaom as static libraries.
shared.sh builds libvmaf and libaom as shared libraries.
|
Changed since 1.1.0 * In avif.h, change "AVIF_API AVIF_NODISCARD" back to "AVIF_NODISCARD AVIF_API" to fix clang-cl and MSVC compilation errors in the shared library build on Windows. * Fix -DAVIF_GTEST=SYSTEM, AOMediaCodec/libavif#2258. * Fix infe_type and codec_config_type wrongly read as byte-aligned fields in the experimental feature AVIF_ENABLE_EXPERIMENTAL_METAV1. * When building aom as a local dependency, runtime CPU detection (`CONFIG_RUNTIME_CPU_DETECT`) is now always `ON`; in 1.1.0 it had been disabled for non-native builds. * Fix CMake config shared library leaks AOMediaCodec/libavif#2264. * Fix clang-cl compilation. * Update gain map metadata to current ISO 21496-1 draft. * cmake: Only search for ASM_NASM language on x86_64 platforms. * Fix "No known features for CXX compiler" CMake error. * Fix aom link flags so that transitive library link flags are included when aom is a static library AOMediaCodec/libavif#2274. * Fix out-of-order 'dimg' grid associations AOMediaCodec/libavif#2311. * Report files with an item used in multiple 'dimg' boxes with AVIF_RESULT_NOT_IMPLEMENTED instead of AVIF_RESULT_INVALID_IMAGE_GRID.
Since v1.1.0, libavif failed to build with [aom-DCONFIG_TUNE_BUTTERAUGLI] and [aom-DCONFIG_TUNE_VMAF] (aom without butteraugli or vmaf works fine with libavif, and I can still use ssim). The libjxl-butteraugli and vmaf library is pre-compiled, can be recognized and built into aom (v3.9.1). However, libavif failed to compile after building aom with butteraugli or vmaf:
Aom-Butteraugli's compile error log is similar.
Command i use to build aom:
cmake -DCONFIG_TUNE_VMAF=1 -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 ..
Command I used to build libavif:
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_JPEG=LOCAL -DAVIF_ZLIBPNG=LOCAL -DAVIF_BUILD_APPS=ON
The text was updated successfully, but these errors were encountered: