Install Bison Flex Cygwin
- Install Bison Flex Cygwin X
- Install Bison Flex Cygwin Pro
- Install Bison Flex Cygwin Download
- Install Bison Flex Cygwin 2
- Install Bison Flex Cygwin 8
Installing LEX/YACC or flex/bison on Windows, Visual C 2008. You should be able to get flex and bison as part of cygwin, then reference them in visual studio. Here is an example of how to use bison and flex (yacc and lex)with cygwin on windowsxp. Go to install Cygwin including bison 2.
Difficulty level |
---|
Beginner |
This video demonstrates how to build and install Bison, Flex, Cygwin on Windows for use with Visual C.You can download manuscript for this video athttp://w. Bison is only needed on systems that are used for development. If your system will be used for C development, you should install Bison. The package contains also the -ly library sometimes used by programs using Bison-generated parsers. If you are developing programs using Bison, you might want to link with this library. Instruction for flex & bison in Debian Linux (Ubuntu/Linux Mint) PRE-REQUISITE (A) Install flex from terminal: sudo apt-get install flex (B) Install bison from terminal: sudo apt-get install bison.
Note that this article is meant to be included into the GCC Cross-Compiler and Building GCC as they share this common section.
The GNU Compiler Collection is an advanced piece of software with dependencies. You need the following in order to build GCC:
- A Unix-like environment (Windows users can use the Windows Subsystem for Linux or Cygwin)
- Enough memory and hard disk space (it depends, 256 MiB will not be enough).
- GCC (existing release you wish to replace), or another system C compiler
- G++ (if building a version of GCC >= 4.8.0), or another system C++ compiler
- Make
- Bison
- Flex
- GMP
- MPFR
- MPC
- Texinfo
- ISL (optional)
- CLooG (optional)
Installing Dependencies
↓ Dependency / OS → | Source Code | Debian (Ubuntu, Mint, WSL, ...) | Gentoo | Fedora | Cygwin | OpenBSD | Arch |
---|---|---|---|---|---|---|---|
How to install | Normally | sudo apt installfoo | sudo emerge --askfoo | sudo dnf installfoo | Cygwin GUI setup | doas pkg_addfoo | pacman -Syufoo |
Compiler | N/A | build-essential | sys-devel/gcc | gcc gcc-c++ | mingw64-x86_64-gcc-g++ / mingw64-i686-gcc-g++ | Preinstalled | base-devel |
Make | N/A | build-essential | sys-devel/make | make | make | Preinstalled | base-devel |
Bison | [1] | bison | sys-devel/bison | bison | bison | ? | base-devel |
Flex | [2] | flex | sys-devel/flex | flex | flex | ? | base-devel |
GMP | [3] | libgmp3-dev | dev-libs/gmp | gmp-devel | libgmp-devel | gmp | gmp |
MPC | [4] | libmpc-dev | dev-libs/mpc | libmpc-devel | libmpc-devel | libmpc | libmpc |
MPFR | [5] | libmpfr-dev | dev-libs/mpfr | mpfr-devel | libmpfr-devel | mpfr | mpfr |
Texinfo | [6] | texinfo | sys-apps/texinfo | texinfo | texinfo | texinfo | base-devel |
CLooG (Optional) | CLooG | libcloog-isl-dev | dev-libs/cloog | cloog-devel | libcloog-isl-devel | N/A | N/A |
ISL (Optional) | [7] | libisl-dev | dev-libs/isl | isl-devel | libisl-devel | N/A | N/A |
You need to have Texinfo installed to build Binutils. You need to have GMP, MPC, and MPFR installed to build GCC. GCC optionally can make use of the CLooG and ISL libraries.
For instance, you can install libgmp3-dev on Debian by running the shell command: sudo apt install libgmp3-dev
Note: Version 5.x (or later) of Texinfo is known to be incompatible with the current Binutils 2.23.2 release (and older). You can check your current version using makeinfo --version. If your version is too new and you encounter problems during the build, you will need to either use Binutils 2.24 release (or newer) or install an older version of Texinfo - perhaps through building from source - and add it to your PATH prior and during the Binutils build.
Note: Version 0.13 (or later) of ISL is incompatible with the current CLooG 0.18.1 release (and older). Use version 0.12.2 of ISL or the build will fail.
Downloading the Source Code
Download the needed source code into a suitable directory such as $HOME/src:
- You can download the desired Binutils release by visiting the Binutils website or directly accessing the GNU main mirror.
- You can download the desired GCC release by visiting the GCC website or directly accessing the GNU main mirror.
Install Bison Flex Cygwin X
Note: The versioning scheme used is that each fullstop separates a full number, i.e. Binutils 2.20.0 is newer than 2.9.0. This may be confusing, if you have not encountered this (quite common) versioning scheme yet, when looking at an alphanumerically sorted list of tarballs: The file at the bottom of the list is not the latest version! An easy way of getting the latest version is to sort by the last modified date and scrolling to the bottom.
Linux Users building a System Compiler
Your distribution may ship its own patched GCC and Binutils that is customized to work on your particular Linux distribution. You should be able to build a working cross-compiler using the above source code, but you might not be able to build a new system compiler for your current Linux distribution. In that case, try a newer GCC release or get the patched source code.
Gentoo Users
Install Bison Flex Cygwin Pro
Gentoo offers crossdev to set up a cross-development toolchain:
This will install a GCC cross-compiler into a 'slot', i.e. alongside already-existing compiler versions. You can install several cross-compilers that way, simply by changing target designations. An unfortunate downside is that it will also pull in gentoo patches and pass additional configure options that differ from the official GCC Cross-Compiler setup, and they might behave differently.
After the compilation finishes successfully, your cross-compiler is callable via <target>-gcc. You can also use gcc-config to toggle between compiler versions should you need to do so. Don't replace your system compiler with a cross-compiler. The package manager will also suggest updates as soon as they become available.
You can uninstall the cross-compiler by calling crossdev --clean <target>. Read the cross-development document for additional information.
Note that the version numbers to binutils and gcc are Gentoo package versions, i.e. there might be a suffix to the 'official' (GNU) version that addresses additional patchsets supplied by the Gentoo maintainers. (For example, --binutils 2.24-r3 --gcc 4.8.3 is the latest stable package pair at the time of this writing.) You can omit the version numbers to use the latest package available.
Portage uses overlays to store packages that are not part of the original package management. Crossdev needs one overlay where it can store its binutils and gcc packages before building them. You can configure one properly, or you can use PORTDIR_OVERLAY to point at where it should keep its package manager files. Using PORTDIR_OVERLAY is not a good idea with existing overlays, but by then you should know how you have personally set them up earlier anyway and how to do it properly. See [8].
macOS Users
macOS users need a replacement libiconv because the system libiconv is seriously out of date. macOS users can download the latest libiconv release by visiting the libiconv website or directly accessing the GNU main FTP mirror. Otherwise you may get unresolved symbol errors related to libiconv when compiling GCC 4.3 or higher on OS X 10.4 and 10.5.
Install a new version (compile it yourself or use MacPorts) and add --with-libiconv-prefix=/opt/local (or /usr/local if you compiled it yourself) to GCC's ./configure line. Alternatively you may place the libiconv source as gcc-x.y.z/libiconv and it will be compiled as part of the GCC compilation process. (This trick also works for MPFR, GMP, and MPC).
The makefiles of Binutils and GCC use the $(CC) variable to invoke the compiler. On OS X, this resolves to gcc by default, which is actually clang. Prior to OS X 10.8, the Clang that came with Xcode's Command Line Tools package was not able to build a working GCC. Users running OS X 10.7 or below may need to find and install GCC, either from Homebrew, or from somewhere on Apple's website. You can try with the old GCC that comes preinstalled on some macOS versions.
You will want to unset these exports once you compiled and installed the cross compiler.
Note for Lion users: If you're on Lion (or above) chances are that you don't have the 'real' GCC since Apple removed it from the Xcode package, but you can still install it. You can do it via Homebrew or by compiling from source, both are perfectly described on a StackExchange answer.
Note for Maverick users: You can build binutils-2.24 and gcc-4.8.3 (possible other version) with Xcode 5.1.1. Note that building GCC with LLVM is not officially supported and may cause interesting bugs, if you are willing to take this risk and save time building host-gcc just to compile a cross-gcc, follow this.Install GMP, MPFR, Mpc with MacPorts.
Note: There is an issue with port's GMP, so the version from OS X from /usr is used instead.
Windows Users
Windows users need to set up a Unix-like enviroment such as MinGW or Cygwin. It may well be worth looking into systems such as Linux and see if they fit your needs, as you commonly use a lot of Unix-like tools in operating systems development and this is much easier from a Unix-like operating system. If you have just installed the basic Cygwin package, you have to run the setup.exe again and install the following packages: GCC, G++, Make, Flex, Bison, Diffutils, libintl-devel, libgmp-devel, libmpfr-devel, libmpc-devel, Texinfo
MinGW + MSYS is an option, and as it addresses the native Windows API instead of a POSIX emulation layer, results in a slightly faster toolchain. Some software packages will not build properly under MSYS as they were not designed for use with Windows. As far as this tutorial is concerned, everything that applies to Cygwin also applies to MSYS unless otherwise specified. Make sure you install the C and C++ compilers, and the MSYS Basic System.
The 'Windows Subsystem for Linux (Beta)', released with the Windows 10 Anniversary update is also an option for using a cross compiler. (Tested 08/08/2016 with GCC 6.1.0 and Binutils 2.27) This cross-compiler works reasonably fast, although being in beta state, it may not be ideal permanent development platform.
Cygwin note: Cygwin includes your Windows %PATH% in its bash $PATH. If you were using DJGPP before, this could result in confusion as e.g. calling GCC on the Cygwin bash command line would still call the DJGPP compiler. After uninstalling DJGPP, you should delete the DJGPP environment variable and clear the C:djgpp entry (or wherever you installed it) from your %PATH%. Likewise, it might be a bad idea to mix build environments in your system PATH variable.
MinGW note: Some MinGW-specific information on building a cross-toolchain can be found on the hosted cross-compiler how-to page on the MinGW homepage.
Windows Subsystem for Linux (Beta) Note: You cannot have your cross compiler in the /mnt/c/ (or /mnt/'x') areas, as trying to compile your cross-compiler there will generate errors, whereas building to $HOME/opt/cross works perfectly. This is fixed with Windows Update KB3176929
OpenBSD Users
OpenBSD users might need to install 'gcc' package from ports because base system's GCC is very outdated. If you want to build GCC, try to use the ports' version instead of the latest version available and apply all patches from ports to your build. Also, if the build fails during compiling lto-plugin, a temporary solution is to disable LTO altogether during configure stage of building GCC by adding --disable-lto
金士頓內存-什麼是DDR4 RAM? -金士頓技術
我嘗試安裝flex和bison,但出現此錯誤:找不到文件&我也使用軟件中心來執行此操作,但是發生驗證錯誤。
我不知道我應該選擇哪種資源。當我在終端中運行此命令時:
結果是:
我的環境:
- 看來您在本地運行的代理服務器已關閉。
- 我不知道您的意思是什麼:(我不使用代理服務器連接到Internet,TNX為您的答案
- 請編輯您的問題並添加的輸出
cat /etc/environment
和cat /etc/apt/apt.conf
. - 我編輯我的問題
- 您正在使用哪個版本的Ubuntu?您標記了12.04,但您的錯誤是10.04。
如果您的發行版是Ubuntu Lucid。
測試一下:
打開一個終端,
按 Ctrl+Alt鍵+Ť
運行:
在打開的文件中,刪除內容並將其粘貼:
Ctrl + Ø, 保存存檔。 Ctrl + X,接近納米。
繼續在終端中運行:
如果您的發行版不是Ubuntu Lucid,請將Lucid更改為適當的名稱。
Install Bison Flex Cygwin Download
如果這些都不起作用
下載包(清醒):
http://mirrors.kernel.org/ubuntu/pool/main/b/bison/bison_2.4.1.dfsg-3_i386.deb(32位)http://mirrors.kernel.org/ubuntu/pool/main/b /bison/bison_2.4.1.dfsg-3_amd64.deb(64位)http://mirrors.kernel.org/ubuntu/pool/main/f/flex/flex_2.5.35-9_i386.deb(32位)http:/ /mirrors.kernel.org/ubuntu/pool/main/f/flex/flex_2.5.35-9_amd64.deb(64位)
Install Bison Flex Cygwin 2
並安裝它們:
由於某些原因,您配置了代理設置。假設您不需要它們,請打開“系統設置”,轉到“網絡”部分,將“代理設置”設置為“無”,然後單擊 應用系統範圍:
Install Bison Flex Cygwin 8
- 我這樣做,但出現此錯誤:
軟件包flex不可用,但由另一個軟件包引用。這可能意味著該軟件包已丟失,已被廢棄或只能從其他來源獲得E:軟件包“ flex”沒有候選安裝