mirleft / ocaml-nocrypto

OCaml cryptographic library
ISC License
111 stars 53 forks source link

Add byte swap macros for Xen #148

Open emillon opened 6 years ago

emillon commented 6 years ago

This fixes compilation to Xen unikernels.

cc @hannesm

Thanks!

cfcs commented 6 years ago

ping @hannesm I get the following on debian when trying to compile hannesm/ocaml-nocrypto#safely :

user@pubdev:~$ opam pin | grep nocrypto
nocrypto.0.5.4                         (uninstalled)  git   https://github.com/hannesm/ocaml-nocrypto#safely                  
user@pubdev:~$ opam install nocrypto

=-=- Synchronising pinned packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[nocrypto] https://github.com/hannesm/ocaml-nocrypto#safely already up-to-date
The following actions will be performed:
  ∗  install nocrypto 0.5.4*

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[nocrypto] https://github.com/hannesm/ocaml-nocrypto#safely already up-to-date

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of nocrypto failed at "ocaml pkg/pkg.ml build --pinned true --tests false --with-lwt true --xen true --mirage true
        --freestanding false".

#=== ERROR while installing nocrypto.0.5.4 ====================================#
# opam-version 1.2.2
# os           linux
# command      ocaml pkg/pkg.ml build --pinned true --tests false --with-lwt true --xen true --mirage true --freestanding false
# path         /home/user/.opam/4.04.2+fPIC/build/nocrypto.0.5.4
# compiler     4.04.2+fPIC
# exit-code    1
# env-file     /home/user/.opam/4.04.2+fPIC/build/nocrypto.0.5.4/nocrypto-1806-a71bb4.env
# stdout-file  /home/user/.opam/4.04.2+fPIC/build/nocrypto.0.5.4/nocrypto-1806-a71bb4.out
# stderr-file  /home/user/.opam/4.04.2+fPIC/build/nocrypto.0.5.4/nocrypto-1806-a71bb4.err
### stdout ###
# [...]
# /usr/lib/gcc/x86_64-linux-gnu/6/include/avx512dqintrin.h: In function ‘_mm_range_round_ss’:
# /usr/lib/gcc/x86_64-linux-gnu/6/include/avx512dqintrin.h:1041:9: error: can’t convert a value of type ‘int’ to vector type ‘__vector(4) float’ which has different size
#          __R);
#          ^~~
# Command exited with code 2.
# + ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package ocb-stubblr myocamlbuild.ml /home/user/.opam/4.04.2+fPIC/lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 11, characters 34-46:
# Warning 40: dependencies was selected from type Ocamlbuild_plugin.Findlib.package.
# It is not visible in the current scope, and will not 
# be selected if the type becomes unknown.
### stderr ###
# pkg.ml: [ERROR] cmd ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-j' '4' '-tag' 'debug'
# [...]
#      'unix/nocrypto_entropy_unix.mli' 'lwt/nocrypto_lwt.a'
#      'lwt/nocrypto_lwt.cmxs' 'lwt/nocrypto_lwt.cmxa' 'lwt/nocrypto_lwt.cma'
#      'lwt/nocrypto_entropy_lwt.cmx' 'lwt/nocrypto_entropy_lwt.cmi'
#      'lwt/nocrypto_entropy_lwt.mli' 'mirage/nocrypto_mirage.a'
#      'mirage/nocrypto_mirage.cmxs' 'mirage/nocrypto_mirage.cmxa'
#      'mirage/nocrypto_mirage.cma' 'mirage/nocrypto_entropy_mirage.cmx'
#      'mirage/nocrypto_entropy_mirage.cmi'
#      'mirage/nocrypto_entropy_mirage.mli'
#      'X/mirage-xen/src/libnocrypto_stubs+mirage-xen.a']: exited with 10

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
  ∗  install nocrypto 0.5.4
No changes have been performed

EDIT: with

user@pubdev:~$ export NOCRYPTO_ACCELERATE=false

it install fine:

user@pubdev:~$ opam install nocrypto

=-=- Synchronising pinned packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[nocrypto] https://github.com/hannesm/ocaml-nocrypto#safely already up-to-date
The following actions will be performed:
  ∗  install nocrypto 0.5.4*

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[nocrypto] https://github.com/hannesm/ocaml-nocrypto#safely already up-to-date

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
∗  installed nocrypto.0.5.4
Done.