-
Notifications
You must be signed in to change notification settings - Fork 34
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
Help Understanding Crosscompiling via Make #64
Comments
Hi @tajmone, You first try should be to edit the You have to apply a little thinking to it because not all tools will need this change. For instance, |
Thanks a lot @toots ! this tip was precious, it sets me in motion in the right direction. I'll let you know how it went. |
Really, the right thing to do is to replace e.g. |
I've tried this but it failed. The problem could be that the make file reuses the same macro for invoking the compiler on different source files, I might be better offer breaking up the makefile into single and plain invocations, at lease untill I make it work. |
|
Does this also apply to My previous attempts to change the makefile from MLDEP = ocamldep -native
MLC = ocamlopt
MLCOPTS = -inline 23 -unsafe to MLDEP = ocamldep -native
MLC = ocamlfind -toolchain windows ocamlopt
MLCOPTS = -inline 23 -unsafe have failed. But I need to look better into the error reports. @toots, you mentioned:
how does cross compiling to Windows handle EOL? does it use Inside Bash for Windows EOLs are handled smartly, and either |
You shouldn't need to cross-compile for bytecode as it is by definition platform-independent. The only exception being if your project has embedded C bindings. Otherwise, all you should need is a local As for |
Yes, it applies to every tool ocamlfind has support for.
And you should also use |
After editing the make file as mentioned: MLC = ocamlfind -toolchain windows ocamlopt
# MLC = ocamlopt this is the compile error I get:
it looks like something is not right with cross-windows setup. If I type
|
You forgot to run |
No, OPAM init has set that in the .basharc file. I've typed it anyhow, but the error is the same. |
Well, the underlying cause here is that something is wrong with your OPAM installation. |
I've tried the examples from the instruction page: echo 'let () = print_endline "Hello, world!"' >helloworld.ml
ocamlfind -toolchain windows ocamlc helloworld.ml -o helloworld.byte
ocamlfind -toolchain windows ocamlopt helloworld.ml -o helloworld.native and I also get the Any ideas how to check the setup, or reinstall it? |
I'm going through all the cross-windows setup steps again, hoping it will fix it. This time I'm trying to install the 32bit version, which previously failed to compile. |
You should start with checking which
|
|
Again, trying to install the 32bit version failed to compile. After switching to
a previous attempt to install it after switching to the 64 bit version also failed. On another machine, under WSL/Ubuntu, both failed, with a different error complaining about GCC not supporting ISO C, or other C related errors. |
There seems to be an inconsistency here. The As for the other issue, it looks like you just need to install the |
I'm installing gawk right now, but when I compiled the 64 bit version, previously, it succeeded and didn't mention gawk. I originally intended to cross compile to 32bit, but since it always failed to compile the 32bit version I ended up using the 64bit version — which seems not to work though. This second time I've tried to just reinstall the 64bit version it failed to compile, so I switched to the 32bit (which I'd preferr, but at any version would be fine ultimately, as a starting point). |
Finally! The 32bit version compiled, and the tests from the homepage instruction all passed without error:
Thanks, now it looks that cross-windows is properly setup, and I can focus on the makefile. PS: I'm really sorry for bothering you so much, and grateful for you patience and kind support. I've spent over a week trying to setup OCaml under Windows, and stumbled into a lot problems (which seem to be common under Win 10), finally managing to install it under WSL/Ubuntu. So I opted to just install OCaml under linux and cross compile, but I'm entering a new arena, facing multiple new tools and challenges all at once. |
I just wanted to confirm that I've tested the |
Solved! Thank you very much, I couldn't have done it without your help. ❤️ |
Hello. I'm new both to OCaml and opam cross-compiler for Windows, so I was hoping you could help me out (bare patient with me, I'm trying to pose the problem the best I can, but I'm a bit out of my depth on this).
I've succeeded to install opam-cross-windows, as per instructions, on Ubuntu 16-10 x64 — but only the 64 bit version, the 32 bit failed to compile on two different machine, reporting problems with GCC. But 64 bits would be fine.
So, my setup seems ok, up and running (I didn't take the MXE Env route, though).
The problem is that I'm trying to build an existing project, which uses a makefile, and the instruction page of opam-cross-windows only mentions porting project from OASIS or OPAM
.install
.The compilation examples in the instructions always refer to using
ocamlfind -toolchain windows
, but the project I'm trying to cross compile only refers toocamlopt
as compiler commands. So I haven't managed to work out how to cross compile it. The proejct doesn't have external dependencies.Here is how the makefile sets up the variables then uses to invoke the compiler:
(the full makefile source:)
Which way should that be changed to cross compile and create a Windows executable?
I haven't worked out the part of the instructions that says:
I've tried googling this, but haven't managed to find examples.
Any help would be much apreciated. Thanks.
The text was updated successfully, but these errors were encountered: