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

Problems building Re with MSVC toolchain under Windows #68

Open
martin-neuhaeusser opened this issue Jun 25, 2015 · 9 comments
Open

Problems building Re with MSVC toolchain under Windows #68

martin-neuhaeusser opened this issue Jun 25, 2015 · 9 comments

Comments

@martin-neuhaeusser
Copy link

Dear all,

when building Re with OCaml 4.02.2 under Windows (MSVC toolchain used under Cygwin), the first build attempt fails because a file "setup.obj" is created and not removed afterwards. I guess, this is due to the *.obj extension produced by the MSVC compiler.

If one removes "setup.obj" after the build failed and starts again, the compile succeeds.
Installing with "make install" succeeds in installing the library in findlib, but fails afterwards with the following message:

$ make install
./setup.exe -install
Installed C:\ocamlms\lib\site-lib\re\re.mli
Installed C:\ocamlms\lib\site-lib\re\re.cma
Installed C:\ocamlms\lib\site-lib\re\re.cmxa
Installed C:\ocamlms\lib\site-lib\re\re.lib
Installed C:\ocamlms\lib\site-lib\re\re.cmxs
Installed C:\ocamlms\lib\site-lib\re\re.cmi
Installed C:\ocamlms\lib\site-lib\re\re.cmti
Installed C:\ocamlms\lib\site-lib\re\re.cmt
Installed C:\ocamlms\lib\site-lib\re\re.annot
Installed C:\ocamlms\lib\site-lib\re\re_automata.cmx
Installed C:\ocamlms\lib\site-lib\re\re_cset.cmx
Installed C:\ocamlms\lib\site-lib\re\re.cmx
Installed C:\ocamlms\lib\site-lib\re\re_str.mli
Installed C:\ocamlms\lib\site-lib\re\re_str.cma
Installed C:\ocamlms\lib\site-lib\re\re_str.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_str.lib
Installed C:\ocamlms\lib\site-lib\re\re_str.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_str.cmi
Installed C:\ocamlms\lib\site-lib\re\re_str.cmti
Installed C:\ocamlms\lib\site-lib\re\re_str.cmt
Installed C:\ocamlms\lib\site-lib\re\re_str.annot
Installed C:\ocamlms\lib\site-lib\re\re_str.cmx
Installed C:\ocamlms\lib\site-lib\re\re_posix.mli
Installed C:\ocamlms\lib\site-lib\re\re_posix.cma
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_posix.lib
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmi
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmti
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmt
Installed C:\ocamlms\lib\site-lib\re\re_posix.annot
Installed C:\ocamlms\lib\site-lib\re\re_posix.cmx
Installed C:\ocamlms\lib\site-lib\re\re_perl.mli
Installed C:\ocamlms\lib\site-lib\re\re_perl.cma
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_perl.lib
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmi
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmti
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmt
Installed C:\ocamlms\lib\site-lib\re\re_perl.annot
Installed C:\ocamlms\lib\site-lib\re\re_perl.cmx
Installed C:\ocamlms\lib\site-lib\re\re_pcre.mli
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cma
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_pcre.lib
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmi
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmti
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmt
Installed C:\ocamlms\lib\site-lib\re\re_pcre.annot
Installed C:\ocamlms\lib\site-lib\re\re_pcre.cmx
Installed C:\ocamlms\lib\site-lib\re\re_glob.mli
Installed C:\ocamlms\lib\site-lib\re\re_glob.cma
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_glob.lib
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmi
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmti
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmt
Installed C:\ocamlms\lib\site-lib\re\re_glob.annot
Installed C:\ocamlms\lib\site-lib\re\re_glob.cmx
Installed C:\ocamlms\lib\site-lib\re\re_emacs.mli
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cma
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmxa
Installed C:\ocamlms\lib\site-lib\re\re_emacs.lib
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmxs
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmi
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmti
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmt
Installed C:\ocamlms\lib\site-lib\re\re_emacs.annot
Installed C:\ocamlms\lib\site-lib\re\re_emacs.cmx
Installed C:\ocamlms\lib\site-lib\re\META
W: Nothing to install for findlib library 'fort_unit'
Zugriff verweigert
E: Failure("Command 'md \"C:\\Program Files (x86)\\re\"' terminated with error code 1")
Makefile:19: die Regel für Ziel "install" scheiterte
make: *** [install] Fehler 1

Finally, the INSTALL file mentions the possibility to build with "make opt", which seems to not exist as a build target.

Best regards
Martin

@rgrinberg
Copy link
Member

@Drup why does oasis try to install fort_unit? I explicitly set it to Install: false in the _oasis file.

@Drup
Copy link
Collaborator

Drup commented Jun 25, 2015

Which is why it says there is nothing to install, I guess ? I'm not really sure. It's not the issue anyway.

@rgrinberg
Copy link
Member

Oh I see, that's just a warning.

@martin-neuhaeusser
Copy link
Author

I tried again installing Re on a fresh build environment.

  • The error with the stale setup.obj after the first execution of "make all" remains.
  • Removing "setup.obj" from the project's root folder (where it is created) and restarting "make all" succeeds.
  • The error that I reported above can be avoided by executing the entire build with administrator privileges. Then everything installs correctly on Windows with MSVC and Cygwin.

However, the need for adminstrator privileges is strange: The privileges are required, as during the installation process, an attempt is made to create a directory "re" within Windows' "Program Files (x86)" folder. When executed with Administrator privileges, this succeeds. As a result, the installation process copies a folder hierarchy "C:\Program Files (x86)\re\share\doc$pkg_name\api" and a long list of HTML documentation files of the Re API.

This behavior is rather strange and, I guess, unintended. At least, it impairs the installation process on Windows systems.

Any suggestions? I am not even sure, if the last bug is related to Re, or rather an issue of the underlying OASIS...

Best regards
Martin

@Drup
Copy link
Collaborator

Drup commented Jun 25, 2015

Can you solve this issue using the --prefix or the --docdir configuration option ?

The installation of the documentation is on purpose, and the default directory is up to OASIS indeed.

I have no idea about setup.obj, it also sounds like an OASIS issue.

@martin-neuhaeusser
Copy link
Author

When configuring a (standard) build of Re on Windows, it says:

$ make all
./setup.exe -all

Configuration:
ocamlfind: ........................................... C:\ocamlms\bin\ocamlfind.EXE
ocamlc: .............................................. C:\ocamlms\bin\ocamlc.opt.EXE
ocamlopt: ............................................ C:\ocamlms\bin\ocamlopt.opt.EXE
ocamlbuild: .......................................... C:\ocamlms\bin\ocamlbuild.EXE
Package name: ........................................ re
Package version: ..................................... 1.4.1
os_type: ............................................. Win32
system: .............................................. win32
architecture: ........................................ i386
ccomp_type: .......................................... msvc
ocaml_version: ....................................... 4.02.2
standard_library_default: ............................ C:/ocamlms/lib
standard_library: .................................... C:/ocamlms/lib
standard_runtime: .................................... ocamlrun
bytecomp_c_compiler: ................................. cl -nologo -D_CRT_SECURE_NO_DEPRECATE -Ox -MD
native_c_compiler: ................................... cl -nologo -D_CRT_SECURE_NO_DEPRECATE -Ox -MD
model: ............................................... default
ext_obj: ............................................. .obj
ext_asm: ............................................. .asm
ext_lib: ............................................. .lib
ext_dll: ............................................. .dll
default_executable_name: ............................. camlprog.exe
systhread_supported: ................................. true
flexlink: ............................................ C:\Program Files (x86)\flexdll\flexlink.EXE
FlexDLL version (Win32): ............................. 0.34
Install architecture-independent files dir: .......... C:\Program Files (x86)\re
Install architecture-dependent files in dir: ......... $prefix
User executables: .................................... $exec_prefix\bin
System admin executables: ............................ $exec_prefix\sbin
Program executables: ................................. $exec_prefix\libexec
Read-only single-machine data: ....................... $prefix\etc
Modifiable architecture-independent data: ............ $prefix\com
Modifiable single-machine data: ...................... $prefix\var
Object code libraries: ............................... $exec_prefix\lib
Read-only arch-independent data root: ................ $prefix\share
Read-only architecture-independent data: ............. $datarootdir
Info documentation: .................................. $datarootdir\info
Locale-dependent data: ............................... $datarootdir\locale
Man documentation: ................................... $datarootdir\man
Documentation root: .................................. $datarootdir\doc\$pkg_name
HTML documentation: .................................. $docdir
DVI documentation: ................................... $docdir
PDF documentation: ................................... $docdir
PS documentation: .................................... $docdir
findlib_version: ..................................... 1.5.5
is_native: ........................................... true
suffix_program: ...................................... .exe
Remove a file.: ...................................... del
Remove a directory.: ................................. rd
Turn ocaml debug flag on: ............................ true
Turn ocaml profile flag on: .......................... false
Compiler support generation of .cmxs.: ............... true
OCamlbuild additional flags: .........................
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
pkg_bytes: ........................................... C:\ocamlms\lib\site-lib\bytes
ocamldoc: ............................................ C:\ocamlms\bin\ocamldoc.EXE

The directory "C:\Program Files (x86)\re" occurs as the path for storing "architecture-independent files". The path can be changed by providing a --datadir <some_other_path> option to configure.
After providing a path that a user has write-permissions to, make install succeeds.

Providing an alternative path with --prefix works, as well.
A similar effect is achieved by the --docdir configuration option; however, in this case, the configuration still uses the "wrong" path for architecture-independent files, but installs the documentation in the correct place.

@Drup
Copy link
Collaborator

Drup commented Jun 29, 2015

Good, should something be changed in the doc ? The opam package uses the --prefix option, so the day opam is working on windows, there should be no issue.

@martin-neuhaeusser
Copy link
Author

I looked more closely into the initial (and a little bit more severe) problem of the stale "setup.obj" file.
The problem stems from the Makefile that is auto-generated by OASIS. It implicitly assumes an object file extension of *.o, whereas on MSVC, it is *.obj. But this is an issue of OASIS rather than of ocaml-re.

A short remark about setting the --prefix option when building on Windows might be helpful to others.

@rgrinberg
Copy link
Member

@martin-neuhaeusser Would you mind submitting a PR for the remark? I don't think any of the maintainers use windows so the issue is unlikely to get resolved otherwise.

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

No branches or pull requests

3 participants