如何修复缺失的ld库的-lfl编译时? [英] How to fix a missing ld library for -lfl while compiling?
问题描述
我尝试将我的 .spl
文件转换为C文件(因为没有编译器)。我有一个示例Hello World.spl文件,我已下载莎士比亚编程语言 .tar
并提取它,但我不知道接下来要做什么。我似乎不能在任何文档中找到说明。任何人都可以帮忙?
编辑:
当我输入 make -fMakefile
,我得到以下输出:
bison --verbose -d grammar.y
gcc -O2 -Wall -c grammar.tab.c
gcc -O2 -Wall -c makescanner.c
gcc makescanner.o -O2 -Wall -o makescanner
./makescanner include> scanner.l
flex -Cem -t scanner.l> scanner.c
scanner.l:600:warning,规则不能匹配
gcc -O2 -Wall -c scanner.c
< stdout>:5823:warning:'yyunput'但未使用
gcc -O2 -Wall -c strutils.c
gcc grammar.tab.o scanner.o strutils.o -O2 -Wall -lfl -o spl2c
ld:library not找到-lfl
collect2:ld退回1退出状态
make:*** [spl2c]错误1
错误:
ld :没有为-lfl
找到的库未找到库意味着您缺少的库是< a href =https://en.wikipedia.org/wiki/Flex_(lexical_analyser_generator) =nofollow> flex library 。
检查您是否已经安装了flex库,可以使用locate:
找到libfl.a
OSX
没有它,您可以安装install flex(如果您使用 brew ):
brew install flex
如果仍然有问题,您可以尝试在make期间手动传递以下变量,例如:
LDFLAGS = - L / usr / local / Cellar / flex / * / libCPPFLAGS = - I / usr / local / Cellar / flex / * / includemake -fMakefile
pre>
或:
MAKEFLAGS = - j8 -L / usr / local / Cellar / flex / * / lib -I / usr / local / Cellar / flex / * / includemake -fMakefile
最终通过修改
DYLD_FALLBACK_LIBRARY_PATH
环境来创建
。
通过执行
brew --env
传递。
注意:确保您将根据您的环境。
相关:
Linux
在大多数流行的Linux发行版上,您可以通过以下方式安装:
apt-get install flex
相关:
OS X(Homebrew)
或者使用Homebrew安装莎士比亚:
brew install shakespeare -v
>
I am trying to translate my .spl
file into a C file (because there is no compiler). I have an example "Hello World" .spl file, and I have downloaded the Shakespeare Programming Language .tar
and extracted it, but I have no idea what to do next. I can't seem to find instructions in any documentation. Can anyone help?
Edit:
When I type make -f "Makefile"
, I get the following output:
bison --verbose -d grammar.y
gcc -O2 -Wall -c grammar.tab.c
gcc -O2 -Wall -c makescanner.c
gcc makescanner.o -O2 -Wall -o makescanner
./makescanner include > scanner.l
flex -Cem -t scanner.l > scanner.c
scanner.l:600: warning, rule cannot be matched
gcc -O2 -Wall -c scanner.c
<stdout>:5823: warning: ‘yyunput’ defined but not used
gcc -O2 -Wall -c strutils.c
gcc grammar.tab.o scanner.o strutils.o -O2 -Wall -lfl -o spl2c
ld: library not found for -lfl
collect2: ld returned 1 exit status
make: *** [spl2c] Error 1
The error:
ld: library not found for -lfl
means that you've missing the library which is part of flex library.
To check if you've already flex library installed, you can look after it using locate:
locate libfl.a
OSX
If you don't have it, you can install install flex (if you're using brew):
brew install flex
If you still having the problems, you may try to pass the following variables manually during make, e.g.:
LDFLAGS="-L/usr/local/Cellar/flex/*/lib" CPPFLAGS="-I/usr/local/Cellar/flex/*/include" make -f "Makefile"
or:
MAKEFLAGS="-j8 -L/usr/local/Cellar/flex/*/lib -I/usr/local/Cellar/flex/*/include" make -f "Makefile"
eventually by modifying DYLD_FALLBACK_LIBRARY_PATH
environment.
You can see which environment were passed by executing brew --env
.
Note: Make sure that you'll change the paths according to your environment.
Related:
Linux
On most popular Linux distributions, you can install it by:
apt-get install flex
Related:
OS X (Homebrew)
Alternatively use Homebrew to install Shakespeare:
brew install shakespeare -v
Which should detect all your dependencies.
这篇关于如何修复缺失的ld库的-lfl编译时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!