From 44fa660fa98b73832a038e7e7b3f2fe545218238 Mon Sep 17 00:00:00 2001 From: Falcon Dai Date: Tue, 2 May 2023 19:02:02 -0700 Subject: [PATCH] fix compilation error in #69 Problem: As mentioned in [this comment](https://github.com/openai/procgen/issues/69#issuecomment-1515349973) of #69, a compilation crashes due to an error of unused variables on Apple silicon (with clang 14 and possibly 13+). This issue has been reported [elsewhere](https://github.com/ClickHouse/ClickHouse/issues/27705). This seems to be caused by breaking behavior in clang 13 which escalates unused variable from a warning in prior versions to an error. The solution implemented here: I add an additional cflags `-Wno-unused-but-set-variable` for apple platforms. Tested on macOS 13.3.1 with Apple clang version 14.0.3 (clang-1403.0.22.14.1) --- procgen/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/procgen/CMakeLists.txt b/procgen/CMakeLists.txt index 31084aa5..952a9f7a 100644 --- a/procgen/CMakeLists.txt +++ b/procgen/CMakeLists.txt @@ -16,7 +16,7 @@ if(APPLE) # clang defaults to 20 errors, but usually only the first one is useful add_compile_options(-ferror-limit=1) # only produce errors on mac where development is done - add_compile_options(-Werror -Wextra -Wshadow -Wall -Wformat=2 -Wundef -Wvla -Wmissing-include-dirs -Wnon-virtual-dtor -Wno-unused-parameter) + add_compile_options(-Werror -Wextra -Wshadow -Wall -Wformat=2 -Wundef -Wvla -Wmissing-include-dirs -Wnon-virtual-dtor -Wno-unused-parameter -Wno-unused-but-set-variable) endif() if(MSVC) @@ -75,4 +75,4 @@ add_library(env # find libenv.h header target_include_directories(env PUBLIC ${LIBENV_DIR}) -target_link_libraries(env Qt5::Gui) \ No newline at end of file +target_link_libraries(env Qt5::Gui)