Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005107OCaml-for ocamlbuild use 12:592017-03-03 16:22
Assigned To 
PlatformOSOS Version
Product Version3.12.0+beta1 or 3.12.0+rc1 
Target VersionFixed in Version 
Summary0005107: ocamlbuild misses local C #includes
DescriptionWhen a .c or .h file uses '#include "foo.h"', ocamlbuild has to copy that file in the _build directory but currently it doesn't, making the build fail.

The attached patch (against today's svn) uses cpp to get these dependencies for .c and .h files: .c files are "allowed" to include .c and .h files while .h files can only include .h files.
The reason for this limitation is that the whole list would be: c, cpp, cxx, cp, C, h, hpp, hxx, hxp, H, CPP, HPP, c++, h++, tcc, hh, cc and I took a conservative approach.

The patch also changes Lexers.ocamldep_output to make it work with cpp's output (or ocamldep without -modules).
Attached Filespatch file icon ocamlbuild-track-c-local-includes.patch [^] (7,186 bytes) 2010-07-18 12:59 [Show Content]
patch file icon ocamlbuild-track-c-local-includes2_multiline.patch [^] (7,667 bytes) 2010-07-19 23:00 [Show Content]

- Relationships

-  Notes
jm (reporter)
2010-07-19 10:03

Super, ça comble une grosse lacune lorsqu’on fait des liages ;)
Juste faudrait que tu hackes davantage ocamldep_output
car cpp met des \\\n pour ne pas faire des lignes trop longue (pour make).
Camarade_Tux (reporter)
2010-07-19 22:59
edited on: 2010-07-19 23:02

Thanks for the feedback. I've fixed it and have made a new patch.

For the record, cpp can output:
  ml_a.o: src/ml_a.c src/ml_b.h src/foo.h bar.h src/plip.c src/plip1.h \
   src/plip2.h src/plip3.h src/plip4.h src/plip5.h

edit: you can test behaviour before and after with:
  echo '#include "foo.h"' > ml_a.c
  touch foo.h
  ocamlbuild ml_a.o

Camarade_Tux (reporter)
2010-07-23 18:52
edited on: 2010-07-23 19:02

I just found out that if there are two files "foo.c" and "foo.h", the .c file will never be picked up (internally, the extension is dropped).

There might be a very simple fix: try to copy both, if "foo.*" is being used, chances are both "foo.h" and "foo.c" are used. Unfortunately, but unfortunately I don't have the time to do it right now since I'm on the leave (for a place without a real internet access).

edit: that's a problem I had when using lablgtk's varcc, meaning at least one well-know app does that

xleroy (administrator)
2017-02-20 10:56

Un-assigning from xclerc
doligez (administrator)
2017-03-03 16:22

ocamlbuild is now a separate project that lives on GitHub.
PR transferred to [^]

- Issue History
Date Modified Username Field Change
2010-07-18 12:59 Camarade_Tux New Issue
2010-07-18 12:59 Camarade_Tux File Added: ocamlbuild-track-c-local-includes.patch
2010-07-19 10:03 jm Note Added: 0005607
2010-07-19 22:59 Camarade_Tux Note Added: 0005608
2010-07-19 23:00 Camarade_Tux File Added: ocamlbuild-track-c-local-includes2_multiline.patch
2010-07-19 23:02 Camarade_Tux Note Edited: 0005608
2010-07-22 11:37 ertai Status new => assigned
2010-07-22 11:37 ertai Assigned To => xclerc
2010-07-23 18:52 Camarade_Tux Note Added: 0005618
2010-07-23 19:02 Camarade_Tux Note Edited: 0005618
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2013-10-07 16:13 doligez Tag Attached: patch
2017-02-20 10:56 xleroy Status assigned => acknowledged
2017-02-20 10:56 xleroy Note Added: 0017368
2017-02-23 16:34 doligez Category OCamlbuild (the tool) => for ocamlbuild use [^]
2017-02-23 16:44 doligez Category for ocamlbuild use [^] => -for ocamlbuild use [^]
2017-03-03 16:22 doligez Note Added: 0017553
2017-03-03 16:22 doligez Assigned To xclerc =>
2017-03-03 16:22 doligez Status acknowledged => resolved
2017-03-03 16:22 doligez Resolution open => suspended

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker