skvadrik / re2c

Lexer generator for C, C++, Go and Rust.
https://re2c.org
Other
1.09k stars 169 forks source link

lib/parse.h:49:15: 错误:expected unqualified-id before numeric constant #261

Closed qidizi closed 5 years ago

qidizi commented 5 years ago

/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am


--------when configure use it is error -------

# 配置命令如下
CPPFLAGS="-I/usr/include -I/Users/qidizi/q/include"
LDFLAGS="-L/usr/lib -L/Users/qidizi/q/lib"
bash "/Users/qidizi/re2c-1.2.1/configure" --prefix=/Users/qidizi/q \
--exec-prefix=/Users/qidizi/q \
 --bindir=/Users/qidizi/q/bin \
 --libexecdir=/Users/qidizi/q/libexec \
 --sbindir=/Users/qidizi/q/bin \
 --sysconfdir=/Users/qidizi/q/etc  \
 --libdir=/Users/qidizi/q/lib  \
 --includedir=/Users/qidizi/q/include \
 --datarootdir=/Users/qidizi/q/share \
 --enable-debug --enable-libs \

 CXX      src/regexp/tag.o
In file included from ../lib/lex.re:10:
lib/parse.h:49:15: 错误:expected unqualified-id before numeric constant
   49 | #define ERROR 259
      |               ^~~
./src/msg/warn.h:49:27: 附注:in expansion of macro ‘ERROR’
   49 |     static const uint32_t ERROR;
      |                           ^~~~~
lib/parse.cc:76:15: 错误:expected unqualified-id before numeric constant
   76 | #define ERROR 259
      |               ^~~
./src/msg/warn.h:49:27: 附注:in expansion of macro ‘ERROR’
   49 |     static const uint32_t ERROR;
      |                           ^~~~~

mac:re2c-1.2.1 qidizi$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
mac:re2c-1.2.1 qidizi$ uname -a
Darwin mac.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64
mac:re2c-1.2.1 qidizi$ 

CXX      src/dfa/find_state.o
lib/parse.cc:76:15: 错误:expected unqualified-id before numeric constant
   76 | #define ERROR 259
      |               ^~~
./src/msg/warn.h:49:27: 附注:in expansion of macro ‘ERROR’
   49 |     static const uint32_t ERROR;
      |                           ^~~~~
In file included from ../lib/lex.re:10:
lib/parse.h:49:15: 错误:expected unqualified-id before numeric constant
   49 | #define ERROR 259
      |               ^~~
./src/msg/warn.h:49:27: 附注:in expansion of macro ‘ERROR’
   49 |     static const uint32_t ERROR;
      |                           ^~~~~
  CXX      src/dfa/minimization.o
  CXX      src/dfa/tagver_table.o
  CXX      src/dfa/tcmd.o
  CXX      src/encoding/ebcdic/ebcdic_regexp.o
  CXX      src/encoding/enc.o
  CXX      src/encoding/range_suffix.o
  CXX      src/encoding/utf8/utf8_regexp.o
  CXX      src/encoding/utf8/utf8.o
  CXX      src/encoding/utf16/utf16_regexp.o
  CXX      src/encoding/utf16/utf16.o
  CXX      src/msg/msg.o
  CXX      src/msg/warn.o
  CXX      src/regexp/ast_to_re.o
make[1]: *** [Makefile:2672: lib/libre2c_la-parse.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:2665: lib/libre2c_la-lex.lo] Error 1
make[1]: Leaving directory '/Users/qidizi/re2c-1.2.1'
make: *** [Makefile:1396: all] Error 2
有错误
mac:re2c-1.2.1 qidizi$ make --version
GNU Make 4.2.1
Built for x86_64-apple-darwin18.7.0
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

----------drop "--enable-libs" it is ok---------
# 配置命令如下
CPPFLAGS="-I/usr/include -I/Users/qidizi/q/include"
LDFLAGS="-L/usr/lib -L/Users/qidizi/q/lib"
bash "/Users/qidizi/re2c-1.2.1/configure" --prefix=/Users/qidizi/q \
--exec-prefix=/Users/qidizi/q \
 --bindir=/Users/qidizi/q/bin \
 --libexecdir=/Users/qidizi/q/libexec \
 --sbindir=/Users/qidizi/q/bin \
 --sysconfdir=/Users/qidizi/q/etc  \
 --libdir=/Users/qidizi/q/lib  \
 --includedir=/Users/qidizi/q/include \
 --datarootdir=/Users/qidizi/q/share \
 --enable-debug \
skvadrik commented 5 years ago

@qidizi, thanks for the report! Here is a fix: https://github.com/skvadrik/re2c/commit/e34fe4dde7c37e7bd35da32ad8211995d678552e.

This should fix the build for you. However, I'm curious: what is your bison version? With bison-3.1 on my system, parser tokens are defined as enum members, and not as macros. The fact that you get the above error means that:

The latter is more worrisome, because normally you should not regenerate parser files --- build system uses precompiled files from bootstrap/ subdirectory (unless you touch .ypp files or do make bootstrap intentionally).

qidizi commented 5 years ago
mac:~ qidizi$ tar -xf re2c-1.2.1.tar.xz 
mac:~ qidizi$ cd re2c-1.2.1
mac:re2c-1.2.1 qidizi$ bash configure --prefix=/Users/qidizi/re2c-1.2.1/q   --enable-libs --enable-debug
mac:re2c-1.2.1 qidizi$ make 
mac:re2c-1.2.1 qidizi$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mac:re2c-1.2.1 qidizi$ which bison
/usr/bin/bison

step by up get error

 CXX      src/util/libre2c_la-s_to_n32_unsafe.lo
  CXX      lib/libre2c_la-lex.lo
In file included from ../lib/lex.re:10:
lib/parse.h:49:15: 错误:expected unqualified-id before numeric constant
   49 | #define ERROR 259
      |               ^~~
./src/msg/warn.h:49:27: 附注:in expansion of macro ‘ERROR’
   49 |     static const uint32_t ERROR;
      |                           ^~~~~
make[1]: *** [Makefile:2665: lib/libre2c_la-lex.lo] Error 1
make[1]: Leaving directory '/Users/qidizi/re2c-1.2.1'
make: *** [Makefile:1396: all] Error 2
qidizi commented 5 years ago

update to bison 3.4

mac:re2c-1.2.1 qidizi$ which bison
/Users/qidizi/bin/bison
mac:re2c-1.2.1 qidizi$ bison --version
bison (GNU Bison) 3.4
由 Robert Corbett 和 Richard Stallman 编写。

版权所有 (C) 2019 Free Software Foundation, Inc.
这是自由软件;请参考源代码的版权声明。本软件不提供任何保证,甚至不会包括
可售性或适用于任何特定目的的保证。
this will get ld error : ld: symbol(s) not found for architecture x86_64
rm -rf re2c-1.2.1 && tar -xf re2c-1.2.1.tar.xz && cd re2c-1.2.1 && \
CPPFLAGS="-I/usr/include -I/usr/local/include/ " \
LDFLAGS="-L/usr/lib -L/usr/local/lib" \
bash "/Users/qidizi/re2c-1.2.1/configure" \
--prefix="/Users/qidizi/re2c-1.2.1/q" \
--exec-prefix="/Users/qidizi/re2c-1.2.1/q" \
 --bindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --libexecdir="/Users/qidizi/re2c-1.2.1/q/libexec" \
 --sbindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --sysconfdir="/Users/qidizi/re2c-1.2.1/q/etc"  \
 --libdir="/Users/qidizi/re2c-1.2.1/q/lib"  \
 --includedir="/Users/qidizi/re2c-1.2.1/q/include" \
 --datarootdir="/Users/qidizi/re2c-1.2.1/q/share" \
 --enable-debug --enable-libs \
&& make -j 100

exclude"-L/usr/lib " this will ok only get warning

Warning: Linking the executable bench_libre2c against the loadable module libre2c.bundle is not portable! *** Warning: lib libre2c.bundle is a module, not a shared library

rm -rf re2c-1.2.1 && tar -xf re2c-1.2.1.tar.xz && cd re2c-1.2.1 && \
CPPFLAGS="-I/usr/include -I/usr/local/include/ " \
LDFLAGS="-L/usr/local/lib" \
bash "/Users/qidizi/re2c-1.2.1/configure" \
--prefix="/Users/qidizi/re2c-1.2.1/q" \
--exec-prefix="/Users/qidizi/re2c-1.2.1/q" \
 --bindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --libexecdir="/Users/qidizi/re2c-1.2.1/q/libexec" \
 --sbindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --sysconfdir="/Users/qidizi/re2c-1.2.1/q/etc"  \
 --libdir="/Users/qidizi/re2c-1.2.1/q/lib"  \
 --includedir="/Users/qidizi/re2c-1.2.1/q/include" \
 --datarootdir="/Users/qidizi/re2c-1.2.1/q/share" \
 --enable-debug --enable-libs \
&& make -j 100

error detail

 CXX      src/parse/validate.o
  CXX      src/util/s_to_n32_unsafe.o
  CXX      src/util/temp_file.o
  CXX      src/util/range.o
Reconfigure to rebuild docs: ./configure --enable-docs
  CXXLD    re2c
Undefined symbols for architecture x86_64:
  "std::ctype<char>::_M_widen_init() const", referenced from:
      re2c::Output::emit()    in output.o
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in output.o
      void re2c::strrreplace<char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) in input.o
      void re2c::strrreplace<char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) in lex.o
      ...
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const", referenced from:
      re2c::warn_nullable(re2c::RESpec const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in nullable.o
      re2c::Input::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) in input.o
      re2c::normalize_ast(std::vector<re2c::spec_t, std::allocator<re2c::spec_t> >&) in normalize.o
      re2c::validate_ast(std::vector<re2c::spec_t, std::allocator<re2c::spec_t> > const&, re2c::opt_t const*, re2c::Msg&) in validate.o
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::flushln(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      ...
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)", referenced from:
      re2c::CpgotoTable::emit(re2c::Output&, unsigned int) const in go_emit.o
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)", referenced from:
      re2c::get_dir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in get_dir.o
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)", referenced from:
      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in input_api.o
      re2c::emit_start(re2c::Output&, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool, bool, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, re2c::bitmaps_t&) in generate_code.o
      re2c::Input::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) in input.o
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)", referenced from:
      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      re2c::gen_settags(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::DFA const&, unsigned int, re2c::opt_t const*) in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) in emit_action.o
      re2c::output_skip(std::basic_ostream<char, std::char_traits<char> >&, unsigned int, re2c::opt_t const*) in input_api.o
      re2c::output_backup(std::basic_ostream<char, std::char_traits<char> >&, unsigned int, re2c::opt_t const*) in input_api.o
      ...
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      re2c::need(re2c::Output&, unsigned int, unsigned long) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::flushln(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_range_insert<std::reverse_iterator<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >(__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::reverse_iterator<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::reverse_iterator<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::forward_iterator_tag) in emit_action.o
      ...
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)", referenced from:
      re2c::mutopt_t::mutopt_t() in main.o
      _main in main.o
      void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) in emit_action.o
      void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) in emit_dfa.o
      void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) in go_construct.o
      re2c::output_hgo(re2c::Output&, unsigned int, re2c::DFA const&, re2c::SwitchIf*, re2c::State const*) in go_emit.o
      void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) in input_api.o
      ...
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)", referenced from:
      re2c::conopt_t::fix()    in opt.o
      re2c::Scanner::lex_conf_string[abi:cxx11]() in lex_conf.o
  "std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned long, unsigned long)", referenced from:
      re2c::flushln(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&) in emit_action.o
  "std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) [clone .cold] in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) [clone .cold] in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      re2c::vartag_name(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) [clone .cold] in emit_dfa.o
      ...
  "std::__throw_out_of_range_fmt(char const*, ...)", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in output.o
      void re2c::strrreplace<char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) in input.o
      void re2c::strrreplace<char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) in lex.o
      ...
  "VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      re2c::vartag_name(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      ...
  "vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >", referenced from:
      std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf() in emit_action.o
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) in emit_action.o
      std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf() in emit_dfa.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >", referenced from:
      void re2c::strrreplace<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&) in emit_action.o
      void re2c::strrreplace<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long const&) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_action.o
      re2c::tagname[abi:cxx11](re2c::Tag const&) in emit_action.o
      re2c::gen_goto(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, re2c::State const*, re2c::State const*, re2c::DFA const&, unsigned int, re2c::opt_t const*, bool, bool, unsigned int) in emit_action.o
      void re2c::strrreplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      re2c::vartag_name(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in emit_dfa.o
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1971: re2c] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/Users/qidizi/re2c-1.2.1'
make: *** [Makefile:1396: all] Error 2
make 出错

configure output

#######################################################################################################################

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for re2/re2.h... no
checking for bison... /Users/qidizi/bin/bison
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking C++ compiler flag -std=c++98... yes
checking C++ compiler flag -W... yes
checking C++ compiler flag -Wall... yes
checking C++ compiler flag -Wextra... yes
checking C++ compiler flag -Weffc++... yes
checking C++ compiler flag -pedantic... yes
checking C++ compiler flag -Wformat=2... yes
checking C++ compiler flag -Wredundant-decls... yes
checking C++ compiler flag -Wsuggest-attribute=format... yes
checking C++ compiler flag -Wconversion... yes
checking C++ compiler flag -Wsign-conversion... yes
checking C++ compiler flag -Werror=return-type... yes
checking C++ compiler flag -O2... yes
checking C++ compiler flag -Weverything... no
checking for stdint.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for io.h... no
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64... 0
checking size of void *... 8
checking size of 0l... 8
checking size of 0ll... 8
checking size of 0i8... 0
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... x86_64-apple-darwin18.7.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin18.7.0 file names to x86_64-apple-darwin18.7.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin18.7.0 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin18.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... yes
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin18.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/manpage.rst
config.status: creating doc/help.rst
config.status: creating run_tests.sh
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
配置成功,回车开始 make ...
skvadrik commented 5 years ago

@qidizi Could you downgrade bison back to 2.3 and build re2c from source? Commit https://github.com/skvadrik/re2c/commit/e34fe4dde7c37e7bd35da32ad8211995d678552e should fix the original build error. Instructions for building from source:

git clone https://github.com/skvadrik/re2c.git
cd re2c
./autogen.sh
mkdir builddir && cd builddir
../configure --enable-debug --enable-libs [...]
make

The error with bison-3.4 looks like an ABI incompatibility with old Glibc that doesn't have C++11 ABI (although I'm not sure why updating Bison triggered it, as only the autogenerated files are used). You can try passing CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" to configure and rebuilding from scratch. Eventually maybe you could update Glibc (and the rest of the system) to C++11 ABI.

skvadrik commented 5 years ago

For reference, _GLIBCXX_USE_CXX11_ABI documentation:

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.

What is your GCC version?

qidizi commented 5 years ago
mac:~ qidizi$ git clone git@github.com:skvadrik/re2c.git
Cloning into 're2c'...
remote: Enumerating objects: 283, done.
remote: Counting objects: 100% (283/283), done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 34262 (delta 97), reused 213 (delta 79), pack-reused 33979
Receiving objects: 100% (34262/34262), 77.97 MiB | 291.00 KiB/s, done.
Resolving deltas: 100% (25811/25811), done.
mac:~ qidizi$ 

@qidizi Could you downgrade bison back to 2.3 and build re2c from source? Commit e34fe4d should fix the original build error. Instructions for building from source:

git clone https://github.com/skvadrik/re2c.git
cd re2c
./autogen.sh
mkdir builddir && cd builddir
../configure --enable-debug --enable-libs [...]
make

The error with bison-3.4 looks like an ABI incompatibility with old Glibc that doesn't have C++11 ABI (although I'm not sure why updating Bison triggered it, as only the autogenerated files are used). You can try passing CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" to configure and rebuilding from scratch. Eventually maybe you could update Glibc (and the rest of the system) to C++11 ABI.

wait for moment

qidizi commented 5 years ago

For reference, _GLIBCXX_USE_CXX11_ABI documentation:

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.

What is your GCC version?

mac:re2c qidizi$ gcc --version gcc (GCC) 9.2.0 Copyright © 2019 Free Software Foundation, Inc. 本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保; 包括没有适销性和某一专用目的下的适用性担保。

qidizi commented 5 years ago

@qidizi Could you downgrade bison back to 2.3 and build re2c from source? Commit e34fe4d should fix the original build error. Instructions for building from source:

git clone https://github.com/skvadrik/re2c.git
cd re2c
./autogen.sh
mkdir builddir && cd builddir
../configure --enable-debug --enable-libs [...]
make

The error with bison-3.4 looks like an ABI incompatibility with old Glibc that doesn't have C++11 ABI (although I'm not sure why updating Bison triggered it, as only the autogenerated files are used). You can try passing CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" to configure and rebuilding from scratch. Eventually maybe you could update Glibc (and the rest of the system) to C++11 ABI.

configure with CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0,but get error :

  CXX      src/util/temp_file.o
  CXX      src/util/range.o
Reconfigure to rebuild docs: ./configure --enable-docs
  CXXLD    re2c
Undefined symbols for architecture x86_64:
  "std::ctype<char>::_M_widen_init() const", referenced from:
      re2c::Output::emit()    in output.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1971: re2c] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/Users/qidizi/re2c-1.2.1'
make: *** [Makefile:1396: all] Error 2
make 出错
 CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
CPPFLAGS="-I/usr/include -I/usr/local/include/ " \
LDFLAGS="-L/usr/local/lib -L/usr/lib" \
bash "/Users/qidizi/re2c-1.2.1/configure" \
--prefix="/Users/qidizi/re2c-1.2.1/q" \
--exec-prefix="/Users/qidizi/re2c-1.2.1/q" \
 --bindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --libexecdir="/Users/qidizi/re2c-1.2.1/q/libexec" \
 --sbindir="/Users/qidizi/re2c-1.2.1/q/bin" \
 --sysconfdir="/Users/qidizi/re2c-1.2.1/q/etc"  \
 --libdir="/Users/qidizi/re2c-1.2.1/q/lib"  \
 --includedir="/Users/qidizi/re2c-1.2.1/q/include" \
 --datarootdir="/Users/qidizi/re2c-1.2.1/q/share" \
 --enable-debug --enable-libs
skvadrik commented 5 years ago

As a temporary workaround, you could drop --enable-libs in configure (it won't cut off any re2c functionality).

Also, could you please post the output of make V=1. And to correct my previous post, could you use CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0" (to avoid dropping other flags).

qidizi commented 5 years ago

@qidizi Could you downgrade bison back to 2.3 and build re2c from source? Commit e34fe4d should fix the original build error. Instructions for building from source:

git clone https://github.com/skvadrik/re2c.git
cd re2c
./autogen.sh
mkdir builddir && cd builddir
../configure --enable-debug --enable-libs [...]
make

The error with bison-3.4 looks like an ABI incompatibility with old Glibc that doesn't have C++11 ABI (although I'm not sure why updating Bison triggered it, as only the autogenerated files are used). You can try passing CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" to configure and rebuilding from scratch. Eventually maybe you could update Glibc (and the rest of the system) to C++11 ABI.

rollback bison 2.3 + Commit [e34fe4d] is success

git pull is update day:

mac:build qidizi$ git log
commit e34fe4dde7c37e7bd35da32ad8211995d678552e (HEAD -> master, origin/master, origin/HEAD)
Author: Ulya Trofimovich <skvadrik@gmail.com>
Date:   Thu Aug 29 22:27:01 2019 +0100

    libre2c: added prefix 'TOKEN_' to all parser tokens to avoid name collisions.

    Apparently some versions of bison generate token definitions as macros, not
    as enum members. If a bison-generated header is included into another file
    that contains identifiers identical to the names of parser tokens, all such
    identifiers are macro-substituted to a numeric constant. Adding a prefix to
    token names reduces the chances of name collision.

    This fixes bug #261: "lib/parse.h:49:15: 错误:expected unqualified-id before
    numeric constant" reported by qidizi.

bison is 2.3


mac:build qidizi$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure by:

mac:re2c qidizi$ mkdir build
mac:re2c qidizi$ cd build/
mac:build qidizi$ bash ../configure  --enable-debug --enable-libs 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ../install-sh -c -d
...

make success


 CXX      lib/libre2c_la-regfree.lo
  CXX      lib/libre2c_la-stubs.lo
Reconfigure to rebuild docs: ./configure --enable-docs
  CXXLD    re2c
  CXXLD    libre2c.la
  CXXLD    bench_libre2c

*** Warning: Linking the executable bench_libre2c against the loadable module
*** libre2c.so is not portable!
*** Warning: lib libre2c.so is a module, not a shared library
make[1]: Leaving directory '/Users/qidizi/re2c/build'
qidizi commented 5 years ago

As a temporary workaround, you could drop --enable-libs in configure (it won't cut off any re2c functionality).

Also, could you please post the output of make V=1. And to correct my previous post, could you use CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0" (to avoid dropping other flags).

about #####this will get ld error : ld: symbol(s) not found for architecture x86_64###, maybe i build on a mix+confusion ENV,like bin,incluce,lib;
before i build re2c,i build every soft use --prefix=/Users/qidizi/q,so i can make the error; now,i delete all file on /Users/qidizi/q ,then rebuild every soft use --prefix=/Users/qidizi/the_soft_dir_name/q,and then to build re2c(git clone or download release) never trigger this error --- mini depends for configure;

so, i do't know what is wrong; let us foget it;

skvadrik commented 5 years ago

so, i do't know what is wrong; let us foget it;

Ok! Next time I suggest we change one thing at a time and test it --- this way it is usually easier to debug failures.