简体   繁体   中英

Frama-C: compiling on Cygwin / Windows 8.1

An easy question for those who compile C on windows!

I want to use the latest version of the Frama-C C static analyzer and its GUI on windows 8. As far as I can tell, the most recent version that has a windows installer is Boron, which is some 3-4 years old. So it looks like I'll need to compile it (Version Fluorine 3) myself . However I am stumbling at the first few steps.

The quick-start compilation instructions for Frama-C Fluorine 3 are here .

  • Step 1: Install OCaml. I have installed the windows version from here .

  • Step 1b: I believe step 1 installed Gtk and so on.

  • Step 2b: Run:

    ./configure --prefix C:/windows/path/with/direct/slash && make && make install

4 things about these instructions leave me confused:

  1. Which configure file is this meant to be? If I open the Cygwin terminal, it lands me in the user's home directory, and if I run ./configure it says no such file or directory. I think it's meant to refer to one of the configure files in the source, but there are over 10.

  2. What exactly is C:/windows/path/with/direct/slash meant to point to? Please could someone give me a real example with a good explanation?

  3. In which directory should I be running the above command (Step 2b) from?

  4. In which directory should I place the extracted Frama-C source distribution? (And should I just extract the src dir from the archive, or will I need all the contents?)

All I'm trying to do is follow their " Short example " linked to from their homepage, using the latest version, on Windows 8.1, and I need an "Absolute Dummies'" guide for doing so!

Many thanks

I came across your question because I was also confused by the "with/direct/slash" instruction. At least I can help with your other questions:

  1. By convention, it's always the configure file in the root directory of the tarball. So extract the tar.gz file and then cd into the directory that that creates and run ./configure from there.

  2. --prefix defines the installation path, so I assume this option is supposed to put the executable in some directory easily accessible from Windows (eg. the Program Files directory). I'm not sure what the "direct slash" bit is about though. Typically Cygwin's root directory is actually some directory on the C: drive (eg. C:\\cygwin) so to access the rest of the file hierarchy typically there's a mapped mount called "cygdrive" in the Cygwin root directory. That way you can navigate to the wide hierarchy from within Cygwin using something like '/cygdrive/c/path/to/windows/directory'. The use of "C:/" from within Cygwin is a bit weird. For what it's worth, I'd just accept the default (no --prefix flag) or specify something within the Cygwin hierarchy like '/usr/local/bin' and just run it from there.

  3. From your specified '--prefix' directory, because that's where the executable will be. If you leave it as one of the defaults, you can run the executable from anywhere, because it will be somewhere that's on your PATH.

  4. Extract the whole lot into some working directory in your home folder. Once you've installed it (which is what './configure && make && make install' does) you can throw away the extracted archive.

Updated instructions about compiling Frama-C on Windows are available at the Frama-C wiki, tested on both Windows 7 and Windows 8.1.

Those instructions are not officially supported, but they should help users to compile and install Frama-C using OPAM (the OCaml Package Manager).

Also, since there are no significant differences in the procedure between recent Windows versions, some answers to this question might also be applicable to your case.

In windows 10, following instructions were followed for successful installation of frama-c:

  1. WSL enable in windows 10

https://docs.microsoft.com/en-us/windows/wsl/install-win10

Ubuntu should now be available in the Windows menu. Run it and follow the instructions to create a user.

  1. For installing opam,

    1. sudo add-apt-repository -y ppa:snwh/ppa
    2. sudo apt update
    3. sudo apt upgrade
    4. sudo apt install make m4 gcc opam
  2. opam can be setup using:

    1. opam init --disable-sandboxing -c 4.07.0 --shell-setup

      If there is a opam switch error then run this command:

       opam switch create 4.07.0

      This will download and install ocaml compiler 4.07.0 version.

    2. eval $(opam env)

    3. opam install -y depext

  3. For installing Frama-C, run the following commands:

    1. opam depext --install -y lablgtk3 lablgtk3-sourceview3
    2. opam depext conf-gnomecanvas
    3. opam depext conf-gtksourceview
    4. opam depext --install -y frama-c

    This should process around 70 files and it takes some time for installation.

    1. eval $(opam config env)

    Restart Ubuntu again and if there is a "command not found" problem, then execute the command "eval $(opam config env)" again and use frama-c.

  4. Once Frama-c 21.1 is installed, test:

    1. which frama-c
    2. which frama-c-gui

    If both commands show a proper installation directory, then they will execute successfully.

  5. After frama-c-gui installation, since WSL does not support GUI, I have used mobaXterm.

    1. Install MobaXterm. Xserver comes by default with MobaXterm.
    2. When you start MobaXterm, Xserver icon appears on right top. Click that to get started.
    3. Once the Xserver starts, keep mouse over the icon to see the IP address of the GUI display. Example it will show: "172.19.64.1:0.0". Note this.
    4. In Ubuntu, export DISPLAY="172.19.64.1:0.0"
    5. Then start frama-c-gui. It will open using Xserver GUI.

If using a Virtual Box and Linux distribution installed in virtual box, then follow steps 2 to 5 for installation. Allocate at least 20 GB to virtual box for successful installation. frama-c-gui will get installed only if there is enough disk space allotted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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