Bug 285285 - benchmarks/lzbench doesn't build
Summary: benchmarks/lzbench doesn't build
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Alexey Dokuchaev
URL: https://portsfallout.com/port/1333/
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-09 15:20 UTC by Anton Saietskii
Modified: 2025-05-16 02:49 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (danfe)


Attachments
v0 (apply via 'git am') (2.74 KB, patch)
2025-03-09 16:12 UTC, Anton Saietskii
vsasjason: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Saietskii 2025-03-09 15:20:35 UTC
c++ -Wno-unknown-pragmas -Wno-sign-compare -Wno-conversion -fomit-frame-pointer -fstrict-aliasing -ffast-math -O3 -DNDEBUG -I./. -I./brotli/include -I./libcsc -I./libdeflate -I./xpack/common   kanzi-cpp/src/io/CompressedOutputStream.cpp -c -o kanzi-cpp/src/io/CompressedOutputStream.o
In file included from kanzi-cpp/src/io/CompressedOutputStream.cpp:17:
In file included from kanzi-cpp/src/io/CompressedOutputStream.hpp:29:
In file included from kanzi-cpp/src/io/../util/XXHash32.hpp:22:
kanzi-cpp/src/io/../util/../Memory.hpp:178:13: error: use of undeclared identifier 'bswap64'
  178 |       val = bswap64(val);
      |             ^
kanzi-cpp/src/io/../util/../Memory.hpp:196:13: error: use of undeclared identifier 'bswap32'
  196 |       val = bswap32(val);
      |             ^
kanzi-cpp/src/io/../util/../Memory.hpp:214:13: error: use of undeclared identifier 'bswap16'
  214 |       val = bswap16(val);
      |             ^
kanzi-cpp/src/io/../util/../Memory.hpp:223:19: error: use of undeclared identifier 'bswap64'
  223 |       val = int64(bswap64(uint64(val)));
      |                   ^
kanzi-cpp/src/io/../util/../Memory.hpp:238:19: error: use of undeclared identifier 'bswap32'
  238 |       val = int32(bswap32(uint32(val)));
      |                   ^
kanzi-cpp/src/io/../util/../Memory.hpp:253:19: error: use of undeclared identifier 'bswap16'
  253 |       val = int16(bswap16(uint16(val)));
      |                   ^
6 errors generated.
gmake: *** [Makefile:595: kanzi-cpp/src/io/CompressedOutputStream.o] Error 1
Comment 1 Anton Saietskii 2025-03-09 16:12:51 UTC
Created attachment 258489 [details]
v0 (apply via 'git am')
Comment 2 Alexey Dokuchaev freebsd_committer freebsd_triage 2025-03-10 03:21:58 UTC
Interestingly, it builds fine for me on 13.3/i386 and not very recent 15-CURRENT/amd64, I wonder which commit the in base had broken it.
Comment 3 Anton Saietskii 2025-04-14 16:23:27 UTC
Is something wrong with my patch that prevents immediate commit?
Comment 4 Alexey Dokuchaev freebsd_committer freebsd_triage 2025-04-15 04:20:58 UTC
(In reply to Anton Saietskii from comment #3)
> Is something wrong with my patch [...]?
I don't know yet, sorry; I still haven't figured out what's causing the breakage on newer FreeBSD versions and thus cannot assess whether proposed fix is correct or not; I'll try to move this up my task queue.
Comment 5 Anton Saietskii 2025-04-15 10:55:52 UTC
(In reply to Alexey Dokuchaev from comment #4)

For me, it's pretty obvious:
1. port fails to build in my poudriere as well as on all official pkg builders;
2. bswap functions are defined in different file, not the one included;
3. with patch applied, build succeeds locally (and surely will on pkg builders);
4. built port executes kanzi benchmark successfully.

I did not see a successful build log of 2.0.1 *without patch* in question -- it failed for me right away. Regardless, I'd say more important thing is unbreak the port in current state of src branches.

BTW, if you feel like you have not enough time for this, I will happily adopt port and promise that any version update or patch that required 1-3 changed lines will be ready in less than 24h from the time of me received relevant notification, just let me know.
Comment 6 Alexey Dokuchaev freebsd_committer freebsd_triage 2025-05-15 07:29:44 UTC
(In reply to Anton Saietskii from comment #5)
> For me, it's pretty obvious: [...]
Was not for me.  Apparently, on my 13.2 system with clang version 14.0.5 it builds because `sys/endian.h' is silently pulled by C++ headers:

  $ grep -B1 sys/endian.h /usr/include/c++/v1/__config
  #ifdef __FreeBSD__
  #  include <sys/endian.h>
  --
  #if defined(__NetBSD__) || defined(__OpenBSD__)
  #  include <sys/endian.h>

The reference 13.4 machine in our cluster has newer compiler (19.1.5) and grep shows nothing:

  $ grep -r sys/endian.h /usr/include/c++/v1/
  $ _

I wonder if <sys/endian.h> would be the right header for other BSDs as well, it is weird that the same <machine/endian.h> is also pulled in the #elif defined(OS_MACOSX) clause.  I'll ping upstream about this.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-05-16 02:42:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c80f4950824f748d68724d3e7a8f26571fff3db3

commit c80f4950824f748d68724d3e7a8f26571fff3db3
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2025-05-16 02:41:04 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2025-05-16 02:41:04 +0000

    benchmarks/lzbench: try to unbreak the port's build against newer Clang

    As of September 2023 (llvmorg-18.1.0-rc1) /usr/include/c++/v1/__config
    no longer includes <sys/endian.h>, because both Clang and GCC always
    define __BYTE_ORDER__ macro.  This had accidentally revealed a problem
    in Kanzi data compressor which was including <machine/endian.h> to no
    avail.  Replace it with <sys/endian.h> to obtain bswap??() definitions.

    Reported by:    pkg-fallout
    PR:             285285
    LLVM commit:    https://github.com/llvm/llvm-project/commit/0a97720

 benchmarks/lzbench/Makefile | 2 ++
 1 file changed, 2 insertions(+)