-1

I want to make Bison.exe from Bison source code to run it on windows. On Linux we can use make to generate the Bison executable but I want to use Bison on windows.

I am unable to find win-Bison for any of the latest releases, most of them are for 2.x release. Because of a CVE I need to use 3.5.4 or higher version.

a11apurva
  • 138
  • 10
  • MinGW can be used on Linux to create Windows executables. – Some programmer dude Aug 25 '20 at 08:14
  • Is Bison using some non standard headers? – Bernd Aug 25 '20 at 08:50
  • Note that the [CVE](https://nvd.nist.gov/vuln/detail/CVE-2020-14150) you cited has been clarified to indicate that it only applies to cases where Bison is used with untrusted input (such as a webservice which uses Bison to analyse user input), and does not indicate a vulnerability in the code produced by Bison. – rici Sep 03 '20 at 01:28
  • Thanks for pointing out @rici. In-fact a new [CVE](https://nvd.nist.gov/vuln/detail/CVE-2020-24240) has been found but again it is only in the Bison itself and not in the generated code. By this time I already migrated to the [3.7.1v](https://github.com/lexxmark/winflexbison/releases) which they recently released as pointed out by brc-dd. It was a good learning, we were at a really old version with lots of deprecations. – a11apurva Sep 03 '20 at 06:14

1 Answers1

3

You can use MSYS2 to use bison on Windows. Here is the package link. Version 3.6.4-1 is available there.

A quick search took me to this video. You can refer to that if you don't have experience setting up MSYS2 on Windows.

I noticed that you are using Chocolatey. So you can install MSYS2 using that also. Here is the package link.

enter image description here

If you have MSYS2 in PATH (C:\tools\msys64;C:\tools\msys64\mingw64\bin;C:\tools\msys64\usr\bin; if you've installed using Chocolatey with default settings), then you don't need its shell to run bison. You can use any of your preferable terminals.

enter image description here

Edit :

You can use VS-2019 to build the executable itself. Here is the link to the git repository. Current stable release include bison 3.5.0. But since you need version greater than 3.5.4, you can go with the under development builds like this one.

brc-dd
  • 10,788
  • 3
  • 47
  • 67
  • I guess the reference to chocolatey is confusing, we are not using it, apologies. Due to restrictions in our build environment I can't use MSYS2 or Cygwin (that would have made life easier :) ), that is why I am looking for an executable. Thank you for the suggestion though. – a11apurva Aug 25 '20 at 09:28
  • @a11apurva Ok sorry for the misunderstanding. I thought you were using it as you'd provided a link to a Chocolatey package, and on similar package I saw one of your comments. :) So basically you want to build the software from the source itself? – brc-dd Aug 25 '20 at 09:38
  • 1
    @a11apurva I have added an edit in the question. I hope it will work for you. – brc-dd Aug 25 '20 at 09:48
  • 1
    As you seem to be content using precompiled binaries, why not build bison on your own computer as @brc-dd suggests and copy the resulting binary to your build environment? – Botje Aug 25 '20 at 11:20
  • @brc-dd This should certainly solve my issue. Thanks a lot :) – a11apurva Aug 26 '20 at 05:56
  • @Botje That's what I will try. Thanks. – a11apurva Aug 26 '20 at 05:57
  • @brc-dd Everything was working as expected on win10, however on XP if I do bion.exe --version I get the following error - bison: cannot execute: %1 is not a valid Win32 application. – a11apurva Sep 18 '20 at 09:50
  • @a11apurva I think that you are having 32-bit OS but trying to run a 64-bit application. Try building the project on Windows XP itself. Check if target architecture is x86. Moreover, I cannot confirm if Windows XP is still supported by the software. – brc-dd Sep 18 '20 at 09:55
  • @brc-dd The exe seems to be 32-bit itself, I did 'file Bison.exe' on cmd and got this - "bison.exe: extended DOS executable (.EXE) -- Win32 or NT Portable format". I will try to check their documentation if they have explicitly mentioned about XP somewhere. Thanks. – a11apurva Sep 18 '20 at 10:03
  • @a11apurva Ok, then I believe you will have to find a way out yourself. I don't have a machine/vm using Windows XP, so it's not possible for me to test out the program myself. Please create another question to gain attention of the community, others might be able to help you with the problem. – brc-dd Sep 18 '20 at 10:15
  • @a11apurva Well, check out [this thread](https://stackoverflow.com/questions/11305633/xxxxxx-exe-is-not-a-valid-win32-application), it may resolve your problem. – brc-dd Sep 18 '20 at 10:19