Skip to content
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

Apple/M1: compile fails with Bison 3 #78

Closed
edsiper opened this issue Feb 22, 2022 · 0 comments · Fixed by #79
Closed

Apple/M1: compile fails with Bison 3 #78

edsiper opened this issue Feb 22, 2022 · 0 comments · Fixed by #79

Comments

@edsiper
Copy link
Member

edsiper commented Feb 22, 2022

When compiling in an environment that contains Bison 3, it fails:

$ cmake -DCMT_DEV=on ../
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMT_HAVE_TIMESPEC_GET
-- Performing Test CMT_HAVE_TIMESPEC_GET - Success
-- Performing Test CMT_HAVE_GMTIME_R
-- Performing Test CMT_HAVE_GMTIME_R - Success
-- Performing Test CMT_HAVE_GMTIME_S
-- Performing Test CMT_HAVE_GMTIME_S - Failed
-- Performing Test CMT_HAVE_CLOCK_GET_TIME
-- Performing Test CMT_HAVE_CLOCK_GET_TIME - Success
-- Performing Test CMT_HAVE_MSGPACK
-- Performing Test CMT_HAVE_MSGPACK - Failed
-- Found FLEX: /usr/bin/flex (found suitable version "2.6.4", minimum required is "2") 
-- Found BISON: /opt/homebrew/Cellar/bison/3.8.2/bin/bison (found suitable version "3.8.2", minimum required is "3") 
-- xxHash build type: Release
-- Performing Test CFLAG_Wall
-- Performing Test CFLAG_Wall - Success
-- Performing Test CFLAG_Wextra
-- Performing Test CFLAG_Wextra - Success
-- Performing Test CFLAG_Wcast_qual
-- Performing Test CFLAG_Wcast_qual - Success
-- Performing Test CFLAG_Wcast_align
-- Performing Test CFLAG_Wcast_align - Success
-- Performing Test CFLAG_Wshadow
-- Performing Test CFLAG_Wshadow - Success
-- Performing Test CFLAG_Wstrict_aliasing_1
-- Performing Test CFLAG_Wstrict_aliasing_1 - Success
-- Performing Test CFLAG_Wswitch_enum
-- Performing Test CFLAG_Wswitch_enum - Success
-- Performing Test CFLAG_Wdeclaration_after_statement
-- Performing Test CFLAG_Wdeclaration_after_statement - Success
-- Performing Test CFLAG_Wstrict_prototypes
-- Performing Test CFLAG_Wstrict_prototypes - Success
-- Performing Test CFLAG_Wundef
-- Performing Test CFLAG_Wundef - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/edsiper/c/cmetrics/build
[@eduardos-mini:~/c/cmetrics/build GIT(master) 0]
$ make 
[  1%] Building C object lib/mpack/CMakeFiles/mpack-static.dir/src/mpack/mpack.c.o
[  2%] Linking C static library libmpack.a
[  2%] Built target mpack-static
[  4%] Building C object lib/xxHash-0.8.0/cmake_unofficial/CMakeFiles/xxhash.dir/__/xxhash.c.o
[  5%] Linking C static library libxxhash.a
[  5%] Built target xxhash
[  7%] [BISON][cmt_decode_prometheus_parser] Building parser with bison 3.8.2
cmt_decode_prometheus.y:2.1-37: warning: deprecated directive: ‘%name-prefix "cmt_decode_prometheus_"’, use ‘%define api.prefix {cmt_decode_prometheus_}’ [-Wdeprecated]
    2 | %name-prefix "cmt_decode_prometheus_"
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      | %define api.prefix {cmt_decode_prometheus_}
cmt_decode_prometheus.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
cmt_decode_prometheus.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
cmt_decode_prometheus.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
[  8%] [FLEX][cmt_decode_prometheus_lexer] Building scanner with flex 2.6.4
cmt_decode_prometheus.l:196: warning, -s option given but default rule can be matched
[ 10%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_gauge.c.o
[ 11%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_counter.c.o
[ 13%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_untyped.c.o
[ 14%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_metric.c.o
[ 16%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_map.c.o
[ 17%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_log.c.o
[ 19%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_opts.c.o
[ 20%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_time.c.o
[ 22%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_label.c.o
[ 23%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_cat.c.o
[ 25%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_sds.c.o
[ 26%] Building C object src/CMakeFiles/cmetrics-static.dir/cmetrics.c.o
[ 28%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_opentelemetry.c.o
[ 29%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_prometheus.c.o
[ 31%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_prometheus_remote_write.c.o
[ 32%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_text.c.o
[ 34%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_influx.c.o
[ 35%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_encode_msgpack.c.o
[ 37%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_decode_msgpack.c.o
[ 38%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_mpack_utils.c.o
[ 40%] Building C object src/CMakeFiles/cmetrics-static.dir/external/protobuf-c.c.o
[ 41%] Building C object src/CMakeFiles/cmetrics-static.dir/external/remote.pb-c.c.o
[ 43%] Building C object src/CMakeFiles/cmetrics-static.dir/external/types.pb-c.c.o
[ 44%] Building C object src/CMakeFiles/cmetrics-static.dir/external/opentelemetry_common.pb-c.c.o
[ 46%] Building C object src/CMakeFiles/cmetrics-static.dir/external/opentelemetry_metrics.pb-c.c.o
[ 47%] Building C object src/CMakeFiles/cmetrics-static.dir/external/opentelemetry_resource.pb-c.c.o
[ 49%] Building C object src/CMakeFiles/cmetrics-static.dir/external/opentelemetry_metrics_service.pb-c.c.o
[ 50%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_atomic_clang.c.o
[ 52%] Building C object src/CMakeFiles/cmetrics-static.dir/__/cmt_decode_prometheus_lexer.c.o
[ 53%] Building C object src/CMakeFiles/cmetrics-static.dir/__/cmt_decode_prometheus_parser.c.o
In file included from cmt_decode_prometheus.y:12:
/Users/edsiper/c/cmetrics/src/cmt_decode_prometheus.c:206:13: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            get_docstring(context),
            ^~~~~~~~~~~~~~~~~~~~~~
/Users/edsiper/c/cmetrics/include/cmetrics/cmt_counter.h:37:58: note: passing argument to parameter 'help' here
                                       char *name, char *help,
                                                         ^
In file included from cmt_decode_prometheus.y:12:
/Users/edsiper/c/cmetrics/src/cmt_decode_prometheus.c:246:13: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            get_docstring(context),
            ^~~~~~~~~~~~~~~~~~~~~~
/Users/edsiper/c/cmetrics/include/cmetrics/cmt_gauge.h:35:42: note: passing argument to parameter 'help' here
                                   char *help, int label_count, char **label_keys);
                                         ^
In file included from cmt_decode_prometheus.y:12:
/Users/edsiper/c/cmetrics/src/cmt_decode_prometheus.c:286:13: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            get_docstring(context),
            ^~~~~~~~~~~~~~~~~~~~~~
/Users/edsiper/c/cmetrics/include/cmetrics/cmt_untyped.h:35:58: note: passing argument to parameter 'help' here
                                       char *name, char *help,
                                                         ^
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_parser.c:1365:16: error: implicit declaration of function 'cmt_decode_prometheus_lex' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      yychar = yylex (&yylval, yyscanner, context);
               ^
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_parser.c:69:25: note: expanded from macro 'yylex'
#define yylex           cmt_decode_prometheus_lex
                        ^
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_parser.c:1365:16: note: did you mean 'cmt_decode_prometheus_free'?
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_parser.c:69:25: note: expanded from macro 'yylex'
#define yylex           cmt_decode_prometheus_lex
                        ^
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_lexer.h:437:6: note: 'cmt_decode_prometheus_free' declared here
void yyfree ( void * , yyscan_t yyscanner );
     ^
/Users/edsiper/c/cmetrics/build/cmt_decode_prometheus_lexer.h:239:16: note: expanded from macro 'yyfree'
#define yyfree cmt_decode_prometheus_free
               ^
3 warnings and 1 error generated.
make[2]: *** [src/CMakeFiles/cmetrics-static.dir/__/cmt_decode_prometheus_parser.c.o] Error 1
make[1]: *** [src/CMakeFiles/cmetrics-static.dir/all] Error 2
make: *** [all] Error 2

To reproduce the problem, install Bison using Brew and expand the path before running cmake:

Binary:

/opt//homebrew/Cellar/bison/3.8.2/bin/bison

Path:

export PATH=/opt/homebrew/Cellar/bison/3.8.2/bin/:$PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant