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

sanitize.sh has windows style end-of-lines (mingw) #5338

Closed
vicuna opened this issue Aug 16, 2011 · 13 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Aug 16, 2011

Original bug ID: 5338
Reporter: matt
Assigned to: @alainfrisch
Status: closed (set by @alainfrisch on 2011-12-14T08:27:00Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues

Bug description

This prevents sanitize.sh to be executed from cygwin, before a dos to unix end-of-line conversion.

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: @alainfrisch

I cannot reproduce the bug. Can you provide more information? Which version of Cygwin do you use?

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: matt

I just tried again.

This is from a VM that i installed with a fresh cygwin this summer.
Cygwin DLL is version 1.7.9.

I'm using OCaml 3.12.1, but it is not a stock one:

$ ocamlc -config
version: 3.12.1
standard_library_default: C:/cygwin/home/matt/ocamlmgw/lib
standard_library: C:/cygwin/home/matt/ocamlmgw/lib
standard_runtime: ocamlrun
ccomp_type: cc
bytecomp_c_compiler: i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused
bytecomp_c_libraries: -lws2_32
native_c_compiler: i686-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused
native_c_libraries: -lws2_32
native_pack_linker: i686-w64-mingw32-ld -r -o
ranlib: i686-w64-mingw32-ranlib
cc_profile:
architecture: i386
model: default
system: mingw
asm: i686-w64-mingw32-as
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .dll
os_type: Win32
default_executable_name: camlprog.exe
systhread_supported: true

In case of doubt, I'm going to attach my two patches (flexdll, and OCaml's Makefile).

I hope I did not let you loose your time for a mistake from mine.

Salutations

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: @alainfrisch

If you find the time to do so, could you test with flexdll 0.27 and the OCaml trunk? If the problem remains, can you copy here the error message?

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: matt

Sure. It is on my TODO list.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: matt

I just started from scratch with a fresh computer

Then compiled mingw flavor, following the README.win32 instructions.

After that, I did:

$ mkdir test
$ touch coin.ml
$ ocamlopt -c coin.ml
$ ocamlbuild coin.native
SANITIZE: a total of 3 files that should probably not be in your source tree
has been found. A script shell file "_build/sanitize.sh" is being created.
Check this script and run it to remove unwanted files or use other options
(such as defining hygiene exceptions or using the -no-hygiene option).
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover object files:
File coin.o in . has suffix .o
ERROR: Leftover Ocaml compilation files:
File coin.cmi in . has suffix .cmi
File coin.cmx in . has suffix .cmx
Exiting due to hygiene violations.

$ _build/sanitize.sh
_build/sanitize.sh: line 3: $'\r': command not found
: No such file or directory cd: C:\cygwin\home\matt\test
_build/sanitize.sh: line 5: $'\r': command not found

$ sed -i -e 's/\r\n/\n/g' _build/sanitize.sh

(This time, it works)

$ _build/sanitize.sh

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: @alainfrisch

Thanks! Do you think you could come up with a patch? Ideally, ocamlbuild should be adapted to produce "sanitize" scripts which are usable from cygwin.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: matt

I think so. I had a look : in hygiene.ml, l153, oc is opened with Open_text flag.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 12, 2011

Comment author: matt

Here is it. I just replaced Open_text with Open_binary. It works with cygwin. I think it will not make any difference on unix? I do not know about OSX.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 13, 2011

Comment author: @alainfrisch

Thanks. I've applied the patch. I think one needs to bootstrap ocamlbuild to have the patch take effect (i.e. replace boot/myocamlbuild.boot). Do you know how to do that?

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 13, 2011

Comment author: matt

No idea. To be sure, I tested by recompiling everything (including bootstrap).
for i in world bootstrap opt opt.opt install; do make -f Makefile.nt $i; done

When I came back, some time later, the generated sanitize.sh was working right.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 13, 2011

Comment author: @alainfrisch

Unfortunately, 'make bootstrap' does not seem to update boot/myocamlbuild.boot.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 13, 2011

Comment author: @lefessan

It looks like you have to run this script: "build/myocamlbuild.sh" from ocaml top directory (grep told me that it is the only file that can update myocamlbuild.boot...).

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 14, 2011

Comment author: @alainfrisch

Thanks!

(For the records, this script requires ocaml to be installed (make install) first, and the installed version to be first in PATH.)

@vicuna vicuna closed this Dec 14, 2011

@vicuna vicuna added the ocamlbuild label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.