varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

macOS build failure: no `endian.h` found

Open botantony opened this issue 9 months ago • 2 comments

Expected Behavior

I expect to compile program

Current Behavior

Build fails with this error:

    CC       libvarnish_la-vsb.lo
    CC       libvarnish_la-vsha256.lo
    CC       libvarnish_la-vss.lo
    CC       libvarnish_la-vsub.lo
  vsha256.c:35:12: fatal error: 'endian.h' file not found
     35 | #  include <endian.h>
        |            ^~~~~~~~~~
  1 error generated.
  make[2]: *** [libvarnish_la-vsha256.lo] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[1]: *** [install-recursive] Error 1
  make: *** [install-recursive] Error 1

Possible Solution

In file vsha256.c you use #ifndef __DARWIN_BYTE_ORDER, which suppose to prevent this error. __DARWIN_BYTE_ORDER is not a defined macro in Xcode Clang. You can try __APPLE__ macro instead

Steps to Reproduce (for bugs)

Build steps (from tarball):

$ ./autogen.sh # I tried w/ and w/o, got same result
$ ./configure --localstatedir=/opt/homebrew/var --disable-debug --disable-dependency-tracking --prefix=/opt/homebrew/Cellar/varnish/7.7.0 --libdir=/opt/homebrew/Cellar/varnish/7.7.0/lib
$ make install CFLAGS=-DVARNISH_VMOD_DIR='"/opt/homebrew/lib/varnish/vmods"' -DVARNISH_VCL_DIR='"/opt/homebrew/etc/varnish:/opt/homebrew/share/varnish/vcl"'

Context

I contibute to Homebrew package manager, the recent update failed CI. Related PR: Homebrew/homebrew-core#211340

Varnish Cache version

7.7.0

Operating system

macOS Sonoma

Source of binary packages used (if any)

https://varnish-cache.org/_downloads/varnish-7.7.0.tgz

botantony avatar Mar 18 '25 21:03 botantony

Even after the fix is applied, another one is coming from 7.7.1.

vcc_purge_if.c:134:46: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
  134 | static const char vmod_vcs[] v_used_(section(".vmod_vcs")) = "2e8180f788715e5bc44df08479d60c9435d79bdd";
      |                                              ^
1 error generated.

daeho-ro avatar May 15 '25 11:05 daeho-ro

I am also experiencing this with 7.7 on MacOS. It works with 7.6 though.

mikebridge-gfm avatar May 23 '25 16:05 mikebridge-gfm

I belive this is fixed now, at least the Mac-Mini Vtester is happy.

bsdphk avatar Jun 30 '25 13:06 bsdphk