Linux Flex gcc 编译失败,并显示"未定义对 'TclReError'的引用"

linux flex gcc compile fails with `undefined reference to `TclReError'`

本文关键字:Flex gcc TclReError 引用 编译 显示 Linux 未定义 失败      更新时间:2023-10-16

我遇到了一些问题,这些问题是从源中编译Flex的。配置正在传递 CC=/home/mybin/bin/gcc CPPFLAGS=-I/home/mybin/include LDFLAGS=-L/home/mybin/lib

内在../include我有两个包含参考的文件

regex.h:110:#define regerror    TclReError
regcustom.h:78:#define  regerror    TclReError

运行config时,不会产生错误,也没有对日志感兴趣,但是抛出错误

     /bin/sh ../libtool  --tag=CC   --mode=link /home/mybin/bin/gcc  -g -O2  -L/home/mybin/lib -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o ../lib/libcompat.la -lm 
libtool: link: /home/mybin/bin/gcc -g -O2 -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o  -L/home/_bin/lib ../lib/.libs/libcompat.a -lm
regex.o: In function `flex_regcomp':
/home/tmp/flex-2.6.0/src/regex.c:66: undefined reference to `TclReError'
collect2: error: ld returned 1 exit status
make[2]: *** [flex] Error 1

在configure--螺旋中没有提及明确标志

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  LT_SYS_LIBRARY_PATH
              User-defined run-time library search path.
  CPP         C preprocessor
  YACC        The `Yet Another Compiler Compiler' implementation to use.
              Defaults to the first program found out of: `bison -y', `byacc',
              `yacc'.
  YFLAGS      The list of arguments that will be passed by default to $YACC.
              This script will default YFLAGS to the empty string to avoid a
              default value of `-d' given by some make applications.
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor

我也尝试直接用export CPPFLAGS="-I/home/mybin/include"

导出

SO的扩展搜索和Google已返回,注意到了我所缺少的任何建议?

您将它们设置为环境变量;配置确定 LDFLAGS cppflags 通过检查配置文件和环境。您可以尝试这样的尝试。

  export CPPFLAGS='-I/home/mybin/include'
  export LDFLAGS='-L/home/mybin/lib'
  ./configure

或单线:

 env CPPFLAGS='-I/home/mybin/include' LDFLAGS='-L/home/mybin/lib' ./configure

请尝试...