Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with end-on-line convention on bytecomp/bytelink.ml #4940

Closed
vicuna opened this issue Dec 14, 2009 · 2 comments
Closed

Problem with end-on-line convention on bytecomp/bytelink.ml #4940

vicuna opened this issue Dec 14, 2009 · 2 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 14, 2009

Original bug ID: 4940
Reporter: @alainfrisch
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2009-12-30T15:40:36Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

When using "ocamlc -output-obj" with a recent version of OCaml compiled from the branch version/3.11 of the SVN, using the Win32 MSVC port, I get errors like:

csml_bytecode.c : error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format
File "none", line 1, characters 0-1:
Error: Error while building custom runtime system

The culprit is very probably some non-Unix end-of-lines in the file bytelink.ml, in parts that generate literal C code. Applying the dos2unix tool to bytelink.ml solves the problem.

Possible fixes:

  • do not use Mac end-of-lines for OCaml sources;
    or:
  • do not insert end-of-lines in literal strings (instead, terminate lines with \n).

Btw, we also have to apply dos2unix to the file VERSION to be able to compile OCaml (but this is not new).

FWIW, we use the "DOS / text" install mode of Cygwin, not the "Unix / binary" mode.

@vicuna
Copy link
Author

vicuna commented Dec 28, 2009

Comment author: @damiendoligez

We do not use Mac end-of-lines for OCaml sources. In fact, there isn't a single occurrence of CR in
the whole source tree.

What probably happens is this:

  • there are end-of-lines in literal strings
  • they are translated by your Cygwin into CR-LF when OCaml reads and compiles the source,
    so the string contains CR-LF
  • when the compiler outputs them as CR-LF, your cygwin again translates the LF into CR-LF,
    resulting in CR-CR-LF in the output file.

The short-term solution is to terminate the lines of bytelink.ml with \n, the long-term solution
is to do that for all compiler source files, and to add a warning for naked end-of-lines in string
constants.

We have made the change to bytelink.ml for 3.11.2+rc1, we'll do the rest for 3.12.

@vicuna
Copy link
Author

vicuna commented Dec 30, 2009

Comment author: @damiendoligez

added the warning and escaped all end-of-lines in strings (in the trunk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants