Solved: Haxe 4.14 on Raspbian

[EDIT : For complete build instructions, see the post below]

Hi. Im trying to get Haxe 4 (4.1.4) working on a Raspberry Pi (without gui).
3.4.7 works ok, but i need Haxe 4. Have not been successful so far.

Following the official guide (Haxe - The Cross-platform Toolkit) doesnt seem to work, i always get the following error:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 haxe : Depends: libc6 (>= 2.29) but 2.24-11+deb9u4 is to be installed
        Depends: libmbedtls12 (>= 2.13) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Does anyone have a solution for this? Would be very grateful :slight_smile:

So, if anybody else needs to know - the answer here seems to be : You have to build from Haxe from source. So you need to install Ocaml, and then follow this : haxe/BUILDING.md at development · HaxeFoundation/haxe · GitHub .

Note that you also have to download and build Neko from source :GitHub - HaxeFoundation/neko: The Neko Virtual Machine

And i also had to copy files from neko/bin to /usr/shared/neko

1 Like

So, to follow up for other people having problems with this, here is a complete installation guide for setting up and building haxe and neko/haxelib from scratch on a clean raspbian install :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git

# Install Ocaml / Opam :

mkdir setup
sudo chmod 777 setup
cd setup
sudo apt-get install m4
sudo apt-get install ocaml
sudo apt-get install bubblewrap

git clone https://github.com/ocaml/opam
cd opam
./configure
make -j 4 lib-ext
make -j 4
sudo make install
opam init
eval $(opam env)

# Haxe :
(mkdir/cd folder where you want haxe to be stored)

sudo apt install libpcre3-dev zlib1g-dev

git clone --recursive https://github.com/HaxeFoundation/haxe.git -b 4.1.4
sudo chmod -R 777 haxe/
opam pin add haxe path/to/haxe --kind=path --no-action
opam install haxe --deps-only
make
sudo make install
export HAXE_STD_PATH=/usr/lib/haxe/std

# Neko 
(mkdir/cd folder where you want neko to be stored)

mkdir nekobuild
cd nekobuild

git clone https://github.com/HaxeFoundation/neko
sudo apt-get -y install cmake
sudo apt-get install libgc-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libssl-dev
sudo apt-get install gtk+-2.0
sudo apt-get install apache2-dev
sudo apt-get install libmariadb-dev
cmake neko
make
sudo make install

and then :

haxelib setup

I don’t know what I’m doing wrong at all, but I for the life of me cannot get 4.1.5 to compile on RPi using these steps


whats the error you are getting?

I’m unable to compile ocaml

src_ext/dune-local/dune.exe build --profile=release   --promote-install-files opam-installer.install
Scanned 0 directoriesScanned 0 directoriesScanned 0 directoriesScanned 0 directoFile "_build/default/LICENSE", line 1, characters 0-0: 0)
Error: Rule failed to generate the following targets:
- default/doc/opam-installer/LICENSE
File "src/dune", line 6, characters 0-101:
6 | (rule
7 |   (with-stdout-to ocaml-context-flags.sexp (run ocaml %{dep:../shell/context_flags.ml} flags)))
Error: Rule failed to generate the following targets:
- src/ocaml-context-flags.sexp
File "src/tools/dune", line 1, characters 0-0:
Error: Rule failed to generate the following targets:
- src/tools/opam_installer.ml
make: *** [Makefile:122: build-opam-installer] Error 1
make: *** Attente des tùches non terminées....
File "src/dune", line 6, characters 0-101:
6 | (rule
7 |   (with-stdout-to ocaml-context-flags.sexp (run ocaml %{dep:../shell/context_flags.ml} flags)))
Error: Rule failed to generate the following targets:
- src/ocaml-context-flags.sexp
Done: 302/1068 (jobs: 4)make: *** [Makefile:130: opam.install] Error 1
       ocaml src_ext/extlib/src/compat-level
sh: 1: ocamlfind: not found
File "_none_", line 1:  )
Warning 58: no cmx file was found in path for module Graph__Delaunay, and its interface was not compiled with -opaque
File "src_ext/cmdliner/src/cmdliner_cline.mli", line 7, characters 5-11:
Error: Unbound module Result
File "src_ext/cmdliner/src/cmdliner_manpage.ml", line 7, characters 5-11:
Error: Unbound module Result
File "src_ext/ocamlgraph/src/graphml.ml", line 1:
Error: Could not find the .cmi file for interface
       src_ext/ocamlgraph/src/graphml.ml.
File "src_ext/ocamlgraph/src/imperative.ml", line 1:
Error: Could not find the .cmi file for interface
       src_ext/ocamlgraph/src/imperative.ml.
File "src_ext/ocamlgraph/src/persistent.ml", line 1:
Error: Could not find the .cmi file for interface
       src_ext/ocamlgraph/src/persistent.ml.
File "src_ext/re/lib/re__.ml-gen", line 1:
Error: Corrupted compiled interface
src_ext/re/lib/.re.objs/byte/re__.cmi
File "src_ext/ocamlgraph/src/.graph.objs/_unknown_", line 1, characters 0-0:
Error: Rule failed to generate the following targets:
- src_ext/ocamlgraph/src/.graph.objs/dot_parser.mli.d
File "src_ext/seq/src/.select_version.eobjs/byte/_unknown_", line 1, characters 0-0:
Error: Rule failed to generate the following targets:
- src_ext/seq/src/.select_version.eobjs/byte/select_version.cmi
- src_ext/seq/src/.select_version.eobjs/byte/select_version.cmo
- src_ext/seq/src/.select_version.eobjs/byte/select_version.cmt
make: *** [Makefile:124: opam-installer.install] Error 1
         gcc src_ext/mccs/src/glpk/wclique1.o
src_ext/mccs/src/glpk/misc/wclique1.c: In function ‘_glp_wclique1’:
src_ext/mccs/src/glpk/misc/wclique1.c:111:7: warning: ‘memset’ specified size between 2147483648 and 4294967295 exceeds maximum object size 2147483647 [-Wstringop-overflow=]
src_ext/mccs/src/glpk/misc/wclique1.c:113:7: warning: ‘memset’ specified size between 2147483648 and 4294967295 exceeds maximum object size 2147483647 [-Wstringop-overflow=]
File "_none_", line 1:   
Error: Cannot find file src_ext/re/lib/.re.objs/native/re__.cmx
make: *** [Makefile:128: build-opam] Error 1

Seems to have to do with src_ext. But the funny thing thing is that doing, " ```
make -j 4 lib-ext
I don’t remember any errors. And it doesn’t seem to do anything when I try again ( even after a make clean and a git clean).

Edit:
It seems that ocaml works with he apt installation ( didn’t work a few months again)

you have to install also
sudo apt-get install libipc-system-simple-perl libmbedtls-dev libstring-shellquote-perl

now it’s stops at “make”

File “src/codegen/codegen.ml”, line 262, characters 25-42:
Error: Unbound module Base64

File “src/optimization/inline.ml”, line 135, characters 33-46:
Error: This expression has type TType.texpr option
but an expression was expected of type TType.texpr

Okays, it works for me with installed opam AND haxe version 4.2.1 (not 4.1.4) AND MAYBE sudo apt-get install libipc-system-simple-perl libmbedtls-dev libstring-shellquote-perl
@AyeTSG