Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006475OCamlOCaml generalpublic2014-06-30 11:302014-12-27 10:23
Reporteryallop 
Assigned Towhitequark 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.02.2+dev 
Summary0006475: -o is ignored for C files
DescriptionThe -o option is ignored when compiling C files, which makes it slightly awkward to write object files to a directory other than the current directory.

For example, the following command

   ocamlc -c -o build/code.cmo src/code.ml

creates 'build/code.cmo' as expected, but the corresponding command for a C file

   ocamlc -c -o build/code.o src/code.c

creates 'code.o' in the current directory.
Tagspatch
Attached Filespatch file icon ocamlc-c-o.patch [^] (4,616 bytes) 2014-12-21 13:02 [Show Content]

- Relationships

-  Notes
(0012423)
whitequark (developer)
2014-10-23 22:14

I should add that ocamlbuild should be fixed as well when this issue is resolved. It currently uses mv to move the .o from the current directory.
(0012429)
yallop (developer)
2014-10-24 15:27

There's a patch by @vbgl here:

   https://github.com/ocaml/ocaml/pull/103 [^]
(0012902)
gasche (developer)
2014-12-21 11:50

whitequark, could you write a test case in the ocamlbuild testsuite to make sure your ocamlbuild patch works as expected? There already is some very light output-obj testing in internal.ml.
(0012907)
whitequark (developer)
2014-12-21 13:02

I have attached a new patch that contains:

  * @vbgl's fix
  * changes to ocamlbuild
  * ocamlbuild test
  * changes to Changes
(0012908)
gasche (developer)
2014-12-21 13:20
edited on: 2014-12-21 13:21

I merged the (very nice!) patch, but in trunk only rather than in the stable branch. My reasoning is that other build systems may have workarounds for this issue (we had to fix ocamlbuild) which may break now that it is fixed.

(We don't know yet whether there will be another minor release, but Damien seems to be thinking about it.)

Thanks to all of you for the report and bugfixes.

(0012909)
whitequark (developer)
2014-12-21 13:22

I believe this can be merged in stable, because the patch does not change the behavior *without -o*, and other buildsystems are unlikely to pass an option that does nothing. So the workarounds will still work.
(0012920)
whitequark (developer)
2014-12-21 19:05

(In other words we did not *have* to fix ocamlbuild, I just thought it would be much cleaner.)
(0012921)
gasche (developer)
2014-12-21 19:11

Okay, will merge in 4.02 at a later date.
(0012993)
gasche (developer)
2014-12-27 10:23

Merged in 4.02.

- Issue History
Date Modified Username Field Change
2014-06-30 11:30 yallop New Issue
2014-07-11 13:20 doligez Severity minor => feature
2014-07-11 13:20 doligez Status new => acknowledged
2014-10-23 22:14 whitequark Note Added: 0012423
2014-10-24 15:27 yallop Note Added: 0012429
2014-10-24 15:27 yallop Tag Attached: patch
2014-12-20 13:23 whitequark File Added: ocamlc-c-ocamlbuild.patch
2014-12-21 11:50 gasche Assigned To => whitequark
2014-12-21 11:50 gasche Status acknowledged => assigned
2014-12-21 11:50 gasche Note Added: 0012902
2014-12-21 13:02 whitequark File Deleted: ocamlc-c-ocamlbuild.patch
2014-12-21 13:02 whitequark File Added: ocamlc-c-o.patch
2014-12-21 13:02 whitequark Note Added: 0012907
2014-12-21 13:20 gasche Note Added: 0012908
2014-12-21 13:21 gasche Note Edited: 0012908 View Revisions
2014-12-21 13:21 gasche Note Edited: 0012908 View Revisions
2014-12-21 13:22 whitequark Note Added: 0012909
2014-12-21 19:05 whitequark Note Added: 0012920
2014-12-21 19:11 gasche Note Added: 0012921
2014-12-27 10:23 gasche Note Added: 0012993
2014-12-27 10:23 gasche Status assigned => resolved
2014-12-27 10:23 gasche Fixed in Version => 4.02.2+dev
2014-12-27 10:23 gasche Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker