Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005887OCamlOCaml runtime systempublic2013-01-12 20:042014-09-04 00:25
Reportervouillon 
Assigned To 
PriorityhighSeverityminorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version4.00.1 
Target VersionundecidedFixed in Version 
Summary0005887: Name clash with memory.h header file with the Android NDK
DescriptionIn the Android NDK, the stdlib.h header file includes memory.h.
When compiling the native runtime and the libraries in otherlibs, it's the OCaml memory.h file that gets included. The compilation then breaks when misc.h is included, as it includes stdlib.h before providing definitions need by memory.h.

A work-around is to temporarily define CAML_MEMORY_H before including stdlib.h
(see patch) in misc.h. As the memory.h system header file is empty, this is safe to do.

A better fix, which would also fix the name clash on io.h under Windows (0004175),
would be to move OCaml header files into a subdirectory "caml" of directory "byterun". I could implement that if there is some interest.
Tagspatch
Attached Filestxt file icon memory.txt [^] (355 bytes) 2013-01-12 20:04 [Show Content]
? file icon fix_includes.sh [^] (4,024 bytes) 2013-01-14 11:13
gz file icon 0001-Move-byterun-.h-to-byterun-caml.patch.gz [^] (97,168 bytes) 2013-02-23 21:15

- Relationships
has duplicate 0004175confirmed runtime header file io.h conflicts with a system header file 

-  Notes
(0008748)
vouillon (reporter)
2013-01-14 11:31

I have uploaded a tentative script to move most include files in byterun to byterun/caml. The file instruct.h and the generated files jumptbl.h, opnames.h, and version.h are left in byterun. They could be moved as well but several makefiles have to be patched for that.

"make world" and "make opt" works, but I see now that myocamlbuild.ml and some files in the build directory need to be updated as well. Also, the .depend.nt files are not updated.
(0008892)
Camarade_Tux (reporter)
2013-02-23 21:22

I've uploaded 0001-Move-byterun-.h-to-byterun-caml.patch.gz .

I've used your script to create it and also moved {instruct,jumptbl,opnames,version}.h and updated myocamlbuild.ml.

Build using world.opt works. I haven't touched the .depend.nt files.

The patch is huge (8000 lines added and removed). Half of that is because of the .depend files. Another half is the .h files themselves (since being moved counts as additions and deletions) and the renaming in the #include directives of the .c files.

My git commit message (which is in the patch file too) is as follows:

    Move byterun/*.h to byterun/caml/.
    
    There are name clashes between ocaml headers and system headers (android
    and mingw at least). Names such as "io.h" or "memory.h" are too common.
    
    Moving these files means that they won't be refered to as "io.h" but
    rather "caml/io.h", therefore avoiding clashes.
    
    An alternative solution would be to name them "caml_io.h" but
    "caml/io.h" looks much nicer.
    
    As far as I can tell, this doesn't change installed files so it's fairly
    safe and packagers won't hate me.
(0008893)
meyer (developer)
2013-02-23 22:33

My only comment: if we plan to move the files around - which I think is a good idea, then we should be using svn machinery for that e.g. svn mv command, as svn is aware about files that are moved, unlike git which just track contents. But many thanks for the patches, it really helps to know what should be done.
(0008894)
meyer (developer)
2013-02-23 22:37

> "make world" and "make opt" works, but I see now that myocamlbuild.ml and some files in the build directory need to be updated as well. Also, the .depend.nt files are not updated.

Don't need to care about myocamlbuild.ml at the moment, I don't know if anybody builds OCaml with ocamlbuild at all, and we plan to just remove these files from the tree.

As for .depend.nt, it's crucial that somebody would test it on Windows.

Thanks
(0008895)
Camarade_Tux (reporter)
2013-02-23 23:20

Well, I can't "svn mv" myself but here's the diffstat I got in git here, "=>" shows the renames:

 .depend | 14 +-
 Makefile | 10 +-
 Makefile.nt | 8 +-
 asmrun/.depend | 1743 ++++++++++++++-----------
 asmrun/backtrace.c | 10 +-
 asmrun/fail.c | 18 +-
 asmrun/natdynlink.c | 16 +-
 asmrun/roots.c | 16 +-
 asmrun/signals_asm.c | 10 +-
 asmrun/startup.c | 32 +-
 byterun/.depend | 1070 +++++++++------
 byterun/.ignore | 6 +-
 byterun/Makefile | 2 +-
 byterun/Makefile.common | 24 +-
 byterun/alloc.c | 12 +-
 byterun/array.c | 10 +-
 byterun/backtrace.c | 26 +-
 byterun/callback.c | 16 +-
 byterun/{ => caml}/alloc.h | 0
 byterun/{ => caml}/backtrace.h | 0
 byterun/{ => caml}/callback.h | 0
 byterun/{ => caml}/compact.h | 0
 byterun/{ => caml}/compare.h | 0
 byterun/{ => caml}/compatibility.h | 0
 byterun/{ => caml}/config.h | 8 +-
 byterun/{ => caml}/custom.h | 0
 byterun/{ => caml}/debugger.h | 0
 byterun/{ => caml}/dynlink.h | 0
 byterun/{ => caml}/exec.h | 0
 byterun/{ => caml}/fail.h | 0
 byterun/{ => caml}/finalise.h | 0
 byterun/{ => caml}/fix_code.h | 0
 byterun/{ => caml}/freelist.h | 0
 byterun/{ => caml}/gc.h | 0
 byterun/{ => caml}/gc_ctrl.h | 0
 byterun/{ => caml}/globroots.h | 0
 byterun/{ => caml}/hash.h | 0
 byterun/{ => caml}/instrtrace.h | 0
 byterun/{ => caml}/instruct.h | 0
 byterun/{ => caml}/int64_emul.h | 0
 byterun/{ => caml}/int64_format.h | 0
 byterun/{ => caml}/int64_native.h | 0
 byterun/{ => caml}/interp.h | 0
 byterun/{ => caml}/intext.h | 0
 byterun/{ => caml}/io.h | 0
 byterun/{ => caml}/major_gc.h | 0
 byterun/{ => caml}/md5.h | 0
 byterun/{ => caml}/memory.h | 0
 byterun/{ => caml}/minor_gc.h | 0
 byterun/{ => caml}/misc.h | 0
 byterun/{ => caml}/mlvalues.h | 0
 byterun/{ => caml}/osdeps.h | 0
 byterun/{ => caml}/prims.h | 0
 byterun/{ => caml}/printexc.h | 0
 byterun/{ => caml}/reverse.h | 0
 byterun/{ => caml}/roots.h | 0
 byterun/{ => caml}/signals.h | 0
 byterun/{ => caml}/signals_machdep.h | 0
 byterun/{ => caml}/stacks.h | 0
 byterun/{ => caml}/startup.h | 0
 byterun/{ => caml}/sys.h | 0
 byterun/{ => caml}/ui.h | 0
 byterun/{ => caml}/weak.h | 0
 byterun/compact.c | 20 +-
 byterun/compare.c | 10 +-
 byterun/custom.c | 10 +-
 byterun/debugger.c | 26 +-
 byterun/dynlink.c | 18 +-
 byterun/extern.c | 24 +-
 byterun/fail.c | 20 +-
 byterun/finalise.c | 10 +-
 byterun/fix_code.c | 20 +-
 byterun/floats.c | 16 +-
 byterun/freelist.c | 16 +-
 byterun/gc_ctrl.c | 24 +-
 byterun/globroots.c | 10 +-
 byterun/hash.c | 16 +-
 byterun/instrtrace.c | 12 +-
 byterun/intern.c | 26 +-
 byterun/interp.c | 34 +-
 byterun/ints.c | 20 +-
 byterun/io.c | 20 +-
 byterun/lexing.c | 6 +-
 byterun/main.c | 6 +-
 byterun/major_gc.c | 26 +-
 byterun/md5.c | 14 +-
 byterun/memory.c | 22 +-
 byterun/meta.c | 26 +-
 byterun/minor_gc.c | 26 +-
 byterun/misc.c | 6 +-
 byterun/obj.c | 20 +-
 byterun/parsing.c | 8 +-
 byterun/printexc.c | 14 +-
 byterun/roots.c | 18 +-
 byterun/signals.c | 22 +-
 byterun/signals_byt.c | 10 +-
 byterun/stacks.c | 10 +-
 byterun/startup.c | 58 +-
 byterun/str.c | 12 +-
 byterun/sys.c | 20 +-
 byterun/terminfo.c | 10 +-
 byterun/unix.c | 8 +-
 byterun/weak.c | 10 +-
 byterun/win32.c | 14 +-
 debugger/.depend | 12 +-
 lex/.depend | 8 +-
 myocamlbuild.ml | 8 +-
 ocamldoc/.depend | 12 +-
 otherlibs/bigarray/.depend | 41 +-
 otherlibs/bigarray/bigarray.h | 6 +-
 otherlibs/bigarray/bigarray_stubs.c | 18 +-
 otherlibs/bigarray/mmap_unix.c | 12 +-
 otherlibs/bigarray/mmap_win32.c | 10 +-
 otherlibs/graph/.depend | 125 +-
 otherlibs/graph/draw.c | 2 +-
 otherlibs/graph/dump_img.c | 4 +-
 otherlibs/graph/events.c | 4 +-
 otherlibs/graph/fill.c | 2 +-
 otherlibs/graph/image.c | 4 +-
 otherlibs/graph/libgraph.h | 2 +-
 otherlibs/graph/make_img.c | 2 +-
 otherlibs/graph/open.c | 8 +-
 otherlibs/graph/text.c | 2 +-
 otherlibs/labltk/browser/winmain.c | 6 +-
 otherlibs/labltk/support/cltkCaml.c | 8 +-
 otherlibs/labltk/support/cltkDMain.c | 14 +-
 otherlibs/labltk/support/cltkEval.c | 6 +-
 otherlibs/labltk/support/cltkEvent.c | 4 +-
 otherlibs/labltk/support/cltkFile.c | 4 +-
 otherlibs/labltk/support/cltkImg.c | 6 +-
 otherlibs/labltk/support/cltkMain.c | 12 +-
 otherlibs/labltk/support/cltkMisc.c | 4 +-
 otherlibs/labltk/support/cltkTimer.c | 4 +-
 otherlibs/labltk/support/cltkUtf.c | 6 +-
 otherlibs/labltk/support/cltkVar.c | 8 +-
 otherlibs/labltk/support/cltkWait.c | 6 +-
 otherlibs/num/.depend | 25 +-
 otherlibs/num/bng.c | 2 +-
 otherlibs/num/bng.h | 2 +-
 otherlibs/num/nat_stubs.c | 16 +-
 otherlibs/str/.depend | 14 +-
 otherlibs/str/strstubs.c | 8 +-
 otherlibs/systhreads/.depend | 25 +-
 otherlibs/systhreads/st_stubs.c | 28 +-
 otherlibs/threads/.depend | 47 +-
 otherlibs/threads/scheduler.c | 28 +-
 otherlibs/unix/.depend | 994 +++++++-------
 otherlibs/unix/accept.c | 10 +-
 otherlibs/unix/access.c | 4 +-
 otherlibs/unix/addrofstr.c | 6 +-
 otherlibs/unix/alarm.c | 2 +-
 otherlibs/unix/bind.c | 4 +-
 otherlibs/unix/chdir.c | 2 +-
 otherlibs/unix/chmod.c | 2 +-
 otherlibs/unix/chown.c | 2 +-
 otherlibs/unix/chroot.c | 2 +-
 otherlibs/unix/close.c | 2 +-
 otherlibs/unix/closedir.c | 2 +-
 otherlibs/unix/connect.c | 6 +-
 otherlibs/unix/cst2constr.c | 4 +-
 otherlibs/unix/cstringv.c | 4 +-
 otherlibs/unix/dup.c | 2 +-
 otherlibs/unix/dup2.c | 2 +-
 otherlibs/unix/envir.c | 4 +-
 otherlibs/unix/errmsg.c | 4 +-
 otherlibs/unix/execv.c | 4 +-
 otherlibs/unix/execve.c | 4 +-
 otherlibs/unix/execvp.c | 4 +-
 otherlibs/unix/exit.c | 2 +-
 otherlibs/unix/fchmod.c | 4 +-
 otherlibs/unix/fchown.c | 4 +-
 otherlibs/unix/fcntl.c | 4 +-
 otherlibs/unix/fork.c | 4 +-
 otherlibs/unix/ftruncate.c | 6 +-
 otherlibs/unix/getaddrinfo.c | 10 +-
 otherlibs/unix/getcwd.c | 6 +-
 otherlibs/unix/getegid.c | 2 +-
 otherlibs/unix/geteuid.c | 2 +-
 otherlibs/unix/getgid.c | 2 +-
 otherlibs/unix/getgr.c | 8 +-
 otherlibs/unix/getgroups.c | 6 +-
 otherlibs/unix/gethost.c | 10 +-
 otherlibs/unix/gethostname.c | 6 +-
 otherlibs/unix/getlogin.c | 4 +-
 otherlibs/unix/getnameinfo.c | 10 +-
 otherlibs/unix/getpeername.c | 4 +-
 otherlibs/unix/getpid.c | 2 +-
 otherlibs/unix/getppid.c | 2 +-
 otherlibs/unix/getproto.c | 8 +-
 otherlibs/unix/getpw.c | 8 +-
 otherlibs/unix/getserv.c | 8 +-
 otherlibs/unix/getsockname.c | 4 +-
 otherlibs/unix/gettimeofday.c | 6 +-
 otherlibs/unix/getuid.c | 2 +-
 otherlibs/unix/gmtime.c | 8 +-
 otherlibs/unix/initgroups.c | 6 +-
 otherlibs/unix/isatty.c | 2 +-
 otherlibs/unix/itimer.c | 8 +-
 otherlibs/unix/kill.c | 6 +-
 otherlibs/unix/link.c | 2 +-
 otherlibs/unix/listen.c | 4 +-
 otherlibs/unix/lockf.c | 6 +-
 otherlibs/unix/lseek.c | 8 +-
 otherlibs/unix/mkdir.c | 2 +-
 otherlibs/unix/mkfifo.c | 4 +-
 otherlibs/unix/nice.c | 2 +-
 otherlibs/unix/open.c | 8 +-
 otherlibs/unix/opendir.c | 4 +-
 otherlibs/unix/pipe.c | 4 +-
 otherlibs/unix/putenv.c | 6 +-
 otherlibs/unix/read.c | 6 +-
 otherlibs/unix/readdir.c | 6 +-
 otherlibs/unix/readlink.c | 6 +-
 otherlibs/unix/rename.c | 2 +-
 otherlibs/unix/rewinddir.c | 4 +-
 otherlibs/unix/rmdir.c | 2 +-
 otherlibs/unix/select.c | 10 +-
 otherlibs/unix/sendrecv.c | 10 +-
 otherlibs/unix/setgid.c | 2 +-
 otherlibs/unix/setgroups.c | 8 +-
 otherlibs/unix/setsid.c | 4 +-
 otherlibs/unix/setuid.c | 2 +-
 otherlibs/unix/shutdown.c | 4 +-
 otherlibs/unix/signals.c | 10 +-
 otherlibs/unix/sleep.c | 4 +-
 otherlibs/unix/socket.c | 4 +-
 otherlibs/unix/socketaddr.c | 6 +-
 otherlibs/unix/socketaddr.h | 2 +-
 otherlibs/unix/socketpair.c | 6 +-
 otherlibs/unix/sockopt.c | 8 +-
 otherlibs/unix/stat.c | 8 +-
 otherlibs/unix/strofaddr.c | 6 +-
 otherlibs/unix/symlink.c | 4 +-
 otherlibs/unix/termios.c | 6 +-
 otherlibs/unix/time.c | 4 +-
 otherlibs/unix/times.c | 6 +-
 otherlibs/unix/truncate.c | 6 +-
 otherlibs/unix/umask.c | 2 +-
 otherlibs/unix/unixsupport.c | 10 +-
 otherlibs/unix/unlink.c | 2 +-
 otherlibs/unix/utimes.c | 4 +-
 otherlibs/unix/wait.c | 10 +-
 otherlibs/unix/write.c | 6 +-
 otherlibs/win32graph/dib.c | 4 +-
 otherlibs/win32graph/draw.c | 10 +-
 otherlibs/win32graph/events.c | 4 +-
 otherlibs/win32graph/open.c | 6 +-
 otherlibs/win32unix/accept.c | 8 +-
 otherlibs/win32unix/bind.c | 2 +-
 otherlibs/win32unix/channels.c | 8 +-
 otherlibs/win32unix/close.c | 4 +-
 otherlibs/win32unix/close_on.c | 2 +-
 otherlibs/win32unix/connect.c | 4 +-
 otherlibs/win32unix/createprocess.c | 4 +-
 otherlibs/win32unix/dup.c | 2 +-
 otherlibs/win32unix/dup2.c | 2 +-
 otherlibs/win32unix/errmsg.c | 4 +-
 otherlibs/win32unix/getpeername.c | 2 +-
 otherlibs/win32unix/getpid.c | 2 +-
 otherlibs/win32unix/getsockname.c | 2 +-
 otherlibs/win32unix/gettimeofday.c | 4 +-
 otherlibs/win32unix/link.c | 4 +-
 otherlibs/win32unix/listen.c | 2 +-
 otherlibs/win32unix/lockf.c | 8 +-
 otherlibs/win32unix/lseek.c | 4 +-
 otherlibs/win32unix/mkdir.c | 2 +-
 otherlibs/win32unix/nonblock.c | 4 +-
 otherlibs/win32unix/open.c | 4 +-
 otherlibs/win32unix/pipe.c | 6 +-
 otherlibs/win32unix/read.c | 6 +-
 otherlibs/win32unix/rename.c | 2 +-
 otherlibs/win32unix/select.c | 10 +-
 otherlibs/win32unix/sendrecv.c | 8 +-
 otherlibs/win32unix/shutdown.c | 2 +-
 otherlibs/win32unix/sleep.c | 4 +-
 otherlibs/win32unix/socket.c | 2 +-
 otherlibs/win32unix/socketaddr.h | 2 +-
 otherlibs/win32unix/sockopt.c | 8 +-
 otherlibs/win32unix/startup.c | 2 +-
 otherlibs/win32unix/stat.c | 6 +-
 otherlibs/win32unix/system.c | 8 +-
 otherlibs/win32unix/times.c | 4 +-
 otherlibs/win32unix/unixsupport.c | 12 +-
 otherlibs/win32unix/windir.c | 8 +-
 otherlibs/win32unix/winwait.c | 8 +-
 otherlibs/win32unix/winworker.c | 8 +-
 otherlibs/win32unix/write.c | 6 +-
 stdlib/.depend | 392 ++++--
 stdlib/headernt.c | 4 +-
 testsuite/tests/basic-manyargs/manyargsprim.c | 2 +-
 testsuite/tests/callback/callbackprim.c | 6 +-
 testsuite/tests/gc-roots/globrootsprim.c | 6 +-
 testsuite/tests/lib-bigarray-2/bigarrfstub.c | 2 +-
 testsuite/tests/lib-marshal/intextaux.c | 4 +-
 tools/.depend | 66 +-
 tools/Makefile.shared | 4 +-
 tools/objinfo_helper.c | 4 +-
 297 files changed, 3604 insertions(+), 2898 deletions(-)
(0008903)
Camarade_Tux (reporter)
2013-02-24 13:02
edited on: 2013-02-24 13:06

I've found two issues so far:

In byterun/debugger.c:
  #ifdef _WIN32
  #include <caml/io.h>
  #endif /* _WIN32 */

In byterun/win32.c:
  #include <caml/io.h>

These should be <io.h>, not <caml/io.h>. :-)


EDIT:
And these two lines have to be corrected in stdlib/header.c:
  #include "../byterun/mlvalues.h"
  #include "../byterun/exec.h"

(0010712)
Camarade_Tux (reporter)
2013-12-14 19:29

Another issue. From tools/cleanup-header:
  /\/\* <include \.\.\/config\/m\.h> \*\// {
and
  /\/\* <include \.\.\/config\/s\.h> \*\// {

These regular expressions need to be changed to match "../../" instead of only "../".

- Issue History
Date Modified Username Field Change
2013-01-12 20:04 vouillon New Issue
2013-01-12 20:04 vouillon File Added: memory.txt
2013-01-14 11:13 vouillon File Added: fix_includes.sh
2013-01-14 11:31 vouillon Note Added: 0008748
2013-02-23 19:15 meyer Assigned To => meyer
2013-02-23 19:15 meyer Status new => assigned
2013-02-23 21:15 Camarade_Tux File Added: 0001-Move-byterun-.h-to-byterun-caml.patch.gz
2013-02-23 21:22 Camarade_Tux Note Added: 0008892
2013-02-23 22:33 meyer Note Added: 0008893
2013-02-23 22:37 meyer Note Added: 0008894
2013-02-23 23:20 Camarade_Tux Note Added: 0008895
2013-02-24 13:02 Camarade_Tux Note Added: 0008903
2013-02-24 13:06 Camarade_Tux Note Edited: 0008903 View Revisions
2013-07-02 16:54 doligez Relationship added has duplicate 0004175
2013-07-02 16:55 doligez Target Version => 4.01.0+dev
2013-07-16 11:37 doligez Target Version 4.01.0+dev => 4.02.0+dev
2013-12-14 19:29 Camarade_Tux Note Added: 0010712
2013-12-16 13:53 doligez Tag Attached: patch
2013-12-16 13:57 doligez Priority normal => high
2014-01-21 11:55 doligez Assigned To meyer =>
2014-08-18 20:21 doligez Status assigned => confirmed
2014-08-18 20:21 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker