How to fix the Unbound module Graphics in an ocaml project

Image
From ~/pr/gitl/ocaml-gol In a constant effort to learn new programming languages, I'm currently trying to use ocaml , a free and open-source general-purpose, multi-paradigm programming language maintained at the Inria . It's basically an extension of Caml with object-oriented features. I'm mostly interested by its functionnal and pattern matching features but the module part of the language can be a bit difficult to understand for someone with little to none ML (Meta Language) background.   The error When trying to use the graphics module to create a graphical window and go just a little further than the simplest helloworld program, here is the result : If the project uses dune : (executable (name ocaml_project) (libraries lwt.unix graphics) ) with this code : let () = Printf.printf "Hello, world!\n";; Lwt_io.printf "Hello, world!\n";; Graphics.open_graph " 800x600";; The first times I built this project running the du

How to modernize your autotools scripts

I have many old projects using autotools as build system, but for oldest projects, some files need to be updated.
A basic overview of how the main autotools components fit together
Source diagram, available under a
 Creative Commons Attribution-ShareAlike 3.0 Unported License

Filename changes

The configure.in file needs to be renamed to configure.ac.
All .texinfo files must be renamed .texi. You also need to change Makefile.am's references to these files, typically in the *_TEXINFOS lines.

The AM_INIT_AUTOMAKE macro

This warning tells you that two- and three-arguments forms are deprecated and gives you this link. This macro is at the beginning of the configure.ac file and is actually used like this :

AC_INIT(src/main.cpp)
AM_INIT_AUTOMAKE(projectname, 0.0.0)
and you must replace this with :
AC_INIT([projectname], [0.0.0])
AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE

The does not appear in AM_CONDITIONAL error

This error message comes with macro name and should be found in a Makefile.am file.
You're probably using a variable in a if statement without defining it in AM_CONDITIONAL.

For this project, I'm searching for a tool and conditionally add sources if found in Makefile.am :
if INKSCAPE_FOUND
  SOURCES+=global-view.png
endif
In the m4 file, I'm initializing the INKSCAPE_FOUND maro
AC_ARG_VAR([TOOL_INKSCAPE], [Define the path to the inkscape executable])
  AC_PATH_PROG(TOOL_INKSCAPE, inkscape, [no])
  case $TOOL_INKSCAPE in
    no)
      dnl Nothing
      dot_was_found=false
      ;;    
    *)   
      AC_DEFINE([HAVE_INKSCAPE], [], [Defines if the inkscape tool was found])
      AC_DEFINE(HAVE_INKSCAPE)
      dot_was_found=true
      ;;
  esac  
  AM_CONDITIONAL(INKSCAPE_FOUND, test x$dot_was_found = xtrue)
The does not appear in AM_CONDITIONAL error occurs here if you remove the last line.

Comments

Popular posts from this blog

How to make a map of variant in C++