libressl/portable

make test error: #include <openssl/posix_time.h>

Closed this issue · 2 comments

Hi! I had some problems building freessl. I followed the steps as README.md says.

Context: I used the latest Debian GCC container available on Docker Hub.

Here is the error:

	CC       asn1/libcrypto_la-a_time_posix.lo
asn1/a_time_posix.c:31:10: fatal error: openssl/posix_time.h: No such file or directory
   31 | #include <openssl/posix_time.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:5535: asn1/libcrypto_la-a_time_posix.lo] Error 1
make[2]: Leaving directory '/libressl/portable/crypto'
make[1]: *** [Makefile:8873: check] Error 2
make[1]: Leaving directory '/libressl/portable/crypto'
make: *** [Makefile:462: check-recursive] Error 1

I was able to continue the process by commenting the lines that contained the include.

root@b86ced94e4ab:/libressl/portable# grep -r '#include <openssl/posix_time.h>'
crypto/asn1/a_time_posix.c:#include <openssl/posix_time.h>
tests/asn1time.c:#include <openssl/posix_time.h>
asm/asn1/a_time_posix.c:#include <openssl/posix_time.h>
openbsd/src/lib/libcrypto/asn1/a_time_posix.c:#include <openssl/posix_time.h>
openbsd/src/regress/lib/libcrypto/asn1/asn1time.c:#include <openssl/posix_time.h>
grep -rl '#include <openssl/posix_time.h>' . | while read file; do sed -i 's/^#include <openssl\/posix_time\.h>/\/\/ #include <openssl\/posix_time\.h>/' "$file"; done

Then I was able to compile passing all the tests:

============================================================================
Testsuite summary for libressl 3.8.2
============================================================================
# TOTAL: 126
# PASS:  126
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

The full process is below.

  1. First, I ran autogen.sh
root@b86ced94e4ab:/libressl/portable# ./autogen.sh 
pulling upstream openbsd source
Cloning into 'openbsd'...
remote: Enumerating objects: 162226, done.
remote: Counting objects: 100% (42911/42911), done.
remote: Compressing objects: 100% (15811/15811), done.
remote: Total 162226 (delta 24200), reused 41646 (delta 23774), pack-reused 119315
Receiving objects: 100% (162226/162226), 54.26 MiB | 23.61 MiB/s, done.
Resolving deltas: 100% (115905/115905), done.
Updating files: 100% (13663/13663), done.
Not on a tag, grabbing latest (NOTE: this may be broken from time to time)
Already on 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
libcrypto version 52:0:0
libssl version 55:0:0
libtls version 28:0:0
LibreSSL version 3.8.2
copying libcrypto source
patching file x86_64cpuid.pl
patching file aes/asm/aes-x86_64.pl
patching file aes/asm/aesni-sha1-x86_64.pl
patching file aes/asm/aesni-x86_64.pl
patching file aes/asm/bsaes-x86_64.pl
patching file aes/asm/vpaes-x86_64.pl
patching file bn/s2n_bignum_internal.h
patching file bn/arch/amd64/bignum_add.S
patching file bn/arch/amd64/bignum_cmadd.S
patching file bn/arch/amd64/bignum_cmul.S
patching file bn/arch/amd64/bignum_mul.S
patching file bn/arch/amd64/bignum_mul_4_8_alt.S
patching file bn/arch/amd64/bignum_mul_8_16_alt.S
patching file bn/arch/amd64/bignum_sqr.S
patching file bn/arch/amd64/bignum_sqr_4_8_alt.S
patching file bn/arch/amd64/bignum_sqr_8_16_alt.S
patching file bn/arch/amd64/bignum_sub.S
patching file bn/arch/amd64/word_clz.S
patching file bn/asm/modexp512-x86_64.pl
patching file bn/asm/x86_64-mont.pl
patching file bn/asm/x86_64-mont5.pl
patching file camellia/asm/cmll-x86_64.pl
patching file md5/asm/md5-x86_64.pl
patching file modes/asm/ghash-x86_64.pl
patching file perlasm/x86_64-xlate.pl
patching file rc4/asm/rc4-md5-x86_64.pl
patching file rc4/asm/rc4-x86_64.pl
patching file sha/asm/sha1-x86_64.pl
patching file sha/asm/sha512-x86_64.pl
patching file whrlpool/asm/wp-x86_64.pl
patching file perlasm/x86_64-xlate.pl
generating mips ASM source for elf
generating mips64 ASM source for elf
generating arm ASM source for elf
generating x86_64 ASM source for elf
generating x86_64 ASM source for macosx
generating x86_64 ASM source for masm
generating x86_64 ASM source for mingw64
copying libtls source
copying nc(1) source
copying ocspcheck(1) source
copying openssl(1) source
copying libssl source
copying tests
patching file tests/bn_shift.c
patching file crypto/hidden/crypto_namespace.h
patching file crypto/modes/modes_local.h
patching file apps/nc/netcat.c
patching file apps/openssl/openssl.c
Hunk #1 succeeded at 348 (offset -6 lines).
patching file include/openssl/opensslfeatures.h
patching file tests/rfc5280time.c
patching file apps/openssl/speed.c
patching file ssl/hidden/ssl_namespace.h
patching file include/tls.h
patching file crypto/bn/arch/amd64/bn_arch.h
patching file include/openssl/dtls1.h
patching file include/openssl/ossl_typ.h
patching file include/openssl/pkcs7.h
patching file include/openssl/x509.h
copying manpages
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:29: installing './compile'
configure.ac:20: installing './config.guess'
configure.ac:20: installing './config.sub'
configure.ac:21: installing './install-sh'
configure.ac:21: installing './missing'
configure.ac:159: installing './tap-driver.sh'
apps/nc/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
  1. Then, I ran configure
