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

Work around lack of stdalign.h on OpenBSD #294

briansmith opened this issue Sep 6, 2016 · 1 comment


None yet
1 participant
Copy link

commented Sep 6, 2016

As reported in #287, compilation fails with OpenBSD's GCC 4.8 because it lacks stdalign.h:

--- stderr
In file included from crypto/aes/aes.c:55:0:
crypto/aes/../internal.h:136:22: fatal error: stdalign.h: No such file or directory
 #include <stdalign.h>
compilation terminated.
gmake: *** [mk/ /home/oherrala/rust/ring/target/debug/build/ring-3175a83ad649b58d/out/obj/crypto/aes/aes.o] Error 1
In file included from crypto/bn/internal.h:135:0,
                 from crypto/bn/add.c:64:
crypto/bn/../internal.h:136:22: fatal error: stdalign.h: No such file or directory
 #include <stdalign.h>
gmake: *** Waiting for unfinished jobs....
compilation terminated.

In crypto/internal.h:

#if defined(_MSC_VER)
#pragma warning(push, 3)
#include <intrin.h>
#pragma warning(pop)
#if !defined(__cplusplus)
#define alignas(x) __declspec(align(x))
#define alignof __alignof
#elif !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 4 && \
      __GNUC_MINOR__ <= 6
#define alignas(x) __attribute__((aligned (x)))
#define alignof __alignof__
#include <stdalign.h>

It seems like we need to extend the support added for GCC 4.6 to handle the OpenBSD case. Ideally __has_include would be used, but that only works in GCC 5.1 and later. So, maybe the solution is to just add an OpenBSD-specific thing to the #elif.


This comment has been minimized.

Copy link
Owner Author

commented Apr 15, 2017

Closing this based on, in particular “OpenBSD currently makes use of GCC 4.2.1, the latest series of the GNU Compiler Collection being under the GPLv2”. We don't support such ancient versions of GCC, so people should just use Clang on OpenBSD. LMK if this is problematic.

@briansmith briansmith closed this Apr 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.