hacl-star / hacl-star

HACL*, a formally verified cryptographic library written in F*
Apache License 2.0
1.63k stars 170 forks source link

Typedef errors building on FreeBSD #420

Closed web-sst closed 3 years ago

web-sst commented 3 years ago

Can someone provide guidance on how to resol.ve these errors?

typedef __m128i Lib_IntVector_Intrinsics_vec128;
                ^
./config.h:1:41: note: expanded from macro 'Lib_IntVector_Intrinsics_vec128'
#define Lib_IntVector_Intrinsics_vec128 void *
                                        ^
In file included from Hacl_Spec.c:25:
In file included from ./Hacl_Spec.h:33:
./libintvector.h:33:48: error: expected identifier or '('
typedef __m128i Lib_IntVector_Intrinsics_vec128;
                                               ^
./libintvector.h:232:17: error: cannot combine with previous 'type-name' declaration specifier
typedef __m256i Lib_IntVector_Intrinsics_vec256;
                ^
./config.h:2:41: note: expanded from macro 'Lib_IntVector_Intrinsics_vec256'
#define Lib_IntVector_Intrinsics_vec256 void *
                                        ^
In file included from Hacl_Spec.c:25:
In file included from ./Hacl_Spec.h:33:
./libintvector.h:232:48: error: expected identifier or '('
typedef __m256i Lib_IntVector_Intrinsics_vec256;
                                               ^
4 errors generated.
msprotz commented 3 years ago

What is the output of the configure script on your platform, as executed in dist/gcc-compatible, and for the very latest revision on master?

web-sst commented 3 years ago

Output from dist/gcc-compatible/configure:

 does not support x64 assembly, disabling Curve64
 does not support legacy vale stubs
cc  cannot compile 128-bit vector arithmetic, disabling
 does not support 256-bit arithmetic
... found ocamlfind in /usr/local/bin/ocamlfind
ocamlfind: Package `ctypes' not found
OCaml package ctypes not found
OCaml bindings disabled

Evidently $build_target is not set to something sensible.

The specific errors reported are reformatted in the latest version, though essentially unchanged:

In file included from ./Hacl_Spec.h:33:
./libintvector.h:232:48: error:
      expected
      identifier
      or '('
  ...;
     ^
msprotz commented 3 years ago

interesting, because since your toolchain does not seem to support 128-bit vector arithmetic, we should suitably disable both 128-bit and 256-bit vector primitives... @Kachoc do you have a clue?

sonmarcho commented 3 years ago

The definitions in libintvector.h are guarded by architecture flags like #if defined(__x86_64__) || defined(_M_X64) which are probably not compatible with the feature detection performed in configure. I can update this file to use the COMPILE_VEC128... flags in combination with the new target architecture flags.

sonmarcho commented 3 years ago

I should have done it actually, but it got drowned in other things.

sonmarcho commented 3 years ago

https://github.com/project-everest/hacl-star/pull/421

msprotz commented 3 years ago

This should be fixed by #421