Issue
I can work using lex like below:
lex my.l && gcc lex.yy.c -ll
No problem, it works. From gcc link option, I guess there's a library named libl.so which indicates lex runtime library.
cd /
find ./ -name "libl.so"
But I don't get any find result. So is there really a library called libl.so? What's the realy library name used by gcc to link with lex?
Solution
It depends on how you installed (f)lex; the library might be an archive rather than a shared object (i.e. libl.a
). Flex usually also provides libfl.a
and libfl.so
If you have a debian or ubuntu system, the (f)lex libraries are in the libfl-dev
package, which (on an x86_64 platform) includes the following libraries:
/usr/lib/x86_64-linux-gnu/libfl.a
/usr/lib/x86_64-linux-gnu/libfl_pic.a
/usr/lib/x86_64-linux-gnu/libfl.so
/usr/lib/x86_64-linux-gnu/libl.a
as well as some other files.
Answered By - rici Answer Checked By - Willingham (WPSolving Volunteer)