-
Notifications
You must be signed in to change notification settings - Fork 243
Description
To reproduce this bug, run the following command on Linux. Make sure the ext/aom/ directory doesn't exist.
rm -rf build
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DAVIF_CODEC_AOM=LOCAL -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL -DAVIF_LIBYUV=OFF
ninja -v
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.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ec972dff..3e22775d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -42,6 +42,8 @@ endforeach()
if(AVIF_ENABLE_FUZZTEST OR AVIF_ENABLE_GTEST OR AVIF_BUILD_APPS)
add_library(aviftest_helpers OBJECT gtest/aviftest_helpers.cc)
+ message(STATUS "WTC WTC WTC: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ message(STATUS "WTC WTC WTC: CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
target_link_libraries(aviftest_helpers PUBLIC avif_apps avif)
target_link_libraries(aviftest_helpers PRIVATE avif_enable_warnings)
add_library(aviftest_helpers_internal OBJECT gtest/aviftest_helpers.cc)