Skip to content

aws-lc-sys-0.32.3: build breaks on NetBSD #932

@0-wiz-0

Description

@0-wiz-0

Problem:

Somewhere between aws-lc-sys-0.30.0 and aws-lc-sys-0.32.3 the code was changed in a way that breaks the build on NetBSD.

I noticed because I'm building software on NetBSD that uses that crate.

Relevant details

AWS-LC for Rust versions or commit: 0.32.3

System information: for linux, below info can be collected by running uname -srvmp

  • CPU architecture: x86-64
  • CPU name: Ryzen 9 but I don't think it matters
  • OS: NetBSD 11.99.3

Build log:

  • From a build of dmarc-report-viewer 2.2.2:
  [ 68%] Building C object aws-lc/crypto/CMakeFiles/crypto_objects.dir/refcount_c11.c.o
  /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/crypto/rand_extra/urandom.c: In function 'ensure_dev_urandom_is_initialized':
  /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/crypto/rand_extra/urandom.c:368:9: error: implicit declaration of function 'ioctl' [-Wimplicit-function-declaration]
    368 |     if (ioctl(urandom_fd, RNDGETENTCNT, &entropy_bits)) {
        |         ^~~~~
  /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/crypto/rand_extra/urandom.c:368:27: error: 'RNDGETENTCNT' undeclared (first use in this function)
    368 |     if (ioctl(urandom_fd, RNDGETENTCNT, &entropy_bits)) {
        |                           ^~~~~~~~~~~~

Earlier in the log file I also see:

  -- linux_random_h.c probe is negative, NOT enabling HAVE_LINUX_RANDOM_H:
  --     Change Dir: '/scratch/wip/dmarc-report-viewer/work/dmarc-report-viewer-2.2.2/target/release/build/aws-lc-sys-bf44c33f0d31be3b/out/build/aws-lc/CMakeFiles/CMakeTmp'

  Run Build Command(s): /usr/pkg/bin/cmake -E env VERBOSE=1 /scratch/wip/dmarc-report-viewer/work/.tools/bin/make -f Makefile cmTC_edb2a/fast
  /scratch/wip/dmarc-report-viewer/work/.tools/bin/make  -f CMakeFiles/cmTC_edb2a.dir/build.make CMakeFiles/cmTC_edb2a.dir/build
  Building C object CMakeFiles/cmTC_edb2a.dir/linux_random_h.c.o
  /scratch/wip/dmarc-report-viewer/work/.cwrapper/bin/gcc   -O2 -ffile-prefix-map=/scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3= -ffunction-sections -fdata-sections -fPIC -m64 -fstack-clash-protection -I
/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -fstack-clash-protection -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -Wredundant-decls -Wextra -Wunused -Wcomment -Wchar-subscripts -Wuninitiali
zed -Wshadow -Wwrite-strings -Wformat-security -Wunused-result -Wno-overlength-strings -Wno-cast-function-type  -Wall -fvisibility=hidden -fno-common -Wno-c11-extensions -Wvla -Wtype-limits -Wno-unused-parameter -Werror
-Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wno-free-nonheap-object -Wmissing-braces -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes    -Werror -o CMakeF
iles/cmTC_edb2a.dir/linux_random_h.c.o -c /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/tests/compiler_features_tests/linux_random_h.c
  /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/tests/compiler_features_tests/linux_random_h.c:15:10: fatal error: linux/random.h: No such file or directory
     15 | #include <linux/random.h>
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  *** Error code 1

  Stop.
  make[1]: stopped making "CMakeFiles/cmTC_edb2a.dir/build" in /scratch/wip/dmarc-report-viewer/work/dmarc-report-viewer-2.2.2/target/release/build/aws-lc-sys-bf44c33f0d31be3b/out/build/aws-lc/CMakeFiles/CMakeTmp
  *** Error code 1

  Stop.
  make: stopped making "cmTC_edb2a/fast" in /scratch/wip/dmarc-report-viewer/work/dmarc-report-viewer-2.2.2/target/release/build/aws-lc-sys-bf44c33f0d31be3b/out/build/aws-lc/CMakeFiles/CMakeTmp


  -- linux_random_h.c probe is negative, NOT enabling AWS_LC_URANDOM_NEEDS_U32:
  --     Change Dir: '/scratch/wip/dmarc-report-viewer/work/dmarc-report-viewer-2.2.2/target/release/build/aws-lc-sys-bf44c33f0d31be3b/out/build/aws-lc/CMakeFiles/CMakeTmp'

  Run Build Command(s): /usr/pkg/bin/cmake -E env VERBOSE=1 /scratch/wip/dmarc-report-viewer/work/.tools/bin/make -f Makefile cmTC_767dd/fast
  /scratch/wip/dmarc-report-viewer/work/.tools/bin/make  -f CMakeFiles/cmTC_767dd.dir/build.make CMakeFiles/cmTC_767dd.dir/build
  Building C object CMakeFiles/cmTC_767dd.dir/linux_random_h.c.o
  /scratch/wip/dmarc-report-viewer/work/.cwrapper/bin/gcc   -O2 -ffile-prefix-map=/scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3= -ffunction-sections -fdata-sections -fPIC -m64 -fstack-clash-protection -I
/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -fstack-clash-protection -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -Wredundant-decls -Wextra -Wunused -Wcomment -Wchar-subscripts -Wuninitiali
zed -Wshadow -Wwrite-strings -Wformat-security -Wunused-result -Wno-overlength-strings -Wno-cast-function-type  -Wall -fvisibility=hidden -fno-common -Wno-c11-extensions -Wvla -Wtype-limits -Wno-unused-parameter -Werror
-Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wno-free-nonheap-object -Wmissing-braces -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes    -Werror -DDEFINE_
U32 -o CMakeFiles/cmTC_767dd.dir/linux_random_h.c.o -c /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/tests/compiler_features_tests/linux_random_h.c
  /scratch/wip/dmarc-report-viewer/work/vendor/aws-lc-sys-0.32.3/aws-lc/tests/compiler_features_tests/linux_random_h.c:15:10: fatal error: linux/random.h: No such file or directory
     15 | #include <linux/random.h>
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  *** Error code 1

which is correct, that header does not exist on NetBSD (it is Linux-specific).

NetBSD does however provide RNDGETENTCNT:

/usr/include/sys/rndio.h:#define        RNDGETENTCNT    _IOR('R',  101, uint32_t) /* get entropy count */

So probably conditionally including that header in the appropriate file might fix this:

#ifdef __NetBSD__
#include <sys/rndio.h>
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions