简体   繁体   English

在 centos 上找不到 libl 9 - /usr/bin/ld: 找不到 -ll

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

Brand new install of centos 9. (mostly minimal) centos 9 的全新安装。(大部分是最小的)

I did a find and there is no libl.so on my machine.我做了一个发现,我的机器上没有 libl.so。

sudo yum install bison Last metadata expiration check: 1:52:29 ago on Wed 23 Feb 2022 01:25:31 PM EST. sudo yum install bison 上次元数据过期检查:1:52:29 前,美国东部时间 2022 年 2 月 23 日星期三 01:25:31 PM。 Package bison-3.7.4-5.el9.x86_64 is already installed. Package bison-3.7.4-5.el9.x86_64 已经安装。

sudo yum install flex Last metadata expiration check: 1:52:25 ago on Wed 23 Feb 2022 01:25:31 PM EST. sudo yum install flex 最后一次元数据过期检查:1:52:25 前,美国东部时间 2022 年 2 月 23 日星期三 01:25:31 PM。 Package flex-2.6.4-9.el9.x86_64 is already installed. Package flex-2.6.4-9.el9.x86_64 已经安装。

sudo yum install flex-devel Last metadata expiration check: 1:52:35 ago on Wed 23 Feb 2022 01:25:31 PM EST. sudo yum install flex-devel 最后一次元数据过期检查:1:52:35 前,美国东部时间 2022 年 2 月 23 日星期三下午 01:25:31。 No match for argument: flex-devel参数不匹配:flex-devel

I tried installing sudo yum groupinstall 'Development Tools'我尝试安装 sudo yum groupinstall 'Development Tools'

nothing works, any ideas?没有任何效果,有什么想法吗?

As you pointed out in the question - flex-devel is not found.正如您在问题中指出的那样 - 未找到flex-devel

It's in the PowerTools repo.它在PowerTools库中。

The 'official' way to enable the repo is to use the yum config-manager command line:启用 repo 的“官方”方法是使用 yum config-manager 命令行:

yum config-manager --set-enabled powertools

This may give an error about being missing the config-manager command:这可能会导致缺少config-manager命令的错误:

No such command: config-manager

If this happens, then you can install the dnf-plugins-core package:如果发生这种情况,那么您可以安装 dnf-plugins-core package:

yum install -y dnf-plugins-core

and then enable the powertools repo, and then you should be able to yum install flex-devel , which provides:然后启用 powertools repo,然后你应该能够yum install flex-devel ,它提供:

$ rpmquery --list flex-devel
/usr/lib64/libfl.a
/usr/lib64/libfl_pic.a
/usr/lib64/libl.a
/usr/share/doc/flex
/usr/share/licenses/flex-devel
/usr/share/licenses/flex-devel/COPYING

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 .之前在 package flex-devel中提供的 static 库( libfl.alibl.a )已移至 package libfl-static I don't know if RedHat ever provided shared objects;我不知道 RedHat 是否提供过共享对象; 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. libfl-static ChangeLog 中有一条注释似乎在说有一个名为libfl2的新 package 具有共享对象,但我在 package 存储库中没有看到它。 Anyway, static libraries should be fine.反正static库应该没问题。 There's hardly anything there.那里几乎什么都没有。

If you're using libl , that means that:如果您使用的是libl ,则意味着:

  • 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你没有使用%option noyywrap ,这将删除对yywrap的调用(如果你在libl中使用yywrap的版本,那么你不需要它来调用 function,因为该版本无条件返回 1),和/或
  • you haven't provided your own main function.您还没有提供自己的main function。

I strongly recommend including the following options in all flex files, unless you have a clear need for the suppressed features:我强烈建议在所有 flex 文件中包含以下选项,除非您明确需要被抑制的功能:

%option noinput nounput noyywrap nodefault

The main function in libl is also trivial. liblmain的function也是微不足道的。 It can be replaced with:它可以替换为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM