Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum supported version for C compiler #483

Open
franziskuskiefer opened this issue Oct 8, 2021 · 10 comments
Open

Minimum supported version for C compiler #483

franziskuskiefer opened this issue Oct 8, 2021 · 10 comments

Comments

@franziskuskiefer
Copy link
Member

Define GCC and clang minimum supported versions.

@beurdouche
Copy link
Contributor

gcc 4.8 it is. Maybe someone has stronger requirements @polubelova @Frosne @protz ?

@msprotz
Copy link
Contributor

msprotz commented Jan 20, 2022

There was a blog post somewhere where Mirage folks were unhappy with the __has_include (which we should now be able to get rid of). According to https://en.cppreference.com/w/cpp/compiler_support this is in GCC 5. So maybe they, too, we reliant on GCC 4.8...

@beurdouche
Copy link
Contributor

I think @Frosne is running into exactly that right now in our CI.

@msprotz
Copy link
Contributor

msprotz commented Jan 20, 2022

I'm happy to approve a PR that removes __has_include from lib/c/* and assumes everyone runs configure and thus has a valid config.h -- Mozilla has a hand-written config.h, correct?

@Frosne
Copy link
Contributor

Frosne commented Jan 20, 2022

For now I solved it using these lines:

#if defined(__has_include)
#if __has_include("config.h")
#include "config.h"
#endif
#endif

If we don't want to remove config, it could be a way to go.

@msprotz
Copy link
Contributor

msprotz commented Jan 20, 2022

Interesting. But then are you compiling AVX or AVX2 code? How are you defining HACL_CAN_COMPILE_VEC128?

@Frosne
Copy link
Contributor

Frosne commented Jan 20, 2022

With these lines we have gcc-4.4 compiler also passes CI :)

@Frosne
Copy link
Contributor

Frosne commented Jan 20, 2022

Interesting. But then are you compiling AVX or AVX2 code? How are you defining HACL_CAN_COMPILE_VEC128?

By adding -DHACL_CAN_COMPILE_VEC128/256 to CFLAGS

@msprotz
Copy link
Contributor

msprotz commented Jan 20, 2022

Ok I thought about it and I believe your solution is actually even better. This means clients who want to integrate HACL have two options:

  • -D... compiler options using their favorite build system to enable features depending on target support
  • just running the configure script and leaving it up to us to set those flags in config.h -- this works for simple situations, but not all (e.g. cross-compiling on x64)

I'm happy to approve a PR to that effect. There are only a handful of places that use __has_include

@msprotz
Copy link
Contributor

msprotz commented Dec 15, 2022

To be closed once I finish & merge #561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants