Skip to content

compile error with Mac Xcode 14 #342

@ftab

Description

@ftab

This is with eRPC 1.10.0

I'm using a MacBook Air M1 (Apple Silicon), so the homebrew paths are different:

BISON_ROOT=/opt/homebrew/opt/bison FLEX_ROOT=/opt/homebrew/opt/flex BOOST_ROOT=/opt/homebrew/Cellar/boost/1.81.0_1 make -j

The error:

/opt/homebrew/Cellar/boost/1.81.0_1/include/boost/lexical_cast/detail/converter_lexical_streams.hpp:310:21: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]

The workaround:

diff --git a/mk/flags.mk b/mk/flags.mk
index a42233d..3919b8e 100644
--- a/mk/flags.mk
+++ b/mk/flags.mk
@@ -50,6 +50,8 @@ ifeq "$(is_darwin)" "1"
     LDFLAGS += -L $(BOOST_ROOT)/lib
     LDFLAGS += -L$(FLEX_ROOT)/lib
     INCLUDES += $(FLEX_ROOT)/include
+    # don't warn about sprintf deprecation, see https://github.com/boostorg/boost/issues/688
+    CXXFLAGS += -Wno-deprecated-declarations
 endif
 
 # Need to pass the -U option to GNU ar to turn off deterministic mode, or

Until Boost reworks that library to no longer use sprintf, we have to add that flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions