Bug#865883: ocaml-mingw-w64: missing link flags while creating custom bytecode binaries
Package: ocaml-mingw-w64
Version: 4.01.0~20140328-1+b2
Severity: important
Trying to compile a "custome" bytecode executable with x86_64-w64-mingw32-ocamlc
or i686-w64-mingw32-ocamlc fail at link time.
The following commands
cat > main.ml <<EOF
print_endline "Hello world"
EOF
x86_64-w64-mingw32-ocamlc main.ml -o main.exe -custom
lead to these errors
** Cannot resolve symbols for descriptor object:
WSACleanup
WSAStartup
connect
gethostbyname
getsockopt
htons
inet_addr
setsockopt
socket
File "main.ml", line 1:
Error: Error while building custom runtime system
Instead by using this command
x86_64-w64-mingw32-ocamlc main.ml -o main.exe -custom -cclib -lws2_32
the executable is correctly created (tested using wine).
As far as I can tell, -lws2_32 should be automatically added by
ocamlc while creating custom bytecode executable.
The same issue applies while linking a shared library using -output-obj
option
x86_64-w64-mingw32-ocamlc main.ml -output-obj -o main.so
** Cannot resolve symbols for descriptor object:
WSACleanup
WSAStartup
connect
gethostbyname
getsockopt
htons
inet_addr
setsockopt
socket
File "main.ml", line 1:
Error: Error while building custom runtime system
-- System Information:
Debian Release: 9.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
Versions of packages ocaml-mingw-w64 depends on:
ii ocaml-mingw-w64-i686 4.01.0~20140328-1+b2
ii ocaml-mingw-w64-x86-64 4.01.0~20140328-1+b2
ocaml-mingw-w64 recommends no packages.
ocaml-mingw-w64 suggests no packages.
-- no debconf information
Reply to: