Tuesday, March 15, 2022

[SOLVED] cant find libl on centos 9 - /usr/bin/ld: cannot find -ll

Issue

Brand new install of centos 9. (mostly minimal)

I did a find and there is no libl.so on my machine.

sudo yum install bison Last metadata expiration check: 1:52:29 ago on Wed 23 Feb 2022 01:25:31 PM EST. Package bison-3.7.4-5.el9.x86_64 is already installed.

sudo yum install flex Last metadata expiration check: 1:52:25 ago on Wed 23 Feb 2022 01:25:31 PM EST. Package flex-2.6.4-9.el9.x86_64 is already installed.

sudo yum install flex-devel Last metadata expiration check: 1:52:35 ago on Wed 23 Feb 2022 01:25:31 PM EST. No match for argument: flex-devel

I tried installing sudo yum groupinstall 'Development Tools'

nothing works, any ideas?


Solution

The static libraries (libfl.a and libl.a), which is what were provided before in the package flex-devel, have been moved to the package libfl-static. I don't know if RedHat ever provided shared objects; there's a note in the libfl-static ChangeLog that seems to be saying that there is a new package called libfl2 with shared objects, but I don't see it in the package repo. Anyway, static libraries should be fine. There's hardly anything there.

If you're using libl, that means that:

  • you aren't using %option noyywrap, which will remove the call to yywrap (and if you're using the version of yywrap in libl, then you don't need it to call the function, since that version unconditionally returns 1), and/or
  • you haven't provided your own main function.

I strongly recommend including the following options in all flex files, unless you have a clear need for the suppressed features:

%option noinput nounput noyywrap nodefault

The main function in libl is also trivial. It can be replaced with:

int main(void) {
  while (yylex() != 0) { }
  return 0;
}


Answered By - rici
Answer Checked By - Candace Johnson (WPSolving Volunteer)