Opened 2 years ago

Last modified 2 years ago

#58060 new defect

Build error on Ubuntu: unknown type name ‘SHA2_CTX’ / conflicting types for ‘SHA256_CTX’

Reported by: mojca (Mojca Miklavec) Owned by:
Priority: Low Milestone:
Component: base Version:
Keywords: Cc:
Port:

Description

I tried to build base on Ubuntu. I'll try to provide more information, but here's when it gets stuck for me when building macports base:

cc -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED -g -O2 -std=c99 -Wextra -Wall -pedantic     -DHAVE_CONFIG_H -I/path-to/macports-base/src -I/path-to/macports-base/src -I. -I/path-to/macports-base/vendor/vendor-destroot/opt/local/libexec/macports/include -I./../compat -fPIC sha256cmd.c -o sha256cmd.o
In file included from sha256cmd.c:66:0:
/usr/include/sha256.h:34:9: error: unknown type name ‘SHA2_CTX’
 typedef SHA2_CTX SHA256_CTX;
         ^~~~~~~~
/usr/include/sha256.h:34:18: error: conflicting types for ‘SHA256_CTX’
 typedef SHA2_CTX SHA256_CTX;
                  ^~~~~~~~~~
In file included from /usr/include/sha256.h:32:0,
                 from sha256cmd.c:66:
./sha2.h:52:3: note: previous declaration of ‘SHA256_CTX’ was here
 } SHA256_CTX;
   ^~~~~~~~~~
../../Mk/macports.tea.mk:2: recipe for target 'sha256cmd.o' failed
make[2]: *** [sha256cmd.o] Error 1
make[2]: Leaving directory '/home/mo

I suspect that one of the dependencies might be missing. I'll attach more logs later.

Change History (3)

comment:1 Changed 2 years ago by mojca (Mojca Miklavec)

Priority: NormalLow

comment:2 Changed 2 years ago by jmroot (Joshua Root)

Might just be a different version of libmd than was tested with.

comment:3 Changed 2 years ago by mojca (Mojca Miklavec)

If I look at (first search hit) https://github.com/aosm/libmd/blob/master/sha256.h, I see

#ifdef __APPLE__
#define COMMON_DIGEST_FOR_OPENSSL
#include <CommonCrypto/CommonDigest.h>
#else /* !__APPLE__ */
typedef struct SHA256Context {
        uint32_t state[8];
        uint32_t count[2];
        unsigned char buf[64];
} SHA256_CTX;
#endif /* __APPLE__ */

The file sha256cmd.c contains neither sha256.h nor the else part.

Including that header results in

In file included from /usr/include/sha256.h:32:0,
                 from sha256cmd.c:44:
./sha2.h:49:2: error: unknown type name ‘u_int32_t’
  u_int32_t state[8];
  ^~~~~~~~~
Note: See TracTickets for help on using tickets.