-
Notifications
You must be signed in to change notification settings - Fork 201
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
CMAKE_CXX_FLAGS_RELEASE is empty if -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF is specified #2365
Comments
On Windows this results in a linker error, because we lose not only the compiler optimizaiton flag and A cmake command line to reproduce the bug on Windows is:
|
A simple workaround is to add |
I think this also fixes the issue: diff --git a/cmake/Modules/LocalAom.cmake b/cmake/Modules/LocalAom.cmake
index d7f83f56..5fc59fe1 100644
--- a/cmake/Modules/LocalAom.cmake
+++ b/cmake/Modules/LocalAom.cmake
@@ -145,7 +145,8 @@ else()
foreach(_config_setting CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS)
foreach(_config_type DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
- set(${_config_setting}_${_config_type} ${${_config_setting}_${_config_type}_ORIG} CACHE STRING "" FORCE)
+ unset(${_config_setting}_${_config_type} CACHE)
+ set(${_config_setting}_${_config_type} ${${_config_setting}_${_config_type}_ORIG})
unset(${_config_setting}_${_config_type}_ORIG)
endforeach()
endforeach() The problem is that aom sets |
Frankie: Thank you! I am testing your patch now. Is it possible to get the type of the |
Frankie: Your patch fixed the bug on both Linux and Windows. Thanks! |
Fix empty CMAKE_CXX_FLAGS_RELEASE if libaom is built locally using FetchContent and AVIF_LIBYUV is OFF. libaom sets CMAKE_CXX_FLAGS_RELEASE and other flags as CACHE variables. To undo the changes libaom makes, unset the variables as cache variables so that they can be reset to their original values as normal variables. Fix AOMediaCodec#2365.
Fix empty CMAKE_CXX_FLAGS_RELEASE if libaom is built locally using FetchContent and AVIF_LIBYUV is OFF. libaom sets CMAKE_CXX_FLAGS_RELEASE and other flags as CACHE variables. To undo the changes libaom makes, unset the variables as cache variables so that they can be reset to their original values as normal variables. Fix AOMediaCodec#2365.
Frankie: I converted your patch in #2365 (comment) to a pull request. |
I filed a libaom bug report on this issue: https://aomedia.g-issues.chromium.org/issues/357715839 I will file a libavif issue on building libaom locally with ExternalProject_Add(). |
Fix empty CMAKE_CXX_FLAGS_RELEASE if libaom is built locally using FetchContent and AVIF_LIBYUV is OFF. libaom sets CMAKE_CXX_FLAGS_RELEASE and other flags as CACHE variables. To undo the changes libaom makes, unset the variables as cache variables so that they can be reset to their original values as normal variables. Fix AOMediaCodec#2365.
I think it would be preferable if it could be addressed in libaom. It's nice to have the ability to pass in whatever aom-specific cmake configs you might need, and conversely it's a pain to properly copy over cmake flags to an external project (which would at the very least need to support cross-compiling). |
@fdintino @vrabaud
To reproduce this bug, run the following command on Linux. Make sure the ext/aom/ directory doesn't exist.
Note that C++ files such as aviftest_helpers.cc and avifincrtest.cc are compiled without the
-O3 -DNDEBUG
flags commonly used in the Release build configuration.Note that the problem is gone if I change
-DAVIF_LIBYUV=OFF
to-DAVIF_LIBYUV=LOCAL
.My experimets showed that this bug only occurs when we use FetchContent to build libaom locally. I think this bug is caused by the code in cmake/Modules/LocalAom.cmake. It touches variables like
CMAKE_C_FLAGS_RELEASE
. Seeing how complicated that code is, I think it would be better to build libaom using ExternalProject.You can apply this patch and your will see that the
CMAKE_CXX_FLAGS_RELEASE
variable is empty.The text was updated successfully, but these errors were encountered: