日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos7下安装flex,bison

發(fā)布時間:2024/1/8 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7下安装flex,bison 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

centos7下安裝flex,bison

1,修改鏡像源為國內(nèi)鏡像源,比如阿里云

(1)首先備份系統(tǒng)自帶yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

[root@fengyi flex]# cp /etc/yum.repos.d/CentOS-Base.repo /home/fengyi/Destop

(2)進入yum源配置文件所在的文件夾

[root@fengyi flex]# cd /etc/yum.repos.d/

(3)下載阿里云源文件作為新的yum源配置文件

[root@fengyi yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

2,安裝flex,bison

[root@fengyi flex]# yum install flex bison

3,問題:

(1)flex安裝后可以使用,但是鏈接flex庫時,-lfl找不到flex庫

[root@fengyi flex]# gcc lex.yy.c -o analyze -lfl /usr/bin/ld: cannot find -lfl collect2: error: ld returned 1 exit status

問題分析:
flex包是包含了動態(tài)庫,不包含動態(tài)庫的頭文件,基于flex的應(yīng)用程序為基礎(chǔ)開發(fā),flex可以正常使用;但是,如果使用flex庫里面的源代碼,則會導(dǎo)致找不到flex庫的問題;

解決方案:
flex-devel包包含了這個包程序開發(fā)所有必須的文件,比如頭文件、動態(tài)庫等,安裝flex-devel包可以調(diào)用flex庫代碼開發(fā);
安裝flex-devel

[root@fengyi flex]# yum install flex-devel

4,package和package-devel的區(qū)別

(1)普通package
通常只包含能讓程序運行的動態(tài)庫和配置文件,可以基于package的應(yīng)用程序開發(fā),不能基于源碼開發(fā);
(2)package-devel
帶devel后綴的package,則包含使用這個package開發(fā)程序的所有的必需文件。比如頭文件,等等。有時devel package還包含靜態(tài)庫。

// package-devel包說明介紹鏈接 https://stackoverflow.com/questions/2358801/what-are-devel-packages

以下package-devel包回答,摘自上述網(wǎng)址:

The *-devel packages (usually called *-dev in Debian-based distributions) are usually all the files necessary to compile code against a given library.For running an application using the library libfoo only the actualy shared library file (*.so.*, for example libfoo.so.1.0) are needed (plus possibly some data files and some version-specific symlinks).When you actually want to compile a C application that uses that library you'll need the header files (*.h, for example foo.h) that describe the interface of that application as well as a version-less symlink to the shared library (*.so, for example libfoo.so -> libfoo.so.1.0). Those are usually bundled in the *-devel packages.Sometimes the *-devel packages also include statically compiled versions of the libraries (*.a, for example libfoo.a) in case you want to build a complete stand-alone application that doesn't depend on dynamic libraries at all.Other languages (such as Java, Python, ...) use a different way of noting the API of a library (effectively including all the necessary information in the actual library) and thus usually need no separate *-devel packages (except maybe for documentation and additional tools).

總結(jié)

以上是生活随笔為你收集整理的centos7下安装flex,bison的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。