Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007263OCamlplatform support (windows, cross-compilation, etc)public2016-05-23 13:242016-09-27 21:39
Reportergerd 
Assigned To 
PrioritynormalSeverityblockReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.02.3 
Target Version4.04.0 +dev / +beta1 / +beta2Fixed in Version4.04.0 +dev / +beta1 / +beta2 
Summary0007263: Build with MSVC-14 (Visual Studio 2015) / Windows 10 not possible
DescriptionThe suggested Win 7 SDK (in README.win32) does not install under Win 10. Because of that I tried it with something newer, namely MSVC 14 Express For Desktop with Win 10 SDK.

However, this leads to a problem:

$ make -f Makefile.nt world
cd byterun ; make -f Makefile.nt all
make[1]: Entering directory '/home/gerd/tmp/ocaml-4.02.3/byterun'
flexlink -merge-manifest -stack 16777216 -exe -o ocamlrun.exe prims.obj ws2_32.lib \
          libcamlrun.lib
** Cannot resolve symbols for descriptor object:
 ___iob_func
 _sprintf
Steps To ReproduceFind attached my script for setting the environment variables.
Additional InformationThis could be an incompatibility of the libraries distributed with flexlink, because I find there the symbols __imp__sprintf and __imp____iob_func. See also this Stack Overflow article: http://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2 [^]
Tagspatch
Attached Files? file icon env.sh [^] (1,973 bytes) 2016-05-23 13:24

- Relationships

-  Notes
(0015947)
gerd (reporter)
2016-05-23 13:33

In deed, when I rebuild flexdll_msvc.obj and flexdll_initer_msvc.obj, the error vanishes:

cl /nologo /MD -D_CRT_SECURE_NO_DEPRECATE /GS- /DMSVC -c /Fo"flexdll_msvc.obj" flexdll.c
cl /nologo /MD -D_CRT_SECURE_NO_DEPRECATE /GS- /DMSVC -c /Fo"flexdll_initer_msvc.obj" flexdll_initer.c
(0015948)
gerd (reporter)
2016-05-23 14:01

msvcrt.lib is no longer sufficient. You also need to link in ucrt.lib and vcruntime.lib (https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx [^])

I changed MKEXE in config/Makefile as follows:
MKEXE=$(FLEXLINK) -exe ucrt.lib vcruntime.lib
(0015949)
gerd (reporter)
2016-05-23 14:05

Also, there is now snprintf, and you get an error if you try to #define it:

cl -nologo -D_CRT_SECURE_NO_DEPRECATE -Feobjinfo_helper.exe -Ox -MD \
          objinfo_helper.c
objinfo_helper.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\stdio.h(1925): warning C4005: "snprintf": Makro-Neudefinition
c:\cygwin\home\gerd\tmp\ocaml-4.02.3\byterun\caml\misc.h(163): note: Siehe vorherige Definition von "snprintf"
C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration

Solution: commented "#define snprintf caml_snprintf" out in byterun/caml/misc.h
(0015950)
gerd (reporter)
2016-05-23 15:08

With these fixes I could complete the build.
(0016026)
dra (developer)
2016-07-01 13:46

This is a bug (of sorts) in the binary distro of FlexDLL - there's a move (prompted by VS2015 support) towards the "binary" distribution of FlexDLL being flexlink.exe and the .c files.
README.win32.adoc in 4.03.0 includes more comprehensive instructions.
(0016328)
doligez (administrator)
2016-09-27 15:50

In 4.04, I've added a note to README.win32.adoc to say that you must recompile FlexDLL from source if you're using VS2015. The snprintf thing was fixed by @dra in commit 12a9af9d.

This seems to be enough to fix it all, although the FlexDLL makefile still gives some error messages when trying to get the OCaml version number.
(0016343)
dra (developer)
2016-09-27 21:39

The problem with the FlexDLL Makefile should be harmless as long as you're building OCaml 4.03.0 or later. It's also fixed in master (and so 0.36)

- Issue History
Date Modified Username Field Change
2016-05-23 13:24 gerd New Issue
2016-05-23 13:24 gerd File Added: env.sh
2016-05-23 13:33 gerd Note Added: 0015947
2016-05-23 14:01 gerd Note Added: 0015948
2016-05-23 14:05 gerd Note Added: 0015949
2016-05-23 15:08 gerd Note Added: 0015950
2016-06-07 16:53 doligez Tag Attached: patch
2016-07-01 13:46 dra Note Added: 0016026
2016-09-27 14:01 doligez Status new => acknowledged
2016-09-27 14:01 doligez Target Version => 4.04.0 +dev / +beta1 / +beta2
2016-09-27 15:50 doligez Note Added: 0016328
2016-09-27 15:50 doligez Status acknowledged => resolved
2016-09-27 15:50 doligez Resolution open => fixed
2016-09-27 15:50 doligez Fixed in Version => 4.04.0 +dev / +beta1 / +beta2
2016-09-27 21:39 dra Note Added: 0016343
2017-02-23 16:46 doligez Category OCaml windows => platform support (windows, etc)
2017-02-23 17:16 doligez Category platform support (windows, etc) => platform support (windows, cross-compilation, etc)


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker