Opened 9 months ago

Last modified 8 months ago

#61063 assigned defect

mariadb-10.5: Undefined symbols for architecture x86_64: "_crc32_pclmul", "_crc32_pclmul_enabled"

Reported by: chrstphrchvz (Christopher Chavez) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc:
Port: mariadb-10.5

Description

10.6 (64-bit) build fails during linking (though it is unclear exactly where due to the build running with make -j7):

Undefined symbols for architecture x86_64:
  "_crc32_pclmul", referenced from:
      _my_checksum_init in libmysys.a(checksum.c.o)
  "_crc32_pclmul_enabled", referenced from:
      _my_checksum_init in libmysys.a(checksum.c.o)
ld: symbol(s) not found for architecture x86_64

(I personally do not need this port.)

Attachments (1)

patch-mariadb105-checksum-clmul.diff (509 bytes) - added by kencu (Ken) 8 months ago.

Download all attachments as: .zip

Change History (10)

comment:2 Changed 9 months ago by kencu (Ken)

i've built mariadb-10.5 on 10.6.8 64-bit, and don't see this error.

comment:3 Changed 8 months ago by kencu (Ken)

And yet the buildbot just tried to build and had this error again. Hmm... something.

comment:4 Changed 8 months ago by kencu (Ken)

This appears to have something to do with the processor that is building this. The missing function is defined in this file crc32/crc32_x86.c That file is only included if the system can support the pclmulqdq instruction, according to this bit in mysys/CMakeLists.txt

IF(NOT MSVC AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
  #Check for PCLMUL instruction (x86)
  CHECK_C_SOURCE_COMPILES("
  int main()
  {
    asm volatile (\"pclmulqdq \\$0x00, %%xmm1, %%xmm0\":::\"cc\");
    return 0;
  }" HAVE_CLMUL_INSTRUCTION)

  IF(HAVE_CLMUL_INSTRUCTION)
    SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c)
  ENDIF()

according to <https://en.wikipedia.org/wiki/Westmere_(microarchitecture)> that instruction is available on Nehalem and greater processors, which I am using. So presumably the 10.6 buildbot is on something less than a Nehalem, and therefore fails.

The whole thing is controlled from mysys/checksum.c and I think that with a bit of thought, we could come up with a way to use the fallbacks.

It seems though that this symbol should be weak linked, and fall through to the final catch-all automatically.

I suspect that something with the weak-linking is not 100% right here.

Last edited 8 months ago by kencu (Ken) (previous) (diff)

comment:5 Changed 8 months ago by kencu (Ken)

comment:6 Changed 8 months ago by kencu (Ken)

So I can reproduce this on another SnowLeopard system I have with an older processor. I have a patch to fix this, and it looks likely to be upstreamable as well.

comment:7 Changed 8 months ago by kencu (Ken)

<https://github.com/MariaDB/server/pull/1660>

I can do a MacPorts patch as well -- attached.

Changed 8 months ago by kencu (Ken)

comment:8 Changed 8 months ago by michaelld (Michael Dickens)

@kencu: Given that this change impacts very few MP users, please finish up with MDB folks on the PR and then create a MP PR with the added patch that we can use in the interim until the next MDB 10.5 release is out. Thx for your sleuthing and work here, as always!

comment:9 Changed 8 months ago by kencu (Ken)

here's what upstream settled on; it works to fix this issue <https://github.com/MariaDB/server/commit/b47d61d04fe59368a4d2c2de1bd04d9a8b5a20e5>

Note: See TracTickets for help on using tickets.