[yocto] Creating meta-ocaml layer - how to handle system-wide OCaml library manager?

Wolfgang Tolkien w at tolkien.email
Tue Aug 14 10:23:55 PDT 2018


I need some help and direction:

I've started working on a 'meta-ocaml' layer to add support for the OCaml language to Yocto:

https://gitlab.com/wtolkien/meta-ocaml

However, many OCaml projects seem to rely on the 'findlib' library manager (http://projects.camlcity.org/projects/findlib.html) which keeps all information in a fixed system-global path.

This seems to conflict with Yocto's sysroot concept. Also, 'findlib' handles dependencies, which is obviously something Yocto would normally do.

What's the best way to handle this? Try to make do without findlib? Ideally I'd like to end up with an 'ocaml.bbclass' file that just needs to be included, but maybe that's not achievable?

For example, here is findlib's default directory setup when installing it outside of Yocto:

About the OCAML core installation:
    Standard library:      /usr/local/lib/ocaml
    Binaries:              /usr/local/bin
The directory of site-specific packages will be
    site-lib:              /usr/local/lib/ocaml/site-lib
The configuration file is written to:
    findlib config file:   /usr/local/etc/findlib.conf
Software will be installed:
    Libraries:             in <site-lib>/findlib
    Binaries:              /usr/local/bin
    topfind script:        /usr/local/lib/ocaml


With Yocto (this doesn't seem right...):

About the OCAML core installation:
    Standard library:      /opt/src/sumo/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/image/opt/src/sumo-test/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/recipe-sysroot-native/usr/lib
    Binaries:              /opt/src/sumo/build/tmp/work/x86_64-linux/findlib-native/1.8.0-r0/recipe-sysroot-native/usr/bin
The directory of site-specific packages will be
    site-lib:              /opt/src/sumo/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/image/opt/src/sumo-test/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/recipe-sysroot-native/usr/site-lib
The configuration file is written to:
    findlib config file:   /opt/src/sumo/build/tmp/work/x86_64-linux/findlib-native/1.8.0-r0/recipe-sysroot-native/usr/etc/findlib.conf
Software will be installed:
    Libraries:             in <site-lib>/findlib
    Binaries:              /opt/src/sumo/build/tmp/work/x86_64-linux/findlib-native/1.8.0-r0/recipe-sysroot-native/usr/bin
    topfind script:        /opt/src/sumo/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/image/opt/src/sumo-test/build/tmp/work/x86_64-linux/ocaml-native/4.03.0-r0/recipe-sysroot-native/usr/lib


Many thanks,
Wolfgang



More information about the yocto mailing list