Opened 13 days ago

Closed 10 days ago

#73811 closed defect (fixed)

sysbench @1.0.20: error: unknown type name 'crc'

Reported by: casr (Chris Rawnsley) Owned by: sainnhe (Sainnhe Park)
Priority: Normal Milestone:
Component: ports Version: 2.12.4
Keywords: tahoe arm64 Cc:
Port: sysbench

Description (last modified by casr (Chris Rawnsley))

Running from an empty installation and building sysbench from source:

sudo port -N clean --all installed
sudo port -N uninstall installed
sudo port -N install depof:sysbench
sudo port -N install -vs sysbench

I get:

Making all in fileio
make[3]: Entering directory `/opt/local/var/macports/build/sysbench-d0aa836b/work/sysbench-1.0.20/src/tests/fileio'
/usr/bin/clang -std=gnu23 -DHAVE_CONFIG_H -I. -I../../../config  -I../../../src -I/opt/local/include/luajit-2.1 -I/opt/local/var/macports/build/sysbench-d0aa836b/work/sysbench-1.0.20/third_party/concurrency_kit/include -D_DARWIN_C_SOURCE -D_GNU_SOURCE -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -DCK_MD_CACHELINE=128 -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla   -D_THREAD_SAFE  -O2 -funroll-loops -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -arch arm64 -MT libsbfileio_a-sb_fileio.o -MD -MP -MF .deps/libsbfileio_a-sb_fileio.Tpo -c -o libsbfileio_a-sb_fileio.o `test -f 'sb_fileio.c' || echo './'`sb_fileio.c
/usr/bin/clang -std=gnu23 -DHAVE_CONFIG_H -I. -I../../../config  -I../../../src -I/opt/local/include/luajit-2.1 -I/opt/local/var/macports/build/sysbench-d0aa836b/work/sysbench-1.0.20/third_party/concurrency_kit/include -D_DARWIN_C_SOURCE -D_GNU_SOURCE -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -DCK_MD_CACHELINE=128 -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla   -D_THREAD_SAFE  -O2 -funroll-loops -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -arch arm64 -MT libsbfileio_a-crc32.o -MD -MP -MF .deps/libsbfileio_a-crc32.Tpo -c -o libsbfileio_a-crc32.o `test -f 'crc32.c' || echo './'`crc32.c
crc32.c:194:29: error: unknown type name 'crc'
  194 | unsigned long ZEXPORT crc32(crc, buf, len)
      |                             ^
crc32.c:194:34: error: unknown type name 'buf'
  194 | unsigned long ZEXPORT crc32(crc, buf, len)
      |                                  ^
crc32.c:194:39: error: unknown type name 'len'
  194 | unsigned long ZEXPORT crc32(crc, buf, len)
      |                                       ^
crc32.c:194:43: error: expected ';' after top level declarator
  194 | unsigned long ZEXPORT crc32(crc, buf, len)
      |                                           ^
      |                                           ;
crc32.c:198:1: error: expected identifier or '('
  198 | {
      | ^
crc32.c:237:34: error: unknown type name 'crc'
  237 | local unsigned long crc32_little(crc, buf, len)
      |                                  ^
crc32.c:237:39: error: unknown type name 'buf'
  237 | local unsigned long crc32_little(crc, buf, len)
      |                                       ^
crc32.c:237:44: error: unknown type name 'len'
  237 | local unsigned long crc32_little(crc, buf, len)
      |                                            ^
crc32.c:237:48: error: expected ';' after top level declarator
  237 | local unsigned long crc32_little(crc, buf, len)
      |                                                ^
      |                                                ;
crc32.c:241:1: error: expected identifier or '('
  241 | {
      | ^
crc32.c:277:31: error: unknown type name 'crc'
  277 | local unsigned long crc32_big(crc, buf, len)
      |                               ^
crc32.c:277:36: error: unknown type name 'buf'
  277 | local unsigned long crc32_big(crc, buf, len)
      |                                    ^
crc32.c:277:41: error: unknown type name 'len'
  277 | local unsigned long crc32_big(crc, buf, len)
      |                                         ^
crc32.c:277:45: error: expected ';' after top level declarator
  277 | local unsigned long crc32_big(crc, buf, len)
      |                                             ^
      |                                             ;
crc32.c:281:1: error: expected identifier or '('
  281 | {
      | ^

Change History (12)

comment:1 Changed 13 days ago by casr (Chris Rawnsley)

Description: modified (diff)

comment:2 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

Keywords: tahoe arm64 added
Owner: set to sainnhe
Status: newassigned
Summary: sysbench: fails to compilesysbench @1.0.20: error: unknown type name 'crc'

We had successful builds of sysbench on all 64-bit systems on our automated build system. Can you attach your main.log file so we can investigate what's different about your build?

comment:3 in reply to:  description Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

Replying to casr:

/usr/bin/clang -std=gnu23 -DHAVE_CONFIG_H -I. -I../../../config  -I../../../src -I/opt/local/include/luajit-2.1 -I/opt/local/var/macports/build/sysbench-d0aa836b/work/sysbench-1.0.20/third_party/concurrency_kit/include -D_DARWIN_C_SOURCE -D_GNU_SOURCE -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -DCK_MD_CACHELINE=128 -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla   -D_THREAD_SAFE  -O2 -funroll-loops -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk -arch arm64 -MT libsbfileio_a-sb_fileio.o -MD -MP -MF .deps/libsbfileio_a-sb_fileio.Tpo -c -o libsbfileio_a-sb_fileio.o `test -f 'sb_fileio.c' || echo './'`sb_fileio.c

-std=gnu23 is surprisingly new. sysbench does use autoreconf and we did just update the autoconf port to 2.73 which is the first version that tries to use C23 if available, and C23 is not fully backward-compatible:

*** AC_PROG_CC now prefers C23 if available.
  Older code may need to be updated, as C23 has removed old-style
  (K&R) function definitions and declarations, now uses type-generic
  functions for strchr and similar functions, and has new keywords
  alignas, alignof, bool, constexpr, false, nullptr, static_assert,
  thread_local, true, typeof, typeof_unqual.

When I build on my macOS 12 system using its Xcode clang, which doesn't support C23, the build succeeds, but if I force the use of MacPorts clang-21, which supports C23, then the build fails for me as it did for you.

comment:4 Changed 13 days ago by casr (Chris Rawnsley)

Ah that sounds right about on the money. Thank you for investigating!

Is this something that should be added to the port as a compiler.blacklist?

comment:5 Changed 13 days ago by casr (Chris Rawnsley)

Just tried with:

compiler.blacklist-append  {clang < 2300}

and it installed this time.

Edit: actually that seems like it should not have worked after re-reading your message. Hmm

Last edited 13 days ago by casr (Chris Rawnsley) (previous) (diff)

comment:6 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

We shouldn't blacklist old compilers; we should fix the port so that it can build with new compilers.

For example, this port may need to have a -std= flag added to CFLAGS to tell the compiler to use whatever older C standard this code was designed for.

comment:7 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

And the problem should be reported to the developers so they can fix it in whatever way they think is best.

comment:8 Changed 13 days ago by ryandesign (Ryan Carsten Schmidt)

comment:9 Changed 13 days ago by casr (Chris Rawnsley)

comment:10 Changed 11 days ago by Chris Rawnsley <chris@…>

In b19f96ed5ab12f5d47d478eac7b4234e18e6b45b/macports-ports (master):

sysbench: use C99

Support for K&R function definition support was dropped in C23 but it is
still used in src/tests/fileio/crc32.c

See: #73811
See: https://github.com/akopytov/sysbench/issues/566

comment:11 Changed 10 days ago by casr (Chris Rawnsley)

This should now be resolved since the above was merged.

comment:12 Changed 10 days ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.