root@b86ced94e4ab:/libressl/portable# ./configure 
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking whether cc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of cc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking size of time_t... 8
checking if cc supports "-fno-strict-overflow"... yes
checking whether C compiler accepts -Werror... yes
checking whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS... yes
checking if /usr/bin/ld -m elf_x86_64 supports "-Wl,-z,relro"... yes
checking if /usr/bin/ld -m elf_x86_64 supports "-Wl,-z,now"... yes
checking if cc supports "-fstack-protector-strong"... yes
checking if cc supports "-fcf-protection=full"... yes
checking whether AS supports .note.GNU-stack... yes
checking dependency style of cc... gcc3
checking if compiling with clang... no
checking whether CC supports -Wno-pointer-sign... yes
checking for symlink... yes
checking for funopen... no
checking for endian.h... yes
checking for machine/endian.h... no
checking for err.h... yes
checking for readpassphrase.h... no
checking for netinet/ip.h... yes
checking for sys/types.h... (cached) yes
checking for netinet/in.h... yes
checking for arpa/nameser.h... yes
checking for netdb.h... yes
checking for resolv.h... yes
checking for asprintf... yes
checking for freezero... no
checking for memmem... yes
checking for readpassphrase... no
checking for reallocarray... yes
checking for recallocarray... no
checking for strcasecmp... yes
checking for strlcat... no
checking for strlcpy... no
checking for strndup... yes
checking for strnlen... yes
checking for strsep... yes
checking for strtonum... no
checking for timegm... yes
checking for _mkgmtime... no
checking for timespecsub... no
checking for getopt... yes
checking for getprogname... no
checking for syslog... yes
checking for syslog_r... no
checking for getpagesize... yes
checking for accept4... yes
checking for pipe2... yes
checking for pledge... no
checking for poll... yes
checking for socketpair... yes
checking for arc4random... yes
checking for arc4random_buf... yes
checking for arc4random_uniform... yes
checking for explicit_bzero... yes
checking for getauxval... yes
checking for getentropy... yes
checking for timingsafe_bcmp... no
checking for timingsafe_memcmp... no
checking for getauxval... (cached) yes
checking for library containing dl_iterate_phdr... none required
checking for dl_iterate_phdr... yes
checking for library containing pthread_once... none required
checking for library containing pthread_mutex_lock... none required
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking whether va_copy exists... yes
checking whether __va_copy exists... yes
checking for library containing b64_ntop... no
checking for library containing __b64_ntop... -lresolv
checking for b64_ntop... yes
checking if .gnu.warning accepts long strings... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/openssl/Makefile
config.status: creating crypto/Makefile
config.status: creating ssl/Makefile
config.status: creating tls/Makefile
config.status: creating tests/Makefile
config.status: creating apps/Makefile
config.status: creating apps/ocspcheck/Makefile
config.status: creating apps/openssl/Makefile
config.status: creating apps/nc/Makefile
config.status: creating man/Makefile
config.status: creating libcrypto.pc
config.status: creating libssl.pc
config.status: creating libtls.pc
config.status: creating openssl.pc
config.status: executing depfiles commands
config.status: executing libtool commands
  1. And finally, when I ran make check, I had the error
