Comments (13)
I have the same problem on Debian 11, with OCaml 4.14.
from opam-cross-windows.
I have the same problem on Manjaro, with OCaml 4.14.0
from opam-cross-windows.
The flexdll.h
file should be installed by flexdll-windows
. Do y'all have it installed?
$ find ~/.opam/ -name flexdll.h
/home/opam/.opam/4.12.0/lib/flexdll-windows/flexdll.h
from opam-cross-windows.
I have it installed and it still doesn't work.
from opam-cross-windows.
Hmm indeed I can confirm that the check for flexdll.h
fails but allows the ./configure
script to keep running when installing via opam
inside the mxe cross compilation image:
- checking whether host executables can be run in the build...
- no
- checking whether #! works in shell scripts... yes
- checking for flexdll sources... checking for flexlink... no
- checking flexdll.h usability... no
- checking flexdll.h presence...
- no
- checking for flexdll.h... no
- checking for a BSD-compatible install... /usr/bin/install -c
- checking for cos in -lm... yes
- checking math.h usability...
- yes
- checking math.h presence... yes
- checking for math.h... yes
While it fails outside of it, including when running it manually inside the same image:
checking whether #! works in shell scripts... yes
checking for flexdll sources... no
checking for flexlink... no
checking flexdll.h usability... no
checking flexdll.h presence... no
checking for flexdll.h... no
configure: error: flexdll.h is required for native Win32
Investigating the difference...
from opam-cross-windows.
It looks like the difference is because of the host name: the docker image build uses x86_64-w64-mingw32.static
which breaks some of the windows-specific tests in ./configure
compared to x86_64-w64-mingw32
... 😬
from opam-cross-windows.
from opam-cross-windows.
Unfortunately, it also breaks when ran as:
./configure --build=x86_64-linux-gnu --host=x86_64-w64-mingw32
from opam-cross-windows.
from opam-cross-windows.
It is an issue related to cross-compiling the ocaml
compiler for mingw-w64
on a linux host.
Steps to reproduce on a clean debian distribution (for instance a docker image) with x86_64
architecture:
- Install
mingw-w64
- Initialize
opam
with OCaml4.14.0
- Add the
ocaml-cross
repository:
opam repository add windows https://github.com/ocaml-cross/opam-cross-windows.git
- Install
ocaml-windows
The error relates to the configure
script not being able to find flexdll.h
. The header and a cross-compiled binary are installed via the flexdll-windows
package. However, when pointed directly to its installation location, both binary detection (via $PATH
) and header (via $CFLAGS
) fail.
Header is accepted b/c the configure script eventually accepts the compiler over the linker but the binary is considered not runnable. The configure script should either know how to run it using wine
or simply skip trying to run it when build
and host
are not the same.
This went unnoticed b/c the automated build images for this are using a different host, as explained above, x86_64-w64-mingw32.static
. This non-standard name confuses the configure which turns off requirement for flexdll and makes it pass.
I haven't dived into the build process in a while but, essentially, we do some bootstrapping based off the configure
script output and then provide our own Makefile.config
and proceed with the final build:
./configure --host=$1
make -C runtime primitives sak SAK_CC=cc SAK_LINK='cc -o $(1) $(2)'
cp `which ocamlrun` runtime/ocamlrun
cp -f Makefile.cross Makefile.config
cp -f s-nt.h runtime/caml/s.h
cp -f m-nt.h runtime/caml/m.h
if grep "WITH_SPACETIME=true" Makefile.config >/dev/null 2>/dev/null; then
echo "#define WITH_SPACETIME" >> runtime/caml/m.h
echo "#define WITH_PROFINFO" >> runtime/caml/m.h
fi
make world opt \
compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
compilerlibs/ocamloptcomp.cmxa driver/main.cmx driver/optmain.cmx \
PROGRAMS= \
OCAMLRUN=ocamlrun \
NEW_OCAMLRUN=ocamlrun
Any suggestion as to how to improve this would be gladly welcome!
from opam-cross-windows.
Working on this. It looks like it should be possible to cross-compile ocaml with the existing configure/makefile system but I haven't found the right magical invocation yet.
from opam-cross-windows.
Happy to report that this is now fixed. I was also able to find a way to build the cross-compiler using the upstream configure/make system, which should make it even more robust and hopefully easy to update to future versions.
from opam-cross-windows.
The issue with host triplet has been fixed upstream. There are a couple more small issues related to flexlink
that I might push upstream at some point as well.
from opam-cross-windows.
Related Issues (20)
- Support for cross-compilation on x86 platform with target systems as 32-bit and 64-bit arm linux
- expat-windows no longer building HOT 2
- Include fileutils
- Cross-compiler has `ocamlc -config-var os_type` = `"%%OCAML_OS_TYPE%%"`
- Can not resolve symbols for libcamlrun.a(floats_b.o) HOT 4
- Sys.win32 reporting false on 32bit cross-compiler HOT 3
- Building fails due to fno-common being the default in recent versions of gcc HOT 3
- `opam install ocaml-windows` fails with compilation error for `ocaml-windows64` HOT 4
- Supporting ocaml 4.12 HOT 11
- Graphics HOT 4
- Error on building ocaml-windows HOT 5
- Error while compiling HOT 4
- ocamlfind: [WARNING] Undefined toolchain: windows
- ppx_tools_versioned-windows is broken with 4.12.0 HOT 7
- adding repository to opam HOT 1
- OCaml-windows 4.12.0 no longer builds HOT 2
- Ocaml 5 support HOT 4
- uutf-windows
- Packaging library with 3rd party dependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opam-cross-windows.