ocaml - An executable compiled in Mac OS cannot run in Ubuntu server? -


i have written one-line ocaml program: print_string "hello world!\n" in mac os. compiled ocamlopt -o test test.ml, generated test works fine.

then scp test ubuntu & nginx server, ocaml not installed. launched ./test, , got error: -bash: ./code: cannot execute binary file: exec format error.

so have install ocaml on server, , compile program on there? isn't possible compile program in mac os in way such executable alone run in ubuntu server?

executable (binary) formats not portable across systems, no. ocamlopt produces format native system on compilation, , shouldn't expect run on other system unless of identical type.

you can portability compiling bytecodes instead (using ocamlc rather ocamlopt). bytecode executables run more slowly, however.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -