Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have downloaded and compiled the current flex, version 2.6.0.
I have installed in on an alternate folder, using a prefix passed to the configure script: /home/me/local.
Although the flex documentation I have read did not say it, I have changed my bashrc to add the lib subfolder where flex is installed: /home/me/local/lib/. Before doing this, the same problem happened, and I thought this could fix it.
Now I'll paste some terminal lines that speak well enough:
Code:
$ echo $LD_LIBRARY_PATH
/home/me/local/lib
$ flex --version
flex 2.6.0
$ cat fb1-1.l
/* fb1-1 just like unix wc */
/* the "%option noyywrap" was added to fix the error, but it just changed it. The LD error is kept. */
%{
int chars = 0;
int words = 0;
int lines = 0;
%}
%option noyywrap
%%
[a-zA-Z]+ { words++; chars += strlen(yytext); }
\n { chars++; lines++; }
. { chars++; }
%%
int main()
{
yylex();
printf("%8d%8d%8d\n", lines, words, chars);
return 0;
}
$ flex fb1-1.l
$ # this is a wrong gcc compilation, we must link the file with flex library
$ gcc -Wall lex.yy.c
lex.yy.c:1104: warning: ‘yyunput’ defined but not used
lex.yy.c:1149: warning: ‘input’ defined but not used
$ # but it worked?!
$ # now the right one, like the book instructs to do
$ gcc lex.yy.c -lfl
lex.yy.c:1104: warning: ‘yyunput’ defined but not used
lex.yy.c:1149: warning: ‘input’ defined but not used
/usr/bin/ld: cannot find -lfl
collect2: ld returned 1 exit status
$ # the installed flex libraries?
$ 'ls' /home/me/local/lib
libfl.a libfl_pic.la libfl_pic.so.2.0.0 libfl.so.2.0.0
libfl.la libfl_pic.so libfl.so liby.a
libfl_pic.a libfl_pic.so.2 libfl.so.2
How can make this library folder exist for flex, gcc and LD?
The option to compile and install from source must work (given some dependencies, for some), independently of the package being available or not on the OS. It is not magic (usually... hehe). And I like it.
There is a Debian, an Ubuntu (not current), and possibly a Mint will exist too. I prefer the Debian family members, but sometimes I have to use others.
When installing libs to non standard places you need to add that path to /etc/ld.so.conf, then run ldconfig ( all as root of course ).
Really? That's another option? :-/ As a developer, it is not so unusual that sometimes I use machines without root access (root tasks are slower, depends on others and I'm not allowed to do it).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.