簡體   English   中英

linux flex gcc編譯失敗,帶有對TclReError的未定義引用

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

我在從源代碼編譯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時,不會產生任何錯誤,並且日志中不會顯示任何內容,但是make會引發錯誤

     /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 --help中,未引用顯式標志

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"直接export CPPFLAGS="-I/home/mybin/include"

在SO和Google上進行的擴展搜索已返回明顯提示,關於我所缺少的內容是否有任何指示?

您將它們設置為環境變量; configure通過檢查配置文件和環境來確定LDFLAGSCPPFLAGS 您可以這樣嘗試。

  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

請嘗試這個...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM