centos7下安装flex,bison
生活随笔
收集整理的這篇文章主要介紹了
centos7下安装flex,bison
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
centos7下安裝flex,bison
1,修改鏡像源為國內鏡像源,比如阿里云
(1)首先備份系統自帶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.repo2,安裝flex,bison
[root@fengyi flex]# yum install flex bison3,問題:
(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包是包含了動態庫,不包含動態庫的頭文件,基于flex的應用程序為基礎開發,flex可以正常使用;但是,如果使用flex庫里面的源代碼,則會導致找不到flex庫的問題;
解決方案:
flex-devel包包含了這個包程序開發所有必須的文件,比如頭文件、動態庫等,安裝flex-devel包可以調用flex庫代碼開發;
安裝flex-devel
4,package和package-devel的區別
(1)普通package
通常只包含能讓程序運行的動態庫和配置文件,可以基于package的應用程序開發,不能基于源碼開發;
(2)package-devel
帶devel后綴的package,則包含使用這個package開發程序的所有的必需文件。比如頭文件,等等。有時devel package還包含靜態庫。
以下package-devel包回答,摘自上述網址:
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).總結
以上是生活随笔為你收集整理的centos7下安装flex,bison的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pc机属于模拟专用微型计算机,《春11计
- 下一篇: 贷