Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005107OCamlOCamlbuild (the tool)public2010-07-18 12:592013-10-07 16:13
ReporterCamarade_Tux 
Assigned Toxclerc 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusassignedResolutionopen 
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).
Tagspatch
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
(0005607)
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).
(0005608)
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

(0005618)
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


- 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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker