[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] Compiling C components for mirage-xen
On 8 January 2016 at 11:19, Tim Cuthbertson <tim@xxxxxxxxxxx> wrote: > I'd like to use `Bcrypt` from the `safepass` opam module in passe[0]. > There is sadly no `safepass-xen` package, and trying to just use > `safepass` results in link errors: > > > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o): In function > `BF_crypt': > (.text+0x1b97): undefined reference to `__errno_location' > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o): In function > `BF_crypt': > (.text+0x2112): undefined reference to `__errno_location' > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o): In function > `_crypt_blowfish_rn': > (.text+0x21ea): undefined reference to `__errno_location' > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o): In function > `_crypt_gensalt_blowfish_rn': > (.text+0x2575): undefined reference to `__errno_location' > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o): In function > `_crypt_gensalt_blowfish_rn': > (.text+0x25a6): undefined reference to `__errno_location' > <...>/lib/safepass/libsafepass_stubs.a(crypt_blowfish.o):(.text+0x25b7): > more undefined references to `__errno_location' follow > > > I'm assuming I'd need to customise the build process tp produce an > appropriate C library as with `gmp-xen`, `zarith-xen` etc. The trouble > is twofold: > > - I don't really know what the thing I'm doing is. Is mirage-xen a > different architecture? A different ABI? Do C libraries need to be > cross-compiled, or just compiled with particular flags so that they'll > work on xen-minios instead of gnu/linux? C libraries need to be compiled with different headers and flags (in particular, -mno-red-zone). Using libraries compiled for Linux will often appear to work, but may fail when interrupts occur, so the build makes it hard to use them by accident. However, OCaml binaries can be shared (ocamlopt doesn't use a red zone and the OCaml ABI is the same). > - The existing scripts seem to be pretty ad-hoc - zarith gets away > mainly with particular CFLAGS > (https://github.com/ocaml/opam-repository/blob/master/packages/zarith-xen/zarith-xen.1.4/files/mirage-install.sh), It's using pkg-config to get the important flags. The others are optimisations (except -fno-builtin, which is either not needed or should be supplied by Mini-OS). > while gmp looks like a full cross-compilation using `--target` (and > then does some other sneaky things). > > safepass uses OASIS for its build system, which doesn't seem to have > any cross-compilation functionality built in as far as I could tell. > Can anyone give me pointers on what I'd need to do to safepass' build > scripts to get this working in mirage-xen, or at the least some > clarification on why it doesn't work as-is and how cross compilation > works for C libraries used in mirage-xen? > > [0]: https://github.com/timbertson/passe The io-page library provides a fairly simple template: https://github.com/mirage/io-page/blob/master/_oasis It builds io_page_unix and io_page_xen libraries. The C flags are added to the main META file with: XMETAExtraLines: xen_linkopts = "-lio_page_xen_stubs" There's a command to get the Xen flags: PostConfCommand: ocaml postconf.ml The Xen source file (stub_alloc_pages_xen.c) is just a symlink to the Unix one (you need a separate file because OASIS can't compile the same source path with different flags). -- Dr Thomas Leonard http://roscidus.com/blog/ GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |