Can OpenSSL 3.1.0 be compiled without atomic.h ?

Viktor Dukhovni openssl-users at
Thu Mar 30 22:48:02 UTC 2023

On Thu, Mar 30, 2023 at 05:50:50PM -0400, Dennis Clarke via openssl-users wrote:

> This is exactly the sort of thing this email list for ordinary users
> was intended for. Custom designed for this sort of off the wall crazy
> question.  A github bug report would be a vulgar display of stupid.

Your question is a bit surprising, because those enterprising enough to
operate what is now exotic hardware, are usually the sort of users who
answer rather than ask this sort of question...

That said, the header in question occurs in exactly one place in

    crypto/threads_pthread.c- *
    crypto/threads_pthread.c- */
    crypto/threads_pthread.c-/* We need to use the OPENSSL_fork_*() deprecated APIs */
    crypto/threads_pthread.c-#define OPENSSL_SUPPRESS_DEPRECATED
    crypto/threads_pthread.c-#include <openssl/crypto.h>
    crypto/threads_pthread.c-#include "internal/cryptlib.h"
    crypto/threads_pthread.c-#if defined(__sun)
    crypto/threads_pthread.c:# include <atomic.h>
    crypto/threads_pthread.c-#if defined(__apple_build_version__) && __apple_build_version__ < 6000000
    crypto/threads_pthread.c- * OS/X 10.7 and 10.8 had a weird version of clang which has __ATOMIC_ACQUIRE and
    crypto/threads_pthread.c- * __ATOMIC_ACQ_REL but which expects only one parameter for __atomic_is_lock_free()
    crypto/threads_pthread.c- * rather than two which has signature __atomic_is_lock_free(sizeof(_Atomic(T))).
    crypto/threads_pthread.c- * All of this makes impossible to use __atomic_is_lock_free here.
    crypto/threads_pthread.c- *
    crypto/threads_pthread.c- * See:

To be used on some unspecified "__sun" systems with some unspecified
toolchain.  You'll discover what's missing without it by removing the
include, and seeing what breaks, and then fix that, or perhaps switching
toolchain versions to one that provides that header.

Another thing to do could be to move the include below (inside):

    #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS)

and Configure "no-threads", assuming you don't have to have threads.


More information about the openssl-users mailing list