Skip to content

Commit

Permalink
Fix Flatbuffer build issue.
Browse files Browse the repository at this point in the history
Building on g++ 13.2.0 results in -Wstringop-overread errors. This
commit addresses the flatbuffer build issue with the following changes:
1. Remove Werror flag in flarbuffer patch.
2. Add a compilation option to suppress the 'stringop-overflow' error in
the Flatbuffers within the xnnpack provider.

Signed-off-by: Phoebe Chen <[email protected]>
  • Loading branch information
phoebesv committed Jan 28, 2024
1 parent 6d7ac9c commit 040892c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmake/onnxruntime_providers_xnnpack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
flatbuffers::flatbuffers Boost::mp11 safeint_interface
)

# Add compile option to suppress stringop-overflow error in Flatbuffers.
target_compile_options(onnxruntime_providers_xnnpack PRIVATE -Wno-error=stringop-overflow)

add_dependencies(onnxruntime_providers_xnnpack onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
set_target_properties(onnxruntime_providers_xnnpack PROPERTIES FOLDER "ONNXRuntime")

Expand Down
2 changes: 1 addition & 1 deletion cmake/patches/flatbuffers/flatbuffers.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 3987eac9..5e5462f1 100644
endif(CYGWIN)
set(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow -Wno-error=stringop-overflow")
+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror=shadow -Wno-error=stringop-overflow")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
Expand Down

0 comments on commit 040892c

Please sign in to comment.