homebrew-core icon indicating copy to clipboard operation
homebrew-core copied to clipboard

nsd 4.10.0

Open anandb-ripencc opened this issue 1 year ago • 2 comments

  • [x] Have you followed the guidelines for contributing?
  • [x] Have you ensured that your commits follow the commit style guide?
  • [x] Have you checked that there aren't other open pull requests for the same formula update/change?
  • [ ] Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • [ ] Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • [ ] Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

anandb-ripencc avatar Jun 27 '24 17:06 anandb-ripencc

In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/immintrin.h:43,
                   from ./src/haswell/simd.h:12,
                   from ./src/haswell/parser.c:12:
  ./src/haswell/simd.h: In function ‘simd_loadu_8x’:
  /usr/lib/gcc/x86_64-linux-gnu/11/include/avxintrin.h:927:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_loadu_si256’: target specific option mismatch
    927 | _mm256_loadu_si256 (__m256i_u const *__P)
        | ^~~~~~~~~~~~~~~~~~
  In file included from ./src/haswell/parser.c:12:
  ./src/haswell/simd.h:39:21: note: called from here
     39 |   simd->chunks[0] = _mm256_loadu_si256((const __m256i *)(address));
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  make[1]: *** [Makefile:61: src/haswell/parser.o] Error 1
  make[1]: *** Waiting for unfinished jobs....
  In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/x86gprintrin.h:71,
                   from /usr/lib/gcc/x86_64-linux-gnu/11/include/immintrin.h:27,
                   from ./src/westmere/simd.h:13,
                   from ./src/westmere/parser.c:12:
  ./src/westmere/bits.h: In function ‘count_ones’:
  /usr/lib/gcc/x86_64-linux-gnu/11/include/popcntintrin.h:42:1: error: inlining failed in call to ‘always_inline’ ‘_mm_popcnt_u64’: target specific option mismatch
     42 | _mm_popcnt_u64 (unsigned long long __X)
        | ^~~~~~~~~~~~~~
  In file included from ./src/westmere/parser.c:14:
  ./src/westmere/bits.h:20:20: note: called from here
     20 |   return (uint64_t)_mm_popcnt_u64(input_num);
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
  make[1]: *** [Makefile:57: src/westmere/parser.o] Error 1
  make[1]: Leaving directory '/tmp/nsd-202[406](https://github.com/Homebrew/homebrew-core/actions/runs/9700816204/job/26773348772?pr=175796#step:4:407)27-4700-5l8yo4/nsd-4.10.0/simdzone'
  make: *** [Makefile:159: simdzone/libzone.a] Error 2

chenrui333 avatar Jun 27 '24 17:06 chenrui333

I don't know what the error means, and how to fix it. I'll point the NSD developers here.

anandb-ripencc avatar Jun 27 '24 18:06 anandb-ripencc

Hi all! :wave: I'm looking at this issue to find out why this is not properly compiling for Homebrew. It seems like the compiler(s) aren't handling target dependencies correctly. E.g. code in westmere gets compiled with -march=westmere, but for Linux it's complaining about missing POPCNT (which is part of SSE4.2 and thus Westmere) and on Apple x86_64 it's complaining about needing PCMUL (also part of Westmere). Of course, there's also the errors related to Haswell. I tried to reproduce, but couldn't on my local machines.

The really quick-fix is to just pass --disable-westmere and --disable-haswell to configure. However, I would like to know why this issue exists. Perhaps, it's as simple as passing e.g. -mpopcnt and -mpclmul to get westmere working? Any way I can easily debug this in a Homebrew build environment?

k0ekk0ek avatar Jul 05 '24 09:07 k0ekk0ek

We included some configure tests in NLnetLabs/simdzone#211 to test if the compiler flags work correctly. In this case that'd mean that the westmere and haswell kernels of the zone parser are automatically disabled. The build should work when NSD 4.10.1 is released. At later point int time I/we might update the build scripts to pass individual flags rather than westmere or haswell, but let's get the build working first :slightly_smiling_face:

k0ekk0ek avatar Jul 15 '24 09:07 k0ekk0ek

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Aug 05 '24 11:08 github-actions[bot]

If you have access to a machine with Homebrew installed (Linux or Mac), you can use brew sh to be dropped into a shell environment that is more or less the same as the build environment.

One possibility to consider is that Homebrew has compiler shims to wrap around compiler calls (try which cc when inside of brew sh). I think Homebrew defaults to -march=nehalem on macOS and -march=core2 on Linux, since those are the minimum/oldest archs supported; the binaries built in the CI target these older archs for backward compatibility. The compiler shims may be stripping off -march compiler flags that the NSD build process is expecting to take effect.

alebcay avatar Aug 12 '24 04:08 alebcay

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Sep 02 '24 05:09 github-actions[bot]

Superseded by #183080

cho-m avatar Sep 03 '24 23:09 cho-m