Opened 5 years ago

Closed 16 months ago

#58626 closed defect (fixed)

nss @3.44 does not build on Mac OS X 10.4.11, PPC Tiger, 'SHA_MASK8' and 'SHA_MASK16' are both undeclared

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: tiger Cc:
Port: nss

Description

/opt/local/bin/gcc-apple-4.2 -Os -std=c99 -arch ppc -o Output.OBJD/Darwin_SINGLE_SHLIB/crypto_primitives.o -c -Os -fPIC -Dppc -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -DSHLIB_SUFFIX=\"dylib\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DKRML_NOUINT128 -DMP_API_COMPATIBLE -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -Iverified  -std=gnu99 crypto_primitives.c
crypto_primitives.c: In function 'swap8b':
crypto_primitives.c:31: error: 'SHA_MASK8' undeclared (first use in this function)
crypto_primitives.c:31: error: (Each undeclared identifier is reported only once
crypto_primitives.c:31: error: for each function it appears in.)
crypto_primitives.c:32: error: 'SHA_MASK16' undeclared (first use in this function)
make[3]: *** [Output.OBJD/Darwin_SINGLE_SHLIB/crypto_primitives.o] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.44/nss/lib/freebl'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.44/nss/lib/freebl'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.44/nss/lib'
make: *** [libs] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.44/nss'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.44/nss" && /usr/bin/make -w all NSS_DISABLE_GTESTS=1 NSS_ENABLE_WERROR=0 CC="/opt/local/bin/gcc-apple-4.2 -Os -std=c99 -arch ppc" CCC="/opt/local/bin/g++-apple-4.2 -Os -arch ppc" NSPR_INCLUDE_DIR=/opt/local/include/nspr NSPR_LIB_DIR=/opt/local/lib/nspr NSS_USE_SYSTEM_SQLITE=1 USE_SYSTEM_ZLIB=1 BUILD_OPT=1 OPTIMIZER="-Os" OBJDIR_NAME="Output.OBJD" 
Exit code: 2

The code where it happens is:

typedef unsigned long long PRUint64;
...
    9	/* This file holds useful functions and macros for crypto code. */
   10	#include "crypto_primitives.h"
   11	
   12	/*
   13	 * FREEBL_HTONLL(x): swap bytes in a 64-bit integer.
   14	 */
   15	#if defined(__GNUC__) && (defined(__x86_64__) || defined(__x86_64))
   16	
   17	__inline__ PRUint64
   18	swap8b(PRUint64 value)
   19	{
   20	    __asm__("bswapq %0"
   21	            : "+r"(value));
   22	    return (value);
   23	}
   24	
   25	#elif !defined(_MSC_VER) && !__has_builtin(__builtin_bswap64) && !((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
   26	
   27	PRUint64
   28	swap8b(PRUint64 x)
   29	{
   30	    PRUint64 t1 = x;
   31	    t1 = ((t1 & SHA_MASK8) << 8) | ((t1 >> 8) & SHA_MASK8);
   32	    t1 = ((t1 & SHA_MASK16) << 16) | ((t1 >> 16) & SHA_MASK16);
   33	    return (t1 >> 32) | (t1 << 32);
   34	}
   35	
   36	#endif

crypto_primitives.h has:

   34	/*
   35	 * FREEBL_HTONLL(x): swap bytes in a 64-bit integer.
   36	 */
   37	#if defined(IS_LITTLE_ENDIAN)
   38	#if defined(_MSC_VER)
   39	
   40	#pragma intrinsic(_byteswap_uint64)
   41	#define FREEBL_HTONLL(x) _byteswap_uint64(x)
   42	
   43	/* gcc doesn't have __has_builtin, but it does have __builtin_bswap64 */
   44	#elif __has_builtin(__builtin_bswap64) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
   45	
   46	#define FREEBL_HTONLL(x) __builtin_bswap64(x)
   47	
   48	#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__x86_64))
   49	
   50	PRUint64 swap8b(PRUint64 value);
   51	#define FREEBL_HTONLL(x) swap8b(x)
   52	
   53	#else
   54	
   55	#define SHA_MASK16 0x0000FFFF0000FFFFULL
   56	#define SHA_MASK8 0x00FF00FF00FF00FFULL
   57	PRUint64 swap8b(PRUint64 x);
   58	#define FREEBL_HTONLL(x) swap8b(x)
   59	
   60	#endif /* _MSC_VER */
   61	
   62	#else /* IS_LITTLE_ENDIAN */
   63	#define FREEBL_HTONLL(x) (x)
   64	#endif

So it should build with GCC5 and later!

Attachments (1)

main.log (114.7 KB) - added by ballapete (Peter "Pete" Dyballa) 5 years ago.
Main.log from PPC Tiger

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Yes, crypto_primitives.c compiles with GCC6!

comment:2 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

And the whole package, too!

comment:3 Changed 16 months ago by kencu (Ken)

Resolution: fixed
Status: newclosed

nss builds on Tiger PPC now

Note: See TracTickets for help on using tickets.