root@b86ced94e4ab:/libressl/portable# make check
Making check in include
make[1]: Entering directory '/libressl/portable/include'
Making check in openssl
make[2]: Entering directory '/libressl/portable/include/openssl'
echo "generating opensslconf.h ..."
generating opensslconf.h ...
cp ../../include/arch/amd64/opensslconf.h opensslconf.h
make  check-am
make[3]: Entering directory '/libressl/portable/include/openssl'
make[3]: Nothing to be done for 'check-am'.
make[3]: Leaving directory '/libressl/portable/include/openssl'
make[2]: Leaving directory '/libressl/portable/include/openssl'
make[2]: Entering directory '/libressl/portable/include'
make[2]: Nothing to be done for 'check-am'.
make[2]: Leaving directory '/libressl/portable/include'
make[1]: Leaving directory '/libressl/portable/include'
Making check in crypto
make[1]: Entering directory '/libressl/portable/crypto'
echo "generating crypto_portable.sym ..."
generating crypto_portable.sym ...
cp ../crypto/crypto.sym crypto_portable.sym
chmod u+w crypto_portable.sym
make  check-am
make[2]: Entering directory '/libressl/portable/crypto'
  CPPAS    aes/libcrypto_la-aes-elf-x86_64.lo
  CPPAS    aes/libcrypto_la-bsaes-elf-x86_64.lo
  CPPAS    aes/libcrypto_la-vpaes-elf-x86_64.lo
  CPPAS    aes/libcrypto_la-aesni-elf-x86_64.lo
  CPPAS    aes/libcrypto_la-aesni-sha1-elf-x86_64.lo
  CPPAS    bn/libcrypto_la-modexp512-elf-x86_64.lo
  CPPAS    bn/libcrypto_la-mont-elf-x86_64.lo
  CPPAS    bn/libcrypto_la-mont5-elf-x86_64.lo
  CPPAS    camellia/libcrypto_la-cmll-elf-x86_64.lo
  CPPAS    md5/libcrypto_la-md5-elf-x86_64.lo
  CPPAS    modes/libcrypto_la-ghash-elf-x86_64.lo
  CPPAS    rc4/libcrypto_la-rc4-elf-x86_64.lo
  CPPAS    rc4/libcrypto_la-rc4-md5-elf-x86_64.lo
  CPPAS    sha/libcrypto_la-sha1-elf-x86_64.lo
  CPPAS    sha/libcrypto_la-sha256-elf-x86_64.lo
  CPPAS    sha/libcrypto_la-sha512-elf-x86_64.lo
  CPPAS    whrlpool/libcrypto_la-wp-elf-x86_64.lo
  CPPAS    libcrypto_la-cpuid-elf-x86_64.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_add.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_cmadd.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_cmul.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_mul.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_mul_4_8_alt.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_mul_8_16_alt.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_sqr.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_sqr_4_8_alt.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_sqr_8_16_alt.lo
  CPPAS    bn/arch/amd64/libcrypto_la-bignum_sub.lo
  CPPAS    bn/arch/amd64/libcrypto_la-word_clz.lo
  CC       bn/arch/amd64/libcrypto_la-bn_arch.lo
  CC       libcrypto_la-cpt_err.lo
  CC       libcrypto_la-cryptlib.lo
  CC       libcrypto_la-crypto_init.lo
  CC       libcrypto_la-crypto_lock.lo
  CC       libcrypto_la-cversion.lo
  CC       libcrypto_la-ex_data.lo
  CC       libcrypto_la-malloc-wrapper.lo
  CC       libcrypto_la-mem_clr.lo
  CC       libcrypto_la-mem_dbg.lo
  CC       libcrypto_la-o_fips.lo
  CC       libcrypto_la-o_init.lo
  CC       libcrypto_la-o_str.lo
  CC       aes/libcrypto_la-aes_cfb.lo
  CC       aes/libcrypto_la-aes_ctr.lo
  CC       aes/libcrypto_la-aes_ecb.lo
  CC       aes/libcrypto_la-aes_ige.lo
  CC       aes/libcrypto_la-aes_ofb.lo
  CC       aes/libcrypto_la-aes_wrap.lo
  CC       asn1/libcrypto_la-a_bitstr.lo
  CC       asn1/libcrypto_la-a_enum.lo
  CC       asn1/libcrypto_la-a_int.lo
  CC       asn1/libcrypto_la-a_mbstr.lo
  CC       asn1/libcrypto_la-a_object.lo
  CC       asn1/libcrypto_la-a_octet.lo
  CC       asn1/libcrypto_la-a_pkey.lo
  CC       asn1/libcrypto_la-a_print.lo
  CC       asn1/libcrypto_la-a_pubkey.lo
  CC       asn1/libcrypto_la-a_strex.lo
  CC       asn1/libcrypto_la-a_string.lo
  CC       asn1/libcrypto_la-a_strnid.lo
  CC       asn1/libcrypto_la-a_time.lo
  CC       asn1/libcrypto_la-a_time_posix.lo
asn1/a_time_posix.c:31:10: fatal error: openssl/posix_time.h: No such file or directory
   31 | #include <openssl/posix_time.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:5535: asn1/libcrypto_la-a_time_posix.lo] Error 1
make[2]: Leaving directory '/libressl/portable/crypto'
make[1]: *** [Makefile:8873: check] Error 2
make[1]: Leaving directory '/libressl/portable/crypto'
make: *** [Makefile:462: check-recursive] Error 1

Make sure you have b9b6532

Yep, now compiles. Thanks!