Item 1: Build failure with GCC.  In both LibreSSL 2.0.0 and 2.0.1, if you
build it on OS X with GCC, it dies at the configure step with this error:

configure: error: C compiler cannot create executables

Looking at config.log, the problem is simple: gcc is passed the option
'-Qunused-arguments', and GCC complains of an unrecognized argument and
quits.

This appears to be a flag supported by clang but not by GCC.  Why is it
being set?  "configure" tells us:

case $target_os in
        *darwin*)
                TARGET_OS=darwin;
                LDFLAGS="$LDFLAGS -Qunused-arguments"
                ;;

Looks like someone assumes that compiling on Darwin implies compiling with
clang.  Which is false.  If -Qunused-arguments gets set, that should happen
if and when the compiler is detected to be "clang" rather than GCC.

Item 2: Build success but "make check" failure.

If I run configure with CC=[path to clang], then build completes
successfully in 2.0.1.  Additionally, if I comment out the line from
"configure" that sets -Qunused-arguments, and then build with GCC, build
also completes successfully.  (Both compilers print some warnings along the
way.)

However, in either case, "make check" leads to death.  With both compilers,
"make check" dies at the same point: When creating explicit_bzero.o, it
warns about an "implicit declaration of function 'memmem'", and when
linking explicit_bzero, it complains about the undefined symbol "_memmem"
and dies with an error.  The error messages are remarkably similar between
GCC and clang.  I've attached both.

The software versions used here are OS X 10.6.8, GCC 4.9 from Macports, and
clang 3.4.2 from Macports.

Digging around, it looks like my system doesn't have memmem, either in a
man page or in any library file in /usr/lib.  Googling around, it looks
like Apple may have added memmem in OS X 10.7:
https://bugzilla.mozilla.org/show_bug.cgi?id=695515

Not sure what to recommend in this case.  Anyway, there you are.
--John Boyle
*Science is what we understand well enough to explain to a computer. Art is
everything else we do.* --Knuth
~/D/libressl-2.0.1> time make check
Making check in crypto
make[1]: Nothing to be done for `check'.
Making check in ssl
make[1]: Nothing to be done for `check'.
Making check in include
Making check in openssl
make[2]: Nothing to be done for `check'.
make[2]: Nothing to be done for `check-am'.
Making check in apps
make[1]: Nothing to be done for `check'.
Making check in tests
make  aeadtest aes_wrap arc4randomforktest base64test bftest biotest bntest 
casttest chachatest cts128test destest dhtest dsatest ecdhtest ecdsatest ectest 
enginetest evptest explicit_bzero exptest gcm128test hmactest ideatest igetest 
md4test md5test mdc2test mont pkcs7test poly1305test pq_test randtest rc2test 
rc4test rmdtest sha1test sha256test sha512test shatest ssltest timingsafe 
utf8test
  CC       aeadtest.o
aeadtest.c:258:34: warning: passing 'unsigned char [1024]' to parameter of type
      'const char *' converts between pointers to integer types with different 
sign
      [-Wpointer-sign]
                        switch (aead_from_name(&aead, bufs[AEAD])) {
                                                      ^~~~~~~~~~
aeadtest.c:115:51: note: passing argument to parameter 'name' here
aead_from_name(const EVP_AEAD **aead, const char *name)
                                                  ^
aeadtest.c:321:23: warning: passing 'unsigned char *' to parameter of type 
'char *'
      converts between pointers to integer types with different sign 
[-Wpointer-sign]
                        *buf_len = strlcpy(buf, line + i, BUF_MAX);
                                           ^~~
../include/string.h:15:22: note: passing argument to parameter 'dst' here
size_t strlcpy(char *dst, const char *src, size_t siz);
                     ^
2 warnings generated.
  CCLD     aeadtest
  CC       aes_wrap.o
  CCLD     aes_wrap
  CC       arc4randomforktest.o
  CCLD     arc4randomforktest
  CC       base64test.o
  CCLD     base64test
  CC       bftest.o
  CCLD     bftest
  CC       biotest.o
  CCLD     biotest
  CC       bntest.o
  CCLD     bntest
  CC       casttest.o
  CCLD     casttest
  CC       chachatest.o
  CCLD     chachatest
  CC       cts128test.o
  CCLD     cts128test
  CC       destest.o
  CCLD     destest
  CC       dhtest.o
  CCLD     dhtest
  CC       dsatest.o
  CCLD     dsatest
  CC       ecdhtest.o
  CCLD     ecdhtest
  CC       ecdsatest.o
  CCLD     ecdsatest
  CC       ectest.o
  CCLD     ectest
  CC       enginetest.o
  CCLD     enginetest
  CC       evptest.o
  CCLD     evptest
  CC       explicit_bzero.o
explicit_bzero.c:132:14: warning: implicit declaration of function 'memmem' is
      invalid in C99 [-Wimplicit-function-declaration]
        char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
                    ^
explicit_bzero.c:132:8: warning: incompatible integer to pointer conversion
      initializing 'char *' with an expression of type 'int' [-Wint-conversion]
        char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
explicit_bzero.c:143:8: warning: incompatible integer to pointer conversion
      initializing 'char *' with an expression of type 'int' [-Wint-conversion]
        char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
  CCLD     explicit_bzero
Undefined symbols for architecture x86_64:
  "_memmem", referenced from:
      _test_with_bzero in explicit_bzero.o
      _test_without_bzero in explicit_bzero.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [explicit_bzero] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1
       10.18 real         4.47 user         2.56 sys
~/D/libressl-2.0.1> time make check
Making check in crypto
make[1]: Nothing to be done for `check'.
Making check in ssl
make[1]: Nothing to be done for `check'.
Making check in include
Making check in openssl
make[2]: Nothing to be done for `check'.
make[2]: Nothing to be done for `check-am'.
Making check in apps
make[1]: Nothing to be done for `check'.
Making check in tests
make  aeadtest aes_wrap arc4randomforktest base64test bftest biotest bntest 
casttest chachatest cts128test destest dhtest dsatest ecdhtest ecdsatest ectest 
enginetest evptest explicit_bzero exptest gcm128test hmactest ideatest igetest 
md4test md5test mdc2test mont pkcs7test poly1305test pq_test randtest rc2test 
rc4test rmdtest sha1test sha256test sha512test shatest ssltest timingsafe 
utf8test
  CC       aeadtest.o
aeadtest.c: In function 'main':
aeadtest.c:258:12: warning: pointer targets in passing argument 2 of 
'aead_from_name' differ in signedness [-Wpointer-sign]
    switch (aead_from_name(&aead, bufs[AEAD])) {
            ^
aeadtest.c:115:1: note: expected 'const char *' but argument is of type 
'unsigned char *'
 aead_from_name(const EVP_AEAD **aead, const char *name)
 ^
aeadtest.c:321:15: warning: pointer targets in passing argument 1 of 'strlcpy' 
differ in signedness [-Wpointer-sign]
    *buf_len = strlcpy(buf, line + i, BUF_MAX);
               ^
In file included from ../include/string.h:1:0,
                 from aeadtest.c:52:
/usr/include/string.h:132:9: note: expected 'char *' but argument is of type 
'unsigned char *'
 size_t  strlcpy(char *, const char *, size_t);
         ^
  CCLD     aeadtest
  CC       aes_wrap.o
  CCLD     aes_wrap
  CC       arc4randomforktest.o
  CCLD     arc4randomforktest
  CC       base64test.o
  CCLD     base64test
  CC       bftest.o
  CCLD     bftest
  CC       biotest.o
  CCLD     biotest
  CC       bntest.o
  CCLD     bntest
  CC       casttest.o
  CCLD     casttest
  CC       chachatest.o
  CCLD     chachatest
  CC       cts128test.o
  CCLD     cts128test
  CC       destest.o
  CCLD     destest
  CC       dhtest.o
  CCLD     dhtest
  CC       dsatest.o
  CCLD     dsatest
  CC       ecdhtest.o
  CCLD     ecdhtest
  CC       ecdsatest.o
  CCLD     ecdsatest
  CC       ectest.o
  CCLD     ectest
  CC       enginetest.o
  CCLD     enginetest
  CC       evptest.o
  CCLD     evptest
  CC       explicit_bzero.o
explicit_bzero.c: In function 'test_without_bzero':
explicit_bzero.c:132:2: warning: implicit declaration of function 'memmem' 
[-Wimplicit-function-declaration]
  char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
  ^
explicit_bzero.c:132:14: warning: initialization makes pointer from integer 
without a cast
  char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
              ^
explicit_bzero.c: In function 'test_with_bzero':
explicit_bzero.c:143:14: warning: initialization makes pointer from integer 
without a cast
  char *res = memmem(altstack, sizeof(altstack), buf, sizeof(buf));
              ^
  CCLD     explicit_bzero
Undefined symbols for architecture x86_64:
  "_memmem", referenced from:
      _test_without_bzero in explicit_bzero.o
      _test_with_bzero in explicit_bzero.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [explicit_bzero] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1
        7.06 real         3.81 user         2.41 sys

Reply via